MCPcopy Index your code
hub / github.com/gonum/plot / Thumbnail

Method Thumbnail

plotter/line.go:174–196  ·  view source on GitHub ↗

Thumbnail returns the thumbnail for the Line, implementing the plot.Thumbnailer interface.

(c *draw.Canvas)

Source from the content-addressed store, hash-verified

172
173// Thumbnail returns the thumbnail for the Line, implementing the plot.Thumbnailer interface.
174func (pts *Line) Thumbnail(c *draw.Canvas) {
175 if pts.FillColor != nil {
176 var topY vg.Length
177 if pts.LineStyle.Width == 0 {
178 topY = c.Max.Y
179 } else {
180 topY = (c.Min.Y + c.Max.Y) / 2
181 }
182 points := []vg.Point{
183 {X: c.Min.X, Y: c.Min.Y},
184 {X: c.Min.X, Y: topY},
185 {X: c.Max.X, Y: topY},
186 {X: c.Max.X, Y: c.Min.Y},
187 }
188 poly := c.ClipPolygonY(points)
189 c.FillPolygon(pts.FillColor, poly)
190 }
191
192 if pts.LineStyle.Width != 0 {
193 y := c.Center().Y
194 c.StrokeLine2(pts.LineStyle, c.Min.X, y, c.Max.X, y)
195 }
196}
197
198// NewLinePoints returns both a Line and a
199// Points for the given point data.

Callers

nothing calls this directly

Calls 4

ClipPolygonYMethod · 0.80
FillPolygonMethod · 0.80
CenterMethod · 0.80
StrokeLine2Method · 0.80

Tested by

no test coverage detected