(c draw.Canvas, plt *plot.Plot)
| 330 | type horizBoxPlot struct{ *BoxPlot } |
| 331 | |
| 332 | func (b horizBoxPlot) Plot(c draw.Canvas, plt *plot.Plot) { |
| 333 | trX, trY := plt.Transforms(&c) |
| 334 | y := trY(b.Location) |
| 335 | if !c.ContainsY(y) { |
| 336 | return |
| 337 | } |
| 338 | y += b.Offset |
| 339 | |
| 340 | med := trX(b.Median) |
| 341 | q1 := trX(b.Quartile1) |
| 342 | q3 := trX(b.Quartile3) |
| 343 | aLow := trX(b.AdjLow) |
| 344 | aHigh := trX(b.AdjHigh) |
| 345 | |
| 346 | pts := []vg.Point{ |
| 347 | {X: q1, Y: y - b.Width/2}, |
| 348 | {X: q3, Y: y - b.Width/2}, |
| 349 | {X: q3, Y: y + b.Width/2}, |
| 350 | {X: q1, Y: y + b.Width/2}, |
| 351 | {X: q1, Y: y - b.Width/2 - b.BoxStyle.Width/2}, |
| 352 | } |
| 353 | box := c.ClipLinesX(pts) |
| 354 | if b.FillColor != nil { |
| 355 | c.FillPolygon(b.FillColor, c.ClipPolygonX(pts)) |
| 356 | } |
| 357 | c.StrokeLines(b.BoxStyle, box...) |
| 358 | |
| 359 | medLine := c.ClipLinesX([]vg.Point{ |
| 360 | {X: med, Y: y - b.Width/2}, |
| 361 | {X: med, Y: y + b.Width/2}, |
| 362 | }) |
| 363 | c.StrokeLines(b.MedianStyle, medLine...) |
| 364 | |
| 365 | cap := b.CapWidth / 2 |
| 366 | whisks := c.ClipLinesX( |
| 367 | []vg.Point{{X: q3, Y: y}, {X: aHigh, Y: y}}, |
| 368 | []vg.Point{{X: aHigh, Y: y - cap}, {X: aHigh, Y: y + cap}}, |
| 369 | []vg.Point{{X: q1, Y: y}, {X: aLow, Y: y}}, |
| 370 | []vg.Point{{X: aLow, Y: y - cap}, {X: aLow, Y: y + cap}}, |
| 371 | ) |
| 372 | c.StrokeLines(b.WhiskerStyle, whisks...) |
| 373 | |
| 374 | for _, out := range b.Outside { |
| 375 | x := trX(b.Value(out)) |
| 376 | if c.ContainsX(x) { |
| 377 | c.DrawGlyphNoClip(b.GlyphStyle, vg.Point{X: x, Y: y}) |
| 378 | } |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | // DataRange returns the minimum and maximum x |
| 383 | // and y values, implementing the plot.DataRanger |
nothing calls this directly
no test coverage detected