updatePlot draws the current plot at the size of the current widget, and triggers a Render so the widget will be rendered.
()
| 49 | // updatePlot draws the current plot at the size of the current widget, |
| 50 | // and triggers a Render so the widget will be rendered. |
| 51 | func (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 | |
| 66 | func (pt *Plot) Init() { |
| 67 | pt.WidgetBase.Init() |