Commit 5640829a authored by Julien Finet's avatar Julien Finet Committed by Marcus D. Hanwell
Browse files

ENH: Factorize the code to set a plot to a corner.

vtkChartXY::AddPlot now calls vtkChartXY::SetPlotCorner
parent a3de986c
......@@ -593,10 +593,7 @@ void vtkChartXY::SetPlotCorner(vtkPlot *plot, int corner)
<< corner);
return;
}
if (!this->RemovePlotFromCorners(plot))
{
vtkWarningMacro("Error removing plot from corners.");
}
this->RemovePlotFromCorners(plot);
// Grow the plot corners if necessary
if (int(this->ChartPrivate->PlotCorners.size()) <= corner)
{
......@@ -831,12 +828,9 @@ vtkIdType vtkChartXY::AddPlot(vtkPlot * plot)
return -1;
}
plot->Register(this);
// Add the plot to the default corner
plot->SetXAxis(this->ChartPrivate->axes[vtkAxis::BOTTOM]);
plot->SetYAxis(this->ChartPrivate->axes[vtkAxis::LEFT]);
this->ChartPrivate->plots.push_back(plot);
vtkIdType plotIndex = this->ChartPrivate->plots.size() - 1;
this->ChartPrivate->PlotCorners[0]->AddItem(plot);
this->SetPlotCorner(plot, 0);
// Ensure that the bounds are recalculated
this->PlotTransformValid = false;
// Mark the scene as dirty
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment