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

Method genPlot

plot/plotcore/ploteditor.go:310–335  ·  view source on GitHub ↗

genPlot generates the plot and renders it to SVG It surrounds operation with InPlot true / false to prevent multiple updates

()

Source from the content-addressed store, hash-verified

308// genPlot generates the plot and renders it to SVG
309// It surrounds operation with InPlot true / false to prevent multiple updates
310func (pl *PlotEditor) genPlot() {
311 if pl.inPlot {
312 slog.Error("plot: in plot already") // note: this never seems to happen -- could probably nuke
313 return
314 }
315 pl.inPlot = true
316 if pl.table == nil || pl.table.Table.NumRows() == 0 {
317 // sv.DeleteChildren()
318 pl.inPlot = false
319 return
320 }
321 lsti := pl.table.Indexes[pl.table.Len()-1]
322 if lsti >= pl.table.Table.Rows { // out of date
323 pl.table.Sequential()
324 }
325 pl.plot = nil
326 switch pl.Options.Type {
327 case XY:
328 pl.genPlotXY()
329 case Bar:
330 pl.genPlotBar()
331 }
332 pl.plotWidget.Scale = pl.Options.Scale
333 pl.plotWidget.SetPlot(pl.plot) // redraws etc
334 pl.inPlot = false
335}
336
337// configPlot configures the given plot based on the plot options.
338func (pl *PlotEditor) configPlot(plt *plot.Plot) {

Callers 2

GoUpdatePlotMethod · 0.95
UpdatePlotMethod · 0.95

Calls 7

genPlotXYMethod · 0.95
genPlotBarMethod · 0.95
SequentialMethod · 0.80
SetPlotMethod · 0.80
ErrorMethod · 0.65
NumRowsMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected