(data *DataTable, index int)
| 243 | } |
| 244 | |
| 245 | func 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 |
| 281 | func getChartData(data *DataTable, index int) (out [][]float64) { |
no outgoing calls
no test coverage detected
searching dependent graphs…