MantisBT - VTK
View Issue Details
0013865VTK(No Category)public2013-02-07 17:312013-12-16 15:39
Bastian Angermann 
Dave DeMarle 
normalminorhave not tried
closedfixed 
5.10.1 
6.0.0 
TBD
incorrect functionality
0013865: Legend in vtkPlotStracked shows the same color for all entries
I am drawing a vtkPlotStracked where the colors are set using a vtkColorSeries.
All colors displayed in the legend are the same. The color that is displayed matches the color I would expect for the last entry (see the attached screenshot).

The code for the PaintLegend method reads
bool vtkPlotStacked::PaintLegend(vtkContext2D *painter, const vtkRectf& rect, int)
{
   painter->ApplyPen(this->Pen);
   painter->ApplyBrush(this->Brush);
   painter->DrawRect(rect[0], rect[1], rect[2], rect[3]);
   return true;
}

shouldn't this be

bool vtkPlotStacked::PaintLegend(vtkContext2D *painter, const vtkRectf& rect, int legendIndex)
{
  if (this->ColorSeries)
  {
    this->Brush->SetColor(
          this->ColorSeries->GetColorRepeating(legendIndex).GetData());
  }
  painter->ApplyPen(this->Pen);
  painter->ApplyBrush(this->Brush);
  painter->DrawRect(rect[0], rect[1], rect[2], rect[3]);
  return true;
}
No tags attached.
png vtkPlotStacked.png (21,270) 2013-02-07 17:31
https://www.vtk.org/Bug/file/9394/vtkPlotStacked.png
png
Issue History
2013-02-07 17:31Bastian AngermannNew Issue
2013-02-07 17:31Bastian AngermannFile Added: vtkPlotStacked.png
2013-06-25 12:45Dave DeMarleNote Added: 0031052
2013-07-03 13:35Bastian AngermannNote Added: 0031118
2013-12-16 15:37Dave DeMarleNote Added: 0031953
2013-12-16 15:37Dave DeMarleStatusbacklog => closed
2013-12-16 15:37Dave DeMarleAssigned To => Dave DeMarle
2013-12-16 15:37Dave DeMarleResolutionopen => fixed
2013-12-16 15:39Dave DeMarleFixed in Version => 6.0.0

Notes
(0031052)
Dave DeMarle   
2013-06-25 12:45   
Can you submit that patch in the form of a gerrit patch for automated testing and review?
For details on how to do so see http://www.vtk.org/Wiki/VTK/Git/Develop [^]
thanks
(0031118)
Bastian Angermann   
2013-07-03 13:35   
This issue has been fixed in the following commit
https://github.com/Kitware/VTK/commit/ffd2444c2abe3814c16b78043e14382c25fe82bc [^]

The fix is an improvement over the suggestion in the bug description in that this->Brush is not changed, a temporary brush is created instead. Do you want me to create a patch nevertheless e.g. for back-porting the fix into the 5.10 line?
(0031953)
Dave DeMarle   
2013-12-16 15:37   
Thank you Bastian.

I can't guarantee that a patch will go into the release-5.10 branch because right now we are only merging in critical fixes. But you are more than welcome to backport the fix and submit it though gerrit. Once there it has the best chance of getting in.