Вопрос

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

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top