问题
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 XYMultipleSeriesRenderer 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.
回答1:
You can use multipleRenderer.setMargins() and multipleRenderer.setShowLegend() in order to hide the extra stuff you may not need.
Regards,
Dan
来源:https://stackoverflow.com/questions/3928631/how-can-i-draw-a-sparkline-with-achartengine-without-a-border