borders of multiple charts not lined up

Discussion about JFreeChart related to stockmarket charts.
Locked
uls
Posts: 25
Joined: Fri Oct 17, 2003 10:46 am

borders of multiple charts not lined up

Post by uls » Tue Nov 11, 2003 10:54 am

how can i line up the borders of various charts? the charts are different objects in one jpanel, right now the RSI panel is in BorderLayout.SOUTH.
i'd like to change the fontsize of all numbers, texts, too.
Image


tia,
ulrich

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Nov 11, 2003 1:28 pm

This is, unfortunately, a limitation of the layout procedure used by JFreeChart. It's great for ensuring that charts look reasonable at many different sizes, but terrible for making sure two or more charts are "aligned".

In the combined charts, a workaround had to be applied where the code calculates the dimensions of the axes for all the subplots BEFORE the plots are drawn, then the maximum size is applied to all axes using the setFixedDimension(...) method (in the Axis class). You might be able to do something similar, but it would be messy.

Regarding the font sizes, there are methods in various places for controlling those. But from the image you posted, it looks like one problem you have is that the lower chart has a height that is less than the default minimum drawing height (set in the ChartPanel class). When that happens, the chart is drawn at a larger size, then scaled down to fit the available space. You could experiment with a lower default value to see if it improves the appearance of the fonts.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

uls
Posts: 25
Joined: Fri Oct 17, 2003 10:46 am

Post by uls » Tue Nov 11, 2003 6:49 pm

hi david,
thanks for reply.



setDrawMinimumHeight worked great (i only changed the size of macd):
Image
Regarding the font sizes, there are methods in various places for controlling those
now i have to change the title font size and if possible alignment, can you tell me where? i tried chartpanel.setFont() already .... i am sorry, it's an open source project and we can't pay for commercial support ...
thanks for this very good lib,
ulrich

uls
Posts: 25
Joined: Fri Oct 17, 2003 10:46 am

Post by uls » Tue Nov 11, 2003 7:13 pm

chart title font can be set in
chart.getTitle().setFont(Font f);

found it ...

Locked