Commit e3025f5a authored by Bill Lorensen's avatar Bill Lorensen

BUG: ChartPie tooltip is wrong

ChartPie's tooltip is formatted in
vtkChartPie::LocatePointInPlot. This method relies on
PlotPie:::GetNearestPoint, but the plotpos vector was not being
computed by GetNearestPoint. Consequently, the tooltip always reported
a 0 value for the dependent variable.

In this patch, PlotPie:::GetNearestPoint computes the dependent
variable and return it in plotpos[1]. In addition, plotpos returns the
independent vaiable in plotpos[0]. ChartPie now uses plotPos.GetY() to
obtain the dependent variable. This seems consistent with other

To reproduce the problem (before the patch) and verify (after the
patch) run:

vtkChartsCoreCxxTests "TestPieChart" -I
and move the mouse of each pie chart segment.

Change-Id: I5c3d56a79c3ceca6616bae2b0a7a85f9c15f2293
parent 820ceb80
......@@ -269,7 +269,7 @@ bool vtkChartPie::LocatePointInPlots(const vtkContextMouseEvent &mouse)
const char *label = this->Private->Plot->GetLabel(labelIndex);
vtksys_ios::ostringstream ostr;
ostr << label << ": " << plotPos.GetX();
ostr << label << ": " << plotPos.GetY();
this->Tooltip->SetPosition(mouse.GetScreenPos()[0] + 2,
mouse.GetScreenPos()[1] + 2);
......@@ -202,7 +202,7 @@ vtkColorSeries *vtkPlotPie::GetColorSeries()
vtkIdType vtkPlotPie::GetNearestPoint(const vtkVector2f& point,
const vtkVector2f&,
vtkVector2f* value)
float x = point.GetX() - this->Private->CenterX;
float y = point.GetY() - this->Private->CenterY;
......@@ -222,6 +222,11 @@ vtkIdType vtkPlotPie::GetNearestPoint(const vtkVector2f& point,
int ret = lbound - angles;
// There are two of each angle in the array (start,end for each point)
ret = ret / 2;
vtkTable *table = this->Data->GetInput();
vtkDataArray* data = this->Data->GetInputArrayToProcess(0, table);
return ret;
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