summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt <kurt.w.jung@gmail.com>2018-04-04 14:31:47 -0400
committerKurt <kurt.w.jung@gmail.com>2018-04-04 14:31:47 -0400
commit7a47e7018ccde09a294789f42534c8c3cbe8a538 (patch)
treee3604689cc29cc6b307ef2f0fb22d2c5c86b08f9
parent0e1803180e2d0e5dab7f67ed5592974ccc2de7fa (diff)
Add X and Y range methods to grid
-rw-r--r--grid.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/grid.go b/grid.go
index d759b75..825fa3b 100644
--- a/grid.go
+++ b/grid.go
@@ -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