Вопрос

Am using AndroidPlot to plot a graph.

I wanted to display X and Y scale in title widget and position in top-right corner. I have positioned but unable to interpret new line in setTitle() string parameter. It is displaying ASCII character instead. Is there any other way to define scale of the plotting graph.

I tried this:

Paint dPaint = new Paint();
dPaint.setColor(Color.BLACK);
mySimpleXYPlot.getTitleWidget().setPadding(0, 0, 0, 0);
mySimpleXYPlot.getTitleWidget().setBackgroundPaint(bgPaint);
mySimpleXYPlot.getTitleWidget().setLabelPaint(txtPaint);
mySimpleXYPlot.getTitleWidget().setSize(new SizeMetrics(50, SizeLayoutType.ABSOLUTE, 120, SizeLayoutType.ABSOLUTE));
mySimpleXYPlot.position(mySimpleXYPlot.getTitleWidget(), 80, XLayoutStyle.ABSOLUTE_FROM_RIGHT, 15, YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.RIGHT_TOP);
mySimpleXYPlot.setTitle("X axis: 5mm= 0.2 sec\n Y axis: 5mm= 0.5 mV ");

Please suggest.

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

Решение

This is not a solution, just an alternative.

I have managed title with out having a "new line character" i.e. a single line with following statement and positioned to right-top corner of graph.

mySimpleXYPlot.setClippingEnabled(false);

This makes your complete text visible even if your text is extend beyond the Title widget size.

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