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 box plot.
(labels Labeller)
| 410 | // labels are assumed to correspond to the |
| 411 | // points used to create the box plot. |
| 412 | func (b *horizBoxPlot) OutsideLabels(labels Labeller) (*Labels, error) { |
| 413 | strs := make([]string, len(b.Outside)) |
| 414 | for i, out := range b.Outside { |
| 415 | strs[i] = labels.Label(out) |
| 416 | } |
| 417 | o := horizBoxPlotOutsideLabels{ |
| 418 | boxPlotOutsideLabels{b.BoxPlot, strs}, |
| 419 | } |
| 420 | ls, err := NewLabels(o) |
| 421 | if err != nil { |
| 422 | return nil, err |
| 423 | } |
| 424 | off := 0.5 * b.GlyphStyle.Radius |
| 425 | ls.Offset = ls.Offset.Add(vg.Point{X: off, Y: off}) |
| 426 | return ls, nil |
| 427 | } |
| 428 | |
| 429 | type horizBoxPlotOutsideLabels struct { |
| 430 | boxPlotOutsideLabels |