Reputation: 183
Currently the domain label is positioned below the Y axis labels. Is there a way to set the domain label to appear in the middle of the X axis?
Using the below image as an example I want the domain label (Time secs) to appear where the legend (Thread #1) appears. (legend will not be visible).
(source: androidplot.com)
Upvotes: 4
Views: 1286
Reputation: 189
This worked for me with v1.5.4:
plot.getDomainTitle().getPositionMetrics().setXPositionMetric(new HorizontalPosition(0, HorizontalPositioning.ABSOLUTE_FROM_CENTER));
It sets the horizontal position to the center without modifying the vertical position.
It may also be useful to set the text alignment to CENTER:
plot.getDomainTitle().getLabelPaint().setTextAlign(Paint.Align.CENTER);
Upvotes: 0
Reputation: 8317
Take a look at the "LayoutManager" section of the "Plot Composition" doc. It gives a pretty good summary of how to position the visual elements (referenced as widgets in the doc) of a plot. In your case you'll be invoking plot.getDomainTitle().position(...).
Upvotes: 1
Reputation: 183
To center the domain label I used the below.
plot.getDomainLabelWidget().position(0, XLayoutStyle.ABSOLUTE_FROM_CENTER, 0, YLayoutStyle.RELATIVE_TO_BOTTOM, AnchorPosition.BOTTOM_MIDDLE);
Upvotes: 3