MCPcopy Create free account
hub / github.com/Kitware/VTK / SetActivePlot

Method SetActivePlot

Charts/Core/vtkScatterPlotMatrix.cxx:437–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435}
436
437bool vtkScatterPlotMatrix::SetActivePlot(const vtkVector2i& pos)
438{
439 if (pos.GetX() + pos.GetY() + 1 < this->Size.GetX() && pos.GetX() < this->Size.GetX() &&
440 pos.GetY() < this->Size.GetY())
441 {
442 // The supplied index is valid (in the lower quadrant).
443 this->ActivePlot = pos;
444 this->ActivePlotValid = true;
445
446 // Invoke an interaction event, to let observers know something changed.
447 this->InvokeEvent(vtkCommand::AnnotationChangedEvent);
448
449 // set background colors for plots
450 if (this->GetChart(this->ActivePlot)->GetPlot(0))
451 {
452 int plotCount = this->GetSize().GetX();
453 for (int i = 0; i < plotCount; ++i)
454 {
455 for (int j = 0; j < plotCount; ++j)
456 {
457 if (this->GetPlotType(i, j) == SCATTERPLOT)
458 {
459 vtkChartXY* chart = vtkChartXY::SafeDownCast(this->GetChart(vtkVector2i(i, j)));
460
461 if (pos[0] == i && pos[1] == j)
462 {
463 // set the new active chart background color to light green
464 chart->SetBackgroundBrush(this->Private->SelectedChartBGBrush);
465 }
466 else if (pos[0] == i || pos[1] == j)
467 {
468 // set background color for all other charts in the selected
469 // chart's row and column to light red
470 chart->SetBackgroundBrush(this->Private->SelectedRowColumnBGBrush);
471 }
472 else
473 {
474 // set all else to white
475 chart->SetBackgroundBrush(this->Private->ChartSettings[SCATTERPLOT]->BackgroundBrush);
476 }
477 }
478 }
479 }
480 }
481 if (this->Private->BigChart)
482 {
483 vtkPlot* plot = this->Private->BigChart->GetPlot(0);
484 std::string column = this->GetColumnName(pos.GetX());
485 std::string row = this->GetRowName(pos.GetY());
486 if (!plot)
487 {
488 plot = this->Private->BigChart->AddPlot(vtkChart::POINTS);
489 vtkChart* active = this->GetChart(this->ActivePlot);
490 vtkChartXY* xy = vtkChartXY::SafeDownCast(this->Private->BigChart);
491 if (xy)
492 {
493 // Set plot corner, and axis visibility
494 xy->SetPlotCorner(plot, 2);

Callers 3

AdvanceAnimationMethod · 0.95
UpdateLayoutMethod · 0.95

Calls 15

GetPlotTypeMethod · 0.95
GetColumnNameMethod · 0.95
GetRowNameMethod · 0.95
ApplyAxisSettingMethod · 0.95
InvokeEventMethod · 0.80
SetBackgroundBrushMethod · 0.80
SetPlotCornerMethod · 0.80
SetTooltipLabelFormatMethod · 0.80
SetUnscaledRangeMethod · 0.80
AddSupplementaryPlotMethod · 0.80
vtkVector2iClass · 0.50
GetXMethod · 0.45

Tested by

no test coverage detected