I've been using the jchart2D class by Achim Westerman for some time now and just happened upon an instance where I'm trying to make 3 Y-axes on the right hand side of my graph.
The code for making the 3 axes is as follows
//Create Y Axis 1
AAxis<IAxisScalePolicy> yAxisShaftSpeed =
new AxisLinear<IAxisScalePolicy>();
yAxisShaftSpeed.setAxisScalePolicy(new AxisScalePolicyManualTicks());
yAxisShaftSpeed.setMinorTickSpacing(10);
yAxisShaftSpeed.setStartMajorTick(true);
yAxisShaftSpeed.setPaintGrid(false);
yAxisShaftSpeed.setAxisTitle(new IAxis.AxisTitle("Shaft Speed (RPM)"));
IRangePolicy rangePolicyYShaftSpeed =
new RangePolicyFixedViewport(new Range(0,225));
//Create Y axis 2
AAxis<IAxisScalePolicy> yAxisWindSpeed =
new AxisLinear<IAxisScalePolicy>();
yAxisWindSpeed.setAxisScalePolicy(new AxisScalePolicyManualTicks());
yAxisWindSpeed.setMinorTickSpacing(10);
yAxisWindSpeed.setStartMajorTick(true);
yAxisWindSpeed.setPaintGrid(false);
yAxisWindSpeed.setAxisTitle(new IAxis.AxisTitle("Wind Speed (m/s))"));
IRangePolicy rangePolicyYWindSpeed =
new RangePolicyFixedViewport(new Range(0,25));
//Create Y axis 3
AAxis<IAxisScalePolicy> yAxisPressure =
new AxisLinear<IAxisScalePolicy>();
yAxisPressure.setAxisScalePolicy(new AxisScalePolicyManualTicks());
yAxisPressure.setMinorTickSpacing(10);
yAxisPressure.setStartMajorTick(true);
yAxisPressure.setPaintGrid(false);
yAxisPressure.setAxisTitle(new IAxis.AxisTitle("Pressure (hPa)"));
IRangePolicy rangePolicyYPressure =
new RangePolicyFixedViewport(new Range(700,1100));
I then go on to add and set the right hand Y axes as follows
timePlotZoomableChart.setAxisYRight(yAxisShaftSpeed,0);
timePlotZoomableChart.addAxisYRight(yAxisWindSpeed);
timePlotZoomableChart.addAxisYRight(yAxisPressure);
Unfortunately, when the graph comes up, the three Y axes are on the right as expected but all the titles are stacked up on each other under the first added right Y axis (yAxisShaftSpeed). Anyone have any thoughts?
Thanks in advance.