Commit a9abb469 authored by Zack Galbreath's avatar Zack Galbreath
Browse files

add row/column info to tooltip

The tooltip displayed while hovering over a heatmap cell now
includes the name of the row & column.  This makes it easier for
a user of this class to tell what data value they're looking at
when they are zoomed in on part of the item.

Change-Id: Idd3df2bcd98986d49ddaeee0f2b9353209c7f67f
parent c5f21d95
......@@ -1140,6 +1140,7 @@ bool vtkTreeHeatmapItem::MouseMoveEvent(const vtkContextMouseEvent &event)
//-----------------------------------------------------------------------------
std::string vtkTreeHeatmapItem::GetTooltipText(float x, float y)
{
vtkIdType column = floor((x - this->HeatmapMinX) / this->CellWidth);
int sceneRow = floor(y / this->CellHeight + 0.5);
......@@ -1148,7 +1149,20 @@ std::string vtkTreeHeatmapItem::GetTooltipText(float x, float y)
int dataRow = this->RowMap[sceneRow];
if (dataRow != -1)
{
return this->Table->GetValue(dataRow, column + 1).ToString();
vtkStringArray *rowNames = vtkStringArray::SafeDownCast(
this->Table->GetColumn(0));
std::string rowName = rowNames->GetValue(dataRow);
std::string columnName = this->Table->GetColumn(column + 1)->GetName();
std::string tooltipText = "(";
tooltipText += rowName;
tooltipText += ", ";
tooltipText += columnName;
tooltipText += ")\n";
tooltipText += this->Table->GetValue(dataRow, column + 1).ToString();
return tooltipText;
}
return "";
}
......
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