[vtkusers] Problem with vtkChartXY::SetTitle and vtkAxis::SetTitle
Marcus D. Hanwell
marcus.hanwell at kitware.com
Tue Nov 15 10:55:14 EST 2011
On Tue, Nov 15, 2011 at 10:26 AM, Marcus D. Hanwell
<marcus.hanwell at kitware.com> wrote:
> On Tue, Nov 15, 2011 at 10:08 AM, Marcus D. Hanwell
> <marcus.hanwell at kitware.com> wrote:
>> On Thu, Nov 3, 2011 at 2:51 PM, Joseph Melnyk <JMelnyk at pile.com> wrote:
>>> I actually have a similar, but different problem. I just upgraded to 5.8.0, after using 5.7 for months. I'm not having any issues with setting the title of a vtkAxis but I'm having trouble setting the font size for it. My existing code has no effect:
>>>
>>> int fontSize = 15;
>>> for(int i=0; i < chart->GetNumberOfAxes() ;i++)
>>> {
>>> chart->GetAxis(i)->GetTitleProperties()->SetFontSize(fontSize);
>>> chart->GetAxis(i)->Update();
>>> }
>>>
>>> If I check the font size of each axis before/after setting it, it's correct (12 before, 15 after); but there's certainly no visual difference. Similarly, using SetBold() or SetColor() has no effect. But note that before initialization of my associated vtkContextView, SetColor(), SetBold() and SetFontSize() all work just fine. The above code needs to run after initialization. And again, it worked with no issues before.
>>
>> I will see about getting an additional regression test in to verify
>> that this works. Looking at the code, it should work (and without
>> calling Update() on the axis). We use this in ParaView through the GUI
>> for example.
>
> I was just looking at this in ParaView, and it looks like a regression
> has crept in. It may be the new label caching code not invalidating in
> places where it should - leave it with me.
>
Looking at vtkFreeTypeTools::MapIdToTextProperty, and the way it is
used in the string caching in vtkOpenGLContextDevice2D, it fails to
account for things like font size and color. This means that the old
image gets used (with the smaller font) as it compares the same as the
new. I verified this by changing the text and hitting apply.
This is a little harder to test for too, as we must set up the charts,
render (to cache the strings) and then modify the font size/color and
render again. I can get an additional test into VTK and work on a fix
for this. Julien, do you have any thoughts on the best way to work
around this for now?
Thanks,
Marcus
More information about the vtkusers
mailing list