Plot draws the QuartPlot on Canvas c and Plot plt.
(c draw.Canvas, plt *plot.Plot)
| 81 | |
| 82 | // Plot draws the QuartPlot on Canvas c and Plot plt. |
| 83 | func (b *QuartPlot) Plot(c draw.Canvas, plt *plot.Plot) { |
| 84 | if b.Horizontal { |
| 85 | b := &horizQuartPlot{b} |
| 86 | b.Plot(c, plt) |
| 87 | return |
| 88 | } |
| 89 | |
| 90 | trX, trY := plt.Transforms(&c) |
| 91 | x := trX(b.Location) |
| 92 | if !c.ContainsX(x) { |
| 93 | return |
| 94 | } |
| 95 | x += b.Offset |
| 96 | |
| 97 | med := vg.Point{X: x, Y: trY(b.Median)} |
| 98 | q1 := trY(b.Quartile1) |
| 99 | q3 := trY(b.Quartile3) |
| 100 | aLow := trY(b.AdjLow) |
| 101 | aHigh := trY(b.AdjHigh) |
| 102 | |
| 103 | c.StrokeLine2(b.WhiskerStyle, x, aHigh, x, q3) |
| 104 | if c.ContainsY(med.Y) { |
| 105 | c.DrawGlyphNoClip(b.MedianStyle, med) |
| 106 | } |
| 107 | c.StrokeLine2(b.WhiskerStyle, x, aLow, x, q1) |
| 108 | |
| 109 | ostyle := b.MedianStyle |
| 110 | ostyle.Radius = b.MedianStyle.Radius / 2 |
| 111 | for _, out := range b.Outside { |
| 112 | y := trY(b.Value(out)) |
| 113 | if c.ContainsY(y) { |
| 114 | c.DrawGlyphNoClip(ostyle, vg.Point{X: x, Y: y}) |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | // DataRange returns the minimum and maximum x |
| 120 | // and y values, implementing the plot.DataRanger |
nothing calls this directly
no test coverage detected