-
Notifications
You must be signed in to change notification settings - Fork 33
howto secondary axis
Erich Seifert edited this page Mar 14, 2016
·
1 revision
Some plot types support multiple axes. For example, XYPlot supports two x- and two y-axes.
To add secondary axes to a XYPlot, you first have create an Axis object and a corresponding renderer object:
Axis y2 = new Axis(-10, 10);
plot.setAxis(XYPlot.AXIS_Y2, y2);
LinearRenderer2D rendererY2 = new LinearRenderer2D();
plot.setAxisRenderer(XYPlot.AXIS_Y2, rendererY2);To assign certain data sources to this axis use the setMapping method:
plot.setMapping(series2, XYPlot.AXIS_X, XYPlot.AXIS_Y2);This example will assign the first column (column 0) of series2 to the regular x-axis and the second column (column 1) of series2 to the secondary y-axis we created before.