MCPcopy Create free account
hub / github.com/buger/goterm / getBoundaryValues

Function getBoundaryValues

plot.go:245–278  ·  view source on GitHub ↗
(data *DataTable, index int)

Source from the content-addressed store, hash-verified

243}
244
245func getBoundaryValues(data *DataTable, index int) (maxX, minX, maxY, minY float64) {
246 maxX = math.Inf(-1)
247 minX = math.Inf(1)
248 maxY = math.Inf(-1)
249 minY = math.Inf(1)
250
251 for _, r := range data.rows {
252 maxX = math.Max(maxX, r[0])
253 minX = math.Min(minX, r[0])
254
255 for idx, c := range r {
256 if idx > 0 {
257 if index == -1 || index == idx {
258 maxY = math.Max(maxY, c)
259 minY = math.Min(minY, c)
260 }
261 }
262 }
263 }
264
265 if maxY > 0 {
266 maxY = maxY * 1.1
267 } else {
268 maxY = maxY * 0.9
269 }
270
271 if minY > 0 {
272 minY = minY * 0.9
273 } else {
274 minY = minY * 1.1
275 }
276
277 return
278}
279
280// DataTable can contain data for multiple graphs, we need to extract only 1
281func getChartData(data *DataTable, index int) (out [][]float64) {

Callers 1

DrawMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…