DataRange returns the minimum and maximum x and y values, implementing the plot.DataRanger interface.
()
| 93 | // x and y values, implementing the plot.DataRanger |
| 94 | // interface. |
| 95 | func (pts *Polygon) DataRange() (xmin, xmax, ymin, ymax float64) { |
| 96 | xmin = math.Inf(1) |
| 97 | xmax = math.Inf(-1) |
| 98 | ymin = math.Inf(1) |
| 99 | ymax = math.Inf(-1) |
| 100 | for _, ring := range pts.XYs { |
| 101 | xmini, xmaxi := Range(XValues{ring}) |
| 102 | ymini, ymaxi := Range(YValues{ring}) |
| 103 | xmin = math.Min(xmin, xmini) |
| 104 | xmax = math.Max(xmax, xmaxi) |
| 105 | ymin = math.Min(ymin, ymini) |
| 106 | ymax = math.Max(ymax, ymaxi) |
| 107 | } |
| 108 | return |
| 109 | } |
| 110 | |
| 111 | // Thumbnail creates the thumbnail for the Polygon, |
| 112 | // implementing the plot.Thumbnailer interface. |