DataRange implements the plot.DataRanger interface.
()
| 247 | |
| 248 | // DataRange implements the plot.DataRanger interface. |
| 249 | func (e *XErrorBars) DataRange() (xmin, xmax, ymin, ymax float32) { |
| 250 | ymin, ymax = plot.Range(plot.YValues{e}) |
| 251 | xmin = math32.Inf(1) |
| 252 | xmax = math32.Inf(-1) |
| 253 | for i, err := range e.XErrors { |
| 254 | x := e.XYs[i].X |
| 255 | xlow := x - math32.Abs(err.Low) |
| 256 | xhigh := x + math32.Abs(err.High) |
| 257 | xmin = math32.Min(math32.Min(math32.Min(xmin, x), xlow), xhigh) |
| 258 | xmax = math32.Max(math32.Max(math32.Max(xmax, x), xlow), xhigh) |
| 259 | } |
| 260 | return |
| 261 | } |