Displaying a subset of domain's labels and grid lines.

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
dewnil
Posts: 2
Joined: Tue Apr 15, 2014 10:36 am
antibot: No, of course not.

Displaying a subset of domain's labels and grid lines.

Post by dewnil » Tue Apr 15, 2014 11:13 am

I am developing a Java applet to display some statistic data, and I use JFreeChart for visual presentations.
One of the statistics requires displaying up to 150 values in sequence.
I've tried using a regular line chart (ChartFactory.createLineChart), like for my other charts, but the result was unwatchable - labels are ovelapping labels and grid lines are way too close.
I've searched this forum, but all similar questions used dates in the domain axis, and thus could be resolved using Time Series. In my case, the domain axis contain strings. These strings are also a form of time, but think more like game turns and rounds than any standard date format.
I would like to display only a selected subset of the domain axis labels and grid lines - is there a way to do it?

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

Re: Displaying a subset of domain's labels and grid lines.

Post by david.gilbert » Wed Apr 16, 2014 8:32 am

I would probably represent the data on the x-axis using integers (turn 1, turn 2, ...) so that the data could be plotted on an XYPlot. Then I would subclass NumberAxis and override the refreshTicks() method to customise the tick labels that will appear on the x-axis.
David Gilbert
JFreeChart Project Leader

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

dewnil
Posts: 2
Joined: Tue Apr 15, 2014 10:36 am
antibot: No, of course not.

Re: Displaying a subset of domain's labels and grid lines.

Post by dewnil » Fri Apr 18, 2014 5:14 pm

Thanks, it worked. I lost some label formatting, when compared to CategoryPlot, but I guess this can be fixed after some tampering.

Locked