MCPcopy Create free account
hub / github.com/cogentcore/core / updatePlot

Method updatePlot

plot/plotcore/plot.go:51–64  ·  view source on GitHub ↗

updatePlot draws the current plot at the size of the current widget, and triggers a Render so the widget will be rendered.

()

Source from the content-addressed store, hash-verified

49// updatePlot draws the current plot at the size of the current widget,
50// and triggers a Render so the widget will be rendered.
51func (pt *Plot) updatePlot() {
52 if pt.Plot == nil {
53 pt.NeedsRender()
54 return
55 }
56 sz := pt.Geom.Size.Actual.Content.ToPoint()
57 if sz == (image.Point{}) {
58 return
59 }
60 pt.Plot.DPI = pt.Scale * pt.Styles.UnitContext.DPI
61 pt.Plot.Resize(sz)
62 pt.Plot.Draw()
63 pt.NeedsRender()
64}
65
66func (pt *Plot) Init() {
67 pt.WidgetBase.Init()

Callers 3

SetPlotMethod · 0.95
InitMethod · 0.95
SizeFinalMethod · 0.95

Calls 4

NeedsRenderMethod · 0.80
ToPointMethod · 0.80
DrawMethod · 0.65
ResizeMethod · 0.45

Tested by

no test coverage detected