genPlot generates the plot and renders it to SVG It surrounds operation with InPlot true / false to prevent multiple updates
()
| 308 | // genPlot generates the plot and renders it to SVG |
| 309 | // It surrounds operation with InPlot true / false to prevent multiple updates |
| 310 | func (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. |
| 338 | func (pl *PlotEditor) configPlot(plt *plot.Plot) { |
no test coverage detected