OutsideLabels returns a *Labels that will plot a label for each of the outside points. The labels are assumed to correspond to the points used to create the plot.
(labels Labeller)
| 157 | // labels are assumed to correspond to the |
| 158 | // points used to create the plot. |
| 159 | func (b *QuartPlot) OutsideLabels(labels Labeller) (*Labels, error) { |
| 160 | if b.Horizontal { |
| 161 | b := &horizQuartPlot{b} |
| 162 | return b.OutsideLabels(labels) |
| 163 | } |
| 164 | strs := make([]string, len(b.Outside)) |
| 165 | for i, out := range b.Outside { |
| 166 | strs[i] = labels.Label(out) |
| 167 | } |
| 168 | o := quartPlotOutsideLabels{b, strs} |
| 169 | ls, err := NewLabels(o) |
| 170 | if err != nil { |
| 171 | return nil, err |
| 172 | } |
| 173 | off := 0.5 * b.MedianStyle.Radius |
| 174 | ls.Offset = ls.Offset.Add(vg.Point{X: off, Y: off}) |
| 175 | return ls, nil |
| 176 | } |
| 177 | |
| 178 | type quartPlotOutsideLabels struct { |
| 179 | qp *QuartPlot |