fahmy
fahmy

Reputation: 3672

AndroidPlot: Positioning and Aligning domain value labels

I'm having trouble positioning and aligning the domain values in AndroidPlot. I've attached a screenshot of what I have so far.

Problem 1 (Positioning): Since I'm formatting Unix timestamp as MMM-yy and setting the domain label orientation to -90 degrees, the labels tends to overlap the graph area (as shown below). Is there a way to move the domain labels? I prefer not to use setDomainLabelVerticalOffset() as the XYGraphWidget doesn't re-size itself to accommodate the changes from offsetting.

Problem 2 (Aligning): The domain labels seem to be aligned from bottom. This is very clear if you look at "Jul-07" and "May-09" labels in the screenshot below. Is is possible to align the labels from top?

Screenshot

Upvotes: 1

Views: 2273

Answers (1)

Nick
Nick

Reputation: 8317

One thing you can do is set the justification of the labels being drawn. If memory serves, the default is center justified and what you probably want is right justified:

plot.getGraphWidget().getDomainLabelPaint().setTextAlign(Paint.Align.RIGHT);

Nick

Upvotes: 2

Related Questions