Spacing issues on SymbolAxis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
TheFatebacked
Posts: 1
Joined: Mon Jun 18, 2007 3:22 pm

Spacing issues on SymbolAxis

Post by TheFatebacked » Mon Jun 18, 2007 3:29 pm

When I attempt to create a symbol axis, it places labels every two ticks or so (which means they don't line up where they're needed). I experienced the same issue w/ NumberAxis but was able to make them line up by using setTickUnit() and setting tick to 1.

SymbolAxis inherits setTickUnit() from NumberAxis, but it doesn't actually do anything in SymbolAxis. Is there an alternative method I can use to make the SymbolAxis entries line up, one per data item (41 xy coordinates and 41 symbols)?

kasineedis
Posts: 7
Joined: Tue Mar 10, 2009 8:50 pm

Re: Spacing issues on SymbolAxis

Post by kasineedis » Tue May 05, 2009 8:11 pm

Please check the image that attached .I have Similer problem in SymbolAxis Spacing . The tick labels are not exactly positioned. I had Date axis as domain axis .and SymbolAxis as rangeAxis . In Image which is attached The Time Blocks that are correspond to S1Series are above the S1 grid line . and the Time blocks which are corresponds to S2 Series are below S2 grid line .I need the time blocks need to match the position of S1,S2,S3 respectivly .Please Help me out .
NOTE:If image is not loaded ,Please refresh the page then image get loaded
Image

willkoky
Posts: 5
Joined: Tue Feb 28, 2012 9:46 pm
antibot: No, of course not.

Re: Spacing issues on SymbolAxis

Post by willkoky » Tue May 29, 2012 3:39 pm

Has anyone found a solution to this issue? I have the same problem on my SymbolAxis. After I get to a certain amount of labels the axis begins not labeling every tick mark. I would like it to label each one as I am using it as a fake category label because I needed a more complex chart then a category chart could do. So as you can imagine the chart is not useful if any of the categories do not have a label next to their tick mark. Thank you for any help!

willkoky
Posts: 5
Joined: Tue Feb 28, 2012 9:46 pm
antibot: No, of course not.

Re: Spacing issues on SymbolAxis

Post by willkoky » Tue May 29, 2012 8:36 pm

I was able to solve this issue by figuring out a minimum size for the labels of the chart and then adding to the height of the chart a set number of pixels per category I was to display. The important part however is that you need to set both the size of the ChartPanel and the maximumDrawHeight of the panel. You would need to set the max width too if your chart needed more width as the data grew. Mine does not. If you do not set the Max draw size it will use the default of 780x1024. That is why when I got a certain number of categories in my chart, what seemed to be an arbitrary number (54) was really just the tipping point at which you could no longer fit all the labels within the 780 height default.
chartPanel.setMaximumDrawHeight((int)chartSize.getHeight());
chartPanel.setPreferredSize(chartSize);

Locked