[vtkusers] Problem rendering vtkChartXY

Riku subs at collab.se
Wed Mar 16 06:07:26 EDT 2011


Hi again,

I've some additional information from my tests that may be
interesting. By chance I stumbled upon the SetScaleTiles() function of
vtkContextScene. The documentation suggests it is involved in the
scaling, so I went ahead to test it. Indeed, turning tile scaling off
(ScaleTilesOf()) enables the functionality that I was looking for, at
least for my test cases (on Windows).

Now, instead, I run into another problem when enlarging the fonts: for
sizes larger than or equal to 20 the rendered numbers have unwanted
artefacts. It looks like some graphics problem. The problem exists
even without the tile scaling and magnification trick, so it seems it
is a problem of its own.

Further, to follow up on Marcus' comment before, it would indeed be a
nice feature to optionally be able to scale all the plot elements (not
only the font maybe) with the window resize.

Hoping for some suggestions!

Thanks.

Riku

On 9 March 2011 17:21, Marcus D. Hanwell <marcus.hanwell at kitware.com> wrote:
> On Mon, Mar 7, 2011 at 9:59 AM, Riku <subs at collab.se> wrote:
>> Hello,
>>
>> I am presently using the vtkChartXY class (and related) to plot simple
>> X/Y plots. As I want to hardcopy them, I use the commonly described
>> method and pass the render window to a window to image filter, and
>> then on to a PNG writer. This works great for (more complicated)
>> visualizations I do, but vtkChartXY gives me problems.
>>
>> At a resolution (i.e. render window size) of 600x600, for example, the
>> resulting image is grainy and generally unsuitable for printing. The
>> solution I've used is to set the render window size to something like
>> 2000x2000 instead.
>>
>> The problem: On Windows, I have to use the SetMagnification() trick to
>> get the image size right (as my screen size is smaller than
>> 2000x2000), but for some reason I cannot get it to work for the
>> rendered vtkChartXY plots. The resulting images are broken up, mixed,
>> skewed and generally weird. What can I do about this?
>>
>> Moreover, If I set the render window size close to my screen's maximum
>> size, all text scales with the plot and thus becomes too small for the
>> plot. I cannot find any way to change this behaviour. Is there any
>> way? For other rendering situations I have not had this issue.
>>
>> The problem can be recreated with the example here:
>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Plotting/LinePlot
>> (Add render window --> window to image filter --> png writer, and set
>> render window size to something large.)
>>
> I will try to take a look at this, and add a test to the charts. I
> thought that this would work due to the code in ParaView accomplishing
> this. The font scaling is something we discussed, but hadn't gotten
> too. We need a way to determine what is a window resize (font size
> stays constant), and a magnification where we could just scale the
> font sizes by the specified amount in the vtkContext2D perhaps.
>
> Marcus
>



More information about the vtkusers mailing list