VTKFIG  0.20.20181114
Easy VTK based in situ visualization
void vtkfig::XYPlot::AddPlot ( )
private

Internal addplot after plot data have been filled.

Definition at line 434 of file vtkfigXYPlot.cxx.

435  {
436 
437 
438 
439  while (num_plots>=AllPlotData.size())
440  {
441  AllPlotData.emplace_back(XYPlotActor,num_curves);
442  }
443 
444  auto plot=AllPlotData[num_plots];
446  plot.FixSize();
447 
448 
449  XYPlotActor->SetPlotColor(plot.GetDataSetNumber(), NextPlotInfo.line_rgb[0], NextPlotInfo.line_rgb[1], NextPlotInfo.line_rgb[2]);
450 
451  int plot_lines = -1;
452  std::string line_type(NextPlotInfo.line_type);
453  if (
454  line_type == ""
455  || line_type == "none"
456  || line_type == "off"
457  )
458  plot_lines = 0;
459  else if (
460  line_type == "-"
461  || line_type == "on"
462  )
463  plot_lines = 1;
464 
465  if (plot_lines==-1)
466  throw std::runtime_error("Unknown line type: "+line_type);
467  XYPlotActor->SetPlotLines(plot.GetDataSetNumber(), plot_lines);
468 
469  int plot_points = -1;
470  std::string marker_type(NextPlotInfo.marker_type);
471  if (
472  marker_type == ""
473  || marker_type == "none"
474  || marker_type == "off"
475  )
476  {
477  plot_points = 0;
478  XYPlotActor->SetPlotGlyphType(plot.GetDataSetNumber(), 1);
479  };
480 
481  if (marker_types.find(marker_type)!=marker_types.end())
482  {
483  plot_points = 1;
484  XYPlotActor->SetPlotGlyphType(plot.GetDataSetNumber(), marker_types[marker_type]);
485  }
486  if (plot_points==-1)
487  throw std::runtime_error("Unknown marker type: "+marker_type);
488 
489  XYPlotActor->SetPlotPoints(plot.GetDataSetNumber(), plot_points);
490 
491 
492 
493 
494  XYPlotActor->SetPlotLabel(plot.GetDataSetNumber(), NextPlotInfo.legend);
495 
496 
497  if (PlotState.fixXMin>PlotState.fixXMax)
498  XYPlotActor->SetXRange(PlotState.dynXMin,PlotState.dynXMax);
499  else
500  XYPlotActor->SetXRange(PlotState.fixXMin,PlotState.fixXMax);
501 
502  if (PlotState.fixYMin>PlotState.fixYMax)
503  XYPlotActor->SetYRange(PlotState.dynYMin,PlotState.dynYMax);
504  else
505  XYPlotActor->SetYRange(PlotState.fixYMin,PlotState.fixYMax);
506 
507  XYPlotActor->SetLegendPosition2(0.15,0.05*(num_plots+1));
508 
509 
510 
511  num_plots++;
512 
513  XYPlotActor->Modified();
514  }
std::vector< PlotInfo > AllPlotInfo
Vector holding all plot info.
Definition: vtkfigXYPlot.h:274
static std::map< std::string, int > marker_types
Possible types of plot markers.
Definition: vtkfigXYPlot.h:163
struct vtkfig::XYPlot::@4 PlotState
General state of the XYPlot.
vtkSmartPointer< vtkXYPlotActor > XYPlotActor
The main graphics actor.
Definition: vtkfigXYPlot.h:175
char marker_type[desclen]
Definition: vtkfigXYPlot.h:266
PlotInfo NextPlotInfo
"finite state machine" struture accumulating repective info for next plot
Definition: vtkfigXYPlot.h:278
int num_curves
Number of all curves including grid lines.
Definition: vtkfigXYPlot.h:172
size_t num_plots
Number of "real" plots.
Definition: vtkfigXYPlot.h:166
std::vector< PlotData > AllPlotData
vector holding data of all plots
Definition: vtkfigXYPlot.h:227