Setting the X-Axis and Y-axis Line

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
avirutha
Posts: 8
Joined: Mon Sep 24, 2007 7:19 am

Setting the X-Axis and Y-axis Line

Post by avirutha » Mon Sep 24, 2007 7:26 am

I want to place the x-axis line and y-axis line in the middle of the plot not in the extreme corners .Is there any way do that and please tell how to do that.
To be more precise i need to move the x-axis and y-axis line in the XYchart.

tomkieffer
Posts: 24
Joined: Wed May 16, 2007 8:20 am

Post by tomkieffer » Mon Oct 01, 2007 10:45 am

use the upper an lower bounds of the axis to x and -x. 0 will be in the middle.

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 » Mon Oct 01, 2007 5:13 pm

The axis labels are always drawn at the edges of the chart, but if you'd like to highlight the zero baselines in the plot, you can call XYPlot.setDomain/RangeZeroBaselineVisible(boolean)...plus related methods to control the paint and stroke.
David Gilbert
JFreeChart Project Leader

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

avirutha
Posts: 8
Joined: Mon Sep 24, 2007 7:19 am

Post by avirutha » Thu Oct 04, 2007 11:58 am

tomkieffer wrote:use the upper an lower bounds of the axis to x and -x. 0 will be in the middle.
Please say in detail

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 » Thu Oct 04, 2007 3:34 pm

I think tomkieffer means that if you do something like:

Code: Select all

yAxis.setRange(-5.0, 5.0)


then the y value of 0.0 will appear in the middle of the chart. Likewise for the x-axis. I don't know if that solves your problem or not.
David Gilbert
JFreeChart Project Leader

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

uroojk
Posts: 13
Joined: Thu Oct 25, 2007 10:48 pm

Post by uroojk » Tue Nov 13, 2007 9:12 pm

david.gilbert wrote:The axis labels are always drawn at the edges of the chart, but if you'd like to highlight the zero baselines in the plot, you can call XYPlot.setDomain/RangeZeroBaselineVisible(boolean)...plus related methods to control the paint and stroke.
what if you have a CategoryPlot...
the CategoryPlot class doesnt have setDomain/RangeZeroBaselineVisible(boolean)... methods...

is there a way to achieve the same thing if you have a categoryplot and bar chart?

Locked