I have an issue with my graph, when I plot my data, the Range Origin Label is not showing. That is, the first label on the Y-axis is not displayed. I have set my Range step to be:
plotView.setRangeStep(XYStepMode.SUBDIVIDE, 10);
However, it only shows 9 labels.
How do I make sure that the range origin label is set?
I have already tried the following:
widget.getRangeLabelPaint().setColor(Color.BLACK);
widget.getRangeOriginLinePaint().setColor(Color.BLACK);
Any help is greatly appreciated.
You have to use
plotView.getGraphWidget().getRangeOriginLabelPaint().setColor(Color.BLACK);
.
plotView.getGraphWidget().getRangeOriginLinePaint().setColor(Color.BLUE);
and
plotView.getGraphWidget().getRangeLabelPaint().setColor(Color.RED);
are doing this:
Notice the red range labels and the blue origin line.
As for plotView.setRangeStep(XYStepMode.SUBDIVIDE, 10);
, it's dividing your plotview in 10 parts, including the origin.
I'm using plotView.setRangeStepValue(10);
. Does the same thing, but with simpler syntax.
To add a label under the origin labels you have to add first a border style (SQUARE or ROUND):
plotView.setBorderStyle(Plot.BorderStyle.SQUARE, null, null);
Then:
plotView.setDomainLabel("Samples");
plotView.getDomainLabelWidget().pack();
plotView.position(
plotView.getDomainLabelWidget(),
0,
XLayoutStyle.RELATIVE_TO_CENTER,
0,
YLayoutStyle.ABSOLUTE_FROM_BOTTOM,
AnchorPosition.BOTTOM_MIDDLE);