diff options
author | Kurt <kurt.w.jung@gmail.com> | 2018-04-04 14:31:47 -0400 |
---|---|---|
committer | Kurt <kurt.w.jung@gmail.com> | 2018-04-04 14:31:47 -0400 |
commit | 7a47e7018ccde09a294789f42534c8c3cbe8a538 (patch) | |
tree | e3604689cc29cc6b307ef2f0fb22d2c5c86b08f9 | |
parent | 0e1803180e2d0e5dab7f67ed5592974ccc2de7fa (diff) |
Add X and Y range methods to grid
-rw-r--r-- | grid.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -186,6 +186,24 @@ func (g GridType) Y(dataY float64) float64 { return g.ym*dataY + g.yb } +// XRange returns the minimum and maximum values for the current tickmark +// sequence. These correspond to the data values of the graph's left and right +// edges. +func (g GridType) XRange() (min, max float64) { + min = g.xTicks[0] + max = g.xTicks[len(g.xTicks)-1] + return +} + +// YRange returns the minimum and maximum values for the current tickmark +// sequence. These correspond to the data values of the graph's bottom and top +// edges. +func (g GridType) YRange() (min, max float64) { + min = g.yTicks[0] + max = g.yTicks[len(g.yTicks)-1] + return +} + // TickmarksContainX sets the tickmarks to be shown by Grid() in the horizontal // dimension. The argument min and max specify the minimum and maximum values // to be contained within the grid. The tickmark values that are generated are |