开发者

How can I draw a sparkline with achartengine without a border?

I have written a simple app widget that tries to display a time chart as a sparkline using the achartengine library. My renderer is:

final XYMultipl开发者_Go百科eSeriesRenderer multipleRenderer = new XYMultipleSeriesRenderer();
final XYSeriesRenderer renderer = new XYSeriesRenderer();
multipleRenderer.addSeriesRenderer(renderer);
multipleRenderer.setShowAxes(false);
multipleRenderer.setShowLabels(false);
multipleRenderer.setShowLegend(false);
multipleRenderer.setShowGrid(false);

and after creating a dataset I draw to a bitmap using:

final TimeChart tc = new TimeChart(dataset, multipleRenderer);
final Bitmap image1 = Bitmap.createBitmap(INITIAL_WIDTH, INITIAL_HEIGHT, Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(image1);
tc.draw(canvas, 0, 0, INITIAL_WIDTH, INITIAL_HEIGHT);

but annoyingly the chart I get has a thick border where the axes and labels would have been.

I would like to know if there is a better way using achartengine of plotting my sparkline so that it occupies the whole width of the bitmap.


You can use multipleRenderer.setMargins() and multipleRenderer.setShowLegend() in order to hide the extra stuff you may not need.

Regards,

Dan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜