How to set Date labels for StackedXYAreaChart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
guiding5
Posts: 8
Joined: Mon Mar 06, 2006 5:24 pm

How to set Date labels for StackedXYAreaChart

Post by guiding5 » Tue Apr 25, 2006 5:56 pm

I want to set Date labels for StackedXYAreaChart, to X axis, only for marks added into DataSet.

Please see example here:
http://www.imagedump.com/index.cgi?pick=get&tp=406451

Date label places was marked with green circles.

guiding5
Posts: 8
Joined: Mon Mar 06, 2006 5:24 pm

Post by guiding5 » Sun Apr 30, 2006 11:44 am

Anybody ? :)

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 May 02, 2006 9:45 am

You need to do two things:

(1) Alter the dataset so that the x-values are milliseconds since 1-Jan-1970 (as in java.util.Date);

(2) Change the x-axis from a NumberAxis to a DateAxis:

Code: Select all

XYPlot plot = (XYPlot) chart.getPlot();
plot.setDomainAxis(new DateAxis("Date"));
David Gilbert
JFreeChart Project Leader

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

guiding5
Posts: 8
Joined: Mon Mar 06, 2006 5:24 pm

Post by guiding5 » Thu May 04, 2006 1:26 pm

Works perfectly, thanks alot ! :)

Locked