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)
| 258 | // labels are assumed to correspond to the |
| 259 | // points used to create the plot. |
| 260 | func (b *horizQuartPlot) OutsideLabels(labels Labeller) (*Labels, error) { |
| 261 | strs := make([]string, len(b.Outside)) |
| 262 | for i, out := range b.Outside { |
| 263 | strs[i] = labels.Label(out) |
| 264 | } |
| 265 | o := horizQuartPlotOutsideLabels{ |
| 266 | quartPlotOutsideLabels{b.QuartPlot, strs}, |
| 267 | } |
| 268 | ls, err := NewLabels(o) |
| 269 | if err != nil { |
| 270 | return nil, err |
| 271 | } |
| 272 | off := 0.5 * b.MedianStyle.Radius |
| 273 | ls.Offset = ls.Offset.Add(vg.Point{X: off, Y: off}) |
| 274 | return ls, nil |
| 275 | } |
| 276 | |
| 277 | type horizQuartPlotOutsideLabels struct { |
| 278 | quartPlotOutsideLabels |