LineChart with diferent labels for x-axis....

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
velazquezs
Posts: 8
Joined: Tue Apr 11, 2006 11:10 pm

LineChart with diferent labels for x-axis....

Post by velazquezs » Wed Apr 12, 2006 12:17 am

Hi, all

I have a graph

Code: Select all

DefaultCategoryDataset dataset = new DefaultCategoryDataset();

dataset.addValue(7.984032236740131, "X","01");
dataset.addValue(1.8335697637281712, "Y", "01");
dataset.addValue(79.87123090951631, "Z","01");
dataset.addValue(7.746030144754975, "X","02");
dataset.addValue(1.779434775747803, "Y","02");
.....
dataset.addValue(1.6782667883274336, "X","15");
dataset.addValue(1.2525249355169012, "Y","15");

JFreeChart chart = ChartFactory.createLineChart(
				null, // chart title
				null, // domain axis label				
		"Saturation %", // range axis label
				dataset, // data
				//PlotOrientation.VERTICAL, // orientation
				PlotOrientation.VERTICAL,
				true, // include legend
				true, // tooltips
				false // urls
				);
Right now is rendering the X axis as 01, 02, .... 15 that represent a range in days.... 15 days for this example

Can I show the x-axis labels like for example only 2 labels grouped by week? week 2, week 3 etc...

velazquezs
Posts: 8
Joined: Tue Apr 11, 2006 11:10 pm

Change to Time Series Chart

Post by velazquezs » Fri Apr 14, 2006 1:08 am

So, what I did was to change the chart to a Time Series Chart instead of a Line Chart

Locked