[vtkusers] Problem rendering vtkChartXY

Eric E. Monson emonson at cs.duke.edu
Mon Mar 7 11:25:00 EST 2011


Hey Riku,

I had never tried this before, but I see the same behavior. It is strange because as far as I can see, ParaView also uses vtkWindowToImageFilter to create a screen shot of the chart views, but it works there... 

Regarding the font size and tick spacing, you can get around this problem in a manual way by specifying the tick positions and labels and their font sizes. vtkAxis has SetTickPositions() and SetTickLabels(), both of which internally set Behavior = 2 (CUSTOM), which turns off automatic tick spacing calculations. Then you can use GetLabelProperties() to set the font size to a reasonable one for the image size you want. It's not a very automatic solution, but it gets around the problem.

Maybe the main Charts developer, Marcus, will have a chance to chime in on why the image tiling for vtkWindowToImageFilter works for the Charts in ParaView but not in straight VTK.

-Eric

· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
Eric E Monson
Duke Visualization Technology Group


On Mar 7, 2011, at 9:59 AM, Riku 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.)
> 
> Thanks for any help or suggestions,
> 
> Riku
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list