DataRange implements the plot.DataRanger interface.
()
| 363 | |
| 364 | // DataRange implements the plot.DataRanger interface. |
| 365 | func (s *Sankey) DataRange() (xmin, xmax, ymin, ymax float64) { |
| 366 | catMin := math.Inf(1) |
| 367 | catMax := math.Inf(-1) |
| 368 | for cat := range s.stocks { |
| 369 | c := float64(cat) |
| 370 | catMin = math.Min(catMin, c) |
| 371 | catMax = math.Max(catMax, c) |
| 372 | } |
| 373 | |
| 374 | stocks := s.stockList() |
| 375 | valMin := math.Inf(1) |
| 376 | valMax := math.Inf(-1) |
| 377 | for _, stk := range stocks { |
| 378 | valMin = math.Min(valMin, stk.min) |
| 379 | valMax = math.Max(valMax, stk.max) |
| 380 | } |
| 381 | return catMin, catMax, valMin, valMax |
| 382 | } |
| 383 | |
| 384 | // GlyphBoxes implements the GlyphBoxer interface. |
| 385 | func (s *Sankey) GlyphBoxes(plt *plot.Plot) []plot.GlyphBox { |