Problem with Line chart !

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
warxsg
Posts: 2
Joined: Tue Jul 11, 2006 2:07 pm

Problem with Line chart !

Post by warxsg » Tue Jul 11, 2006 2:13 pm

Hi there,

i am pretty new about using JFreeChart.
I created a line chart using an example but now i need to customize this example.
My graph is a simple line chart with only one LINE
So i need the following :

1) How can i change the foreground color of the line ?
For default the line is red, i'd like to have it BLUE...for instance.

2) I'd like to scale the PLOT, i have the following values on X axis

0,550,560,570,580

How can i make appear the values :

0,555,560,565.... ???

3) My Line chart seems just a bit obfuscate so is there a way to display it
more clearly...probably it is not set a streching ?

Cheers.

Stefano

[/img]

develop
Posts: 296
Joined: Wed Mar 23, 2005 10:01 pm

Post by develop » Tue Jul 11, 2006 10:03 pm

to change the color, you have to use following...

renderer = plot.getRenderer();
renderer.setSeriesPaint(0,Color.blue) //since you only have one series.

2. domainaxis.setNumberFormatOverride(...) in this metod you can pass proper format (java format) and chart will display that.

3. you can add the chartPanel to JScrollPane and set the layout properly

hope this helps.

asawari
Posts: 4
Joined: Wed Sep 13, 2006 1:34 pm

Post by asawari » Thu Sep 14, 2006 6:19 am

the solution does not seem to work?? Even I am trying to do the same. The first series gets represented by red blocks an the second and so on by other colors. But I want the first series itself to be represented by a solod line. A code example would be helpful.

develop
Posts: 296
Joined: Wed Mar 23, 2005 10:01 pm

Post by develop » Thu Sep 14, 2006 2:08 pm

can you post your code, so that i can look into details, whatever solution i gave you works perfect for me..

Thanks

Locked