DataRange implements the plot.DataRanger interface.
()
| 138 | |
| 139 | // DataRange implements the plot.DataRanger interface. |
| 140 | func (e *YErrorBars) DataRange() (xmin, xmax, ymin, ymax float32) { |
| 141 | xmin, xmax = plot.Range(plot.XValues{e}) |
| 142 | ymin = math32.Inf(1) |
| 143 | ymax = math32.Inf(-1) |
| 144 | for i, err := range e.YErrors { |
| 145 | y := e.XYs[i].Y |
| 146 | ylow := y - math32.Abs(err.Low) |
| 147 | yhigh := y + math32.Abs(err.High) |
| 148 | ymin = math32.Min(math32.Min(math32.Min(ymin, y), ylow), yhigh) |
| 149 | ymax = math32.Max(math32.Max(math32.Max(ymax, y), ylow), yhigh) |
| 150 | } |
| 151 | return |
| 152 | } |
| 153 | |
| 154 | // XErrorBars implements the plot.Plotter, plot.DataRanger, |
| 155 | // and plot.GlyphBoxer interfaces, drawing horizontal error |