2

I have about 12 domain labels in single graph. They overlap one another. I am not able to change their orientation. Please suggest a solution which will work with Android v2.2 and beyond.

Niket Singh
  • 159
  • 12
  • Making the labels vertical will allow me to show all labels on x-axis without overlap. I want to ask if it is even possible with AndroidPlot or if there is any workaround. – Niket Singh Jan 08 '13 at 10:32
  • you can make the VerticalTextView like discussed in http://stackoverflow.com/questions/8604932/android-text-view-text-in-vertical-direction – QAMAR Jan 08 '13 at 10:37
  • Nope. These domain values are not present in XML, so no view is associated with it. These labels are displayed according to AndroidPlot library. There has to be some other solution for this. – Niket Singh Jan 08 '13 at 10:46
  • I am not sure if you can change the orientation with the piant for the labels which you should be able to get. The real problem will be making enough space for the labels. you probobly need to look at the source.. – Ifor Jan 10 '13 at 15:19

3 Answers3

1

Try this way,

plot.getGraphWidget().setDomainLabelOrientation(-45);

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
1

Here is the solution to rotate domain labels so that they don't overlap each others:

plot.getGraph().getLineLabelStyle(XYGraphWidget.Edge.BOTTOM).setRotation(-45);

This works using the newer version of AndroidPlot (1.0 and above)

matdev
  • 4,115
  • 6
  • 35
  • 56
0

I realize you asked this quite awhile ago, but this might help someone out there.

You can create your own labels as seen here: AndroidPlot : setting the labels on the X-axis

Or if you want to just have less domain value, you can set the domain values by using this:

yourPlotName.setDomainStepValue(NumberOfValuesDesired);
Community
  • 1
  • 1
buczek
  • 2,011
  • 7
  • 29
  • 40