1

I am using the AndroidPlot library and am trying to change the colour of the domain and range labels.

I set them like so:

//Setting the names of the axis
XYPlot.setRangeLabel("# of Alerts");
XYPlot.setDomainLabel("Day"); 

By default they are white but are barely visible against my cream background. Does anyone know how I can change these to black please?

Natalie Carr
  • 3,707
  • 3
  • 34
  • 68
  • The trick is to get hold of the Paint objects that are used and then set the colour there. I don't remember the exact calls but there is support for getting the various different pain objects. – Ifor Mar 19 '14 at 13:37
  • @Ifor Can u explain more please? not sure what you mean. Thank you – Natalie Carr Mar 19 '14 at 15:54

3 Answers3

7

For anyone using the newer version of AndroidPlot (1.0 and above) this is the new way to update the text colour of the range and domain labels:

plot.getGraph().getLineLabelStyle(XYGraphWidget.Edge.LEFT).getPaint().setColor(Color.RED);
plot.getGraph().getLineLabelStyle(XYGraphWidget.Edge.BOTTOM).getPaint().setColor(Color.RED);
teiiluj
  • 241
  • 3
  • 10
3

You want something like

    mTripPlot.getGraphWidget().getDomainLabelPaint().setColor(my_colour);

For the label it would be something like

    mTripPlot.getDomainLabelWidget().getLabelPaint().setColor(my_colour);
Ifor
  • 2,825
  • 1
  • 22
  • 25
0

Attempt the following:

plot.getGraphWidget().getDomainTickLabelPaint().setColor(Color.RED);
plot.getGraphWidget().getRangeTickLabelPaint().setColor(Color.RED);
plot.getGraphWidget().getRangeOriginTickLabelPaint().setColor(Color.RED);
plot.getGraphWidget().getDomainOriginTickLabelPaint().setColor(Color.RED);
roelofs
  • 2,132
  • 20
  • 25