BarHeight returns the maximum y value of the ith bar, taking into account any bars upon which it is stacked.
(i int)
| 73 | // ith bar, taking into account any bars upon |
| 74 | // which it is stacked. |
| 75 | func (b *BarChart) BarHeight(i int) float64 { |
| 76 | ht := 0.0 |
| 77 | if b == nil { |
| 78 | return 0 |
| 79 | } |
| 80 | if i >= 0 && i < len(b.Values) { |
| 81 | ht += b.Values[i] |
| 82 | } |
| 83 | if b.stackedOn != nil { |
| 84 | ht += b.stackedOn.BarHeight(i) |
| 85 | } |
| 86 | return ht |
| 87 | } |
| 88 | |
| 89 | // StackOn stacks a bar chart on top of another, |
| 90 | // and sets the XMin and Offset to that of the |