plotXAxis processes the XAxis and returns its index
(plt *plot.Plot, ixvw *table.IndexView)
| 358 | |
| 359 | // plotXAxis processes the XAxis and returns its index |
| 360 | func (pl *PlotEditor) plotXAxis(plt *plot.Plot, ixvw *table.IndexView) (xi int, xview *table.IndexView, err error) { |
| 361 | xi, err = ixvw.Table.ColumnIndexTry(pl.Options.XAxis) |
| 362 | if err != nil { |
| 363 | // log.Println("plot.PlotXAxis: " + err.Error()) |
| 364 | return |
| 365 | } |
| 366 | xview = ixvw |
| 367 | xc := ixvw.Table.Columns[xi] |
| 368 | xp := pl.Columns[xi] |
| 369 | sz := 1 |
| 370 | if xp.Range.FixMin { |
| 371 | plt.X.Min = math32.Min(plt.X.Min, float32(xp.Range.Min)) |
| 372 | } |
| 373 | if xp.Range.FixMax { |
| 374 | plt.X.Max = math32.Max(plt.X.Max, float32(xp.Range.Max)) |
| 375 | } |
| 376 | if xc.NumDims() > 1 { |
| 377 | sz = xc.Len() / xc.DimSize(0) |
| 378 | if xp.TensorIndex > sz || xp.TensorIndex < 0 { |
| 379 | slog.Error("plotcore.PlotEditor.plotXAxis: TensorIndex invalid -- reset to 0") |
| 380 | xp.TensorIndex = 0 |
| 381 | } |
| 382 | } |
| 383 | return |
| 384 | } |
| 385 | |
| 386 | const plotColumnsHeaderN = 2 |
| 387 |