MCPcopy Index your code
hub / github.com/gonum/plot / DataRange

Method DataRange

plotter/barchart.go:157–173  ·  view source on GitHub ↗

DataRange implements the plot.DataRanger interface.

()

Source from the content-addressed store, hash-verified

155
156// DataRange implements the plot.DataRanger interface.
157func (b *BarChart) DataRange() (xmin, xmax, ymin, ymax float64) {
158 catMin := b.XMin
159 catMax := catMin + float64(len(b.Values)-1)
160
161 valMin := math.Inf(1)
162 valMax := math.Inf(-1)
163 for i, val := range b.Values {
164 valBot := b.stackedOn.BarHeight(i)
165 valTop := valBot + val
166 valMin = math.Min(valMin, math.Min(valBot, valTop))
167 valMax = math.Max(valMax, math.Max(valBot, valTop))
168 }
169 if !b.Horizontal {
170 return catMin, catMax, valMin, valMax
171 }
172 return valMin, valMax, catMin, catMax
173}
174
175// GlyphBoxes implements the GlyphBoxer interface.
176func (b *BarChart) GlyphBoxes(plt *plot.Plot) []plot.GlyphBox {

Callers

nothing calls this directly

Calls 3

BarHeightMethod · 0.80
MinMethod · 0.65
MaxMethod · 0.65

Tested by

no test coverage detected