I have two questions about this awesome Android chart library:
1) I cannot find a way to put the x-axis at the bottom of the chart: is it possible?
2) is it possible to plot data against two (or more) y-axes on the same chart?
Thank you in advance
Create a tiled chart layout containing two tiles, and place an axes object across both tiles. In the final presentation, this axes object will appear in the background, behind two other axes objects. A section of its x -axis will be visible to give the appearance of one long x -axis.
Within one of the axes objects, move the x -axis to the top of the plot box, and move the y -axis to the right side of the plot box. For example, you can create two plots that have different x - and y -axis limits. First, create two sets of x - and y -coordinates. Create a tiled chart layout and an axes object. Then plot into the axes:
Create a second axes object and plot the second set of data in black rather than red. Then, set properties on the second axes object to move the x -axis and y -axis, and to ensure that neither plot obscures the other. Create an axes object ax2 by calling the axes function and specifying t as the parent object.
To plot two sets of data with separate x - and y -axes, create two separate axes objects in a tiled chart layout. Within one of the axes objects, move the x -axis to the top of the plot box, and move the y -axis to the right side of the plot box.
A bit has changed in the library. Now you will need to do as follows:
XAxis xAxis = chart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
This will set the x-axis label at the bottom
It is possible to put the XLabels
to the bottom.
Call:
XLabels xl = chart.getXLabels();
xl.setPosition(XLabelPosition.BOTTOM);
Different y-axes descriptions (YLabels
, with different data) are currently not supported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With