setStockRange sets the minimum and maximum values of the stock plotting locations.
(stocks *[]*stock)
| 324 | |
| 325 | // setStockRange sets the minimum and maximum values of the stock plotting locations. |
| 326 | func (s *Sankey) setStockRange(stocks *[]*stock) { |
| 327 | var cat int |
| 328 | var min float64 |
| 329 | for _, stk := range *stocks { |
| 330 | if stk.category != cat { |
| 331 | min = 0 |
| 332 | } |
| 333 | cat = stk.category |
| 334 | stk.min = min |
| 335 | if stk.sourceValue > stk.receptorValue { |
| 336 | stk.max = stk.min + stk.sourceValue |
| 337 | } else { |
| 338 | stk.max = stk.min + stk.receptorValue |
| 339 | } |
| 340 | min = stk.max |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | // bezier creates a bezier curve between the begin and end points. |
| 345 | func (s *Sankey) bezier(begin, end vg.Point) []vg.Point { |