Add response time badge and chart
This commit is contained in:
42
vendor/github.com/wcharczuk/go-chart/v2/linear_coefficient_provider.go
generated
vendored
Normal file
42
vendor/github.com/wcharczuk/go-chart/v2/linear_coefficient_provider.go
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
package chart
|
||||
|
||||
// LinearCoefficientProvider is a type that returns linear cofficients.
|
||||
type LinearCoefficientProvider interface {
|
||||
Coefficients() (m, b, stdev, avg float64)
|
||||
}
|
||||
|
||||
// LinearCoefficients returns a fixed linear coefficient pair.
|
||||
func LinearCoefficients(m, b float64) LinearCoefficientSet {
|
||||
return LinearCoefficientSet{
|
||||
M: m,
|
||||
B: b,
|
||||
}
|
||||
}
|
||||
|
||||
// NormalizedLinearCoefficients returns a fixed linear coefficient pair.
|
||||
func NormalizedLinearCoefficients(m, b, stdev, avg float64) LinearCoefficientSet {
|
||||
return LinearCoefficientSet{
|
||||
M: m,
|
||||
B: b,
|
||||
StdDev: stdev,
|
||||
Avg: avg,
|
||||
}
|
||||
}
|
||||
|
||||
// LinearCoefficientSet is the m and b values for the linear equation in the form:
|
||||
// y = (m*x) + b
|
||||
type LinearCoefficientSet struct {
|
||||
M float64
|
||||
B float64
|
||||
StdDev float64
|
||||
Avg float64
|
||||
}
|
||||
|
||||
// Coefficients returns the coefficients.
|
||||
func (lcs LinearCoefficientSet) Coefficients() (m, b, stdev, avg float64) {
|
||||
m = lcs.M
|
||||
b = lcs.B
|
||||
stdev = lcs.StdDev
|
||||
avg = lcs.Avg
|
||||
return
|
||||
}
|
Reference in New Issue
Block a user