Addon: JFreeChartWrapper - size issue

Hi,

there is something I can’t figure out. I have a two column layout (split 70% and 30% widths) using HorizontalLayout. In one column I add a JFreeChartWrapper component with width 100% to fill the whole column and it has a fixed height of 200px. Unfortunately, the chart font and line widths (I have a line chart) are rendered very small as if it is constructed for a greater width. The problem does not arise if I specify a fixed width of the wrapper (e.g. 300px) although the actual width in the client browser is the same. Any idea how to use the relative width correctly or is it not possible to do what I am intending?

Thanks for any help,
Steffen Harbich

Hi,

Real size of the component is not known by the server side when relative sizes are used. That is why the add-on needs to render the component to some “target size” and then scale it on the client side. There is some logic to determine a proper size for the “canvas”, but it won’t work very well in all cases. You could probably customize the size with setGraphHeight/Width methods. Good guess with pixel values there should give you rather good results.

If that isn’t enough there would have to be a some sort of canvas size change listener that would be called from the client when the real size is known. JFreeChart could then re-render the chart for the correctly sized slot.

cheers,
matti