Line Chart-x&y axis doesn't seems to be starting at 0,0

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
TestUser

Line Chart-x&y axis doesn't seems to be starting at 0,0

Post by TestUser » Fri Sep 09, 2005 5:43 pm

I am trying to plot a line chart with following values {(0,1), (16,1)}.When the chart is rendered I see two points with zero value on the x-axis. I mean the x and y axis doesn't seems to be starting at a common point i.e (0,0) becuase of this there is an offset in plotting the first value[0,1]. The same chart renders fine for {(1,1), (16,1)} value.

Can anyone help me out?

Thanks
TestUser[/img]

christopher.loerken
Posts: 16
Joined: Wed Aug 31, 2005 4:25 pm

Post by christopher.loerken » Mon Sep 12, 2005 10:55 am

Hi,
do you simply mean, that the y-axis starts at a point below 0.0 ?

If you meant that, that is probably due to the autorange behaviour of the chart.
You can set the axis lower bound value manually by typing:

Code: Select all

axis.setLowerBound(0.0);
I hope it helps,
regards,
christopher

Guest

Post by Guest » Mon Sep 12, 2005 1:40 pm

You can also remove the margin:

Code: Select all

axis.setLowerMargin(0d);
Erik.

TestUser

Post by TestUser » Mon Sep 12, 2005 2:20 pm

Thanks Christoper & Erik.

My problem is not with Y-Axis. To explain it further,
My chart is getting rendered as follows:-

|
|
|
|
|
|
0-----0--------16------------------------------

|<-->|

If you notice, my plot has an aditional zero value on x-axis while trying to plot (0,1) value. Becuase of this there is an offset in the plot.

Thanks
TestUser

Locked