0

I'm trying to use aChartEngine library, at the moment I'm doing some tests with the demo sample but I haven't found a way to set the margin between the edge points and their values.

See the screenshots

enter image description here

The code:

String[] titles = new String[] { "2008", "2007" };
    List<double[]> values = new ArrayList<double[]>();
    values.add(new double[] { 14230, 12300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500,
        12600, 14000 });
    values.add(new double[] { 5230, 7300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500,
        11600, 13500 });
    int[] colors = new int[] { Color.BLUE, Color.CYAN };
    XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
    setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.5,
        12.5, 0, 24000, Color.GRAY, Color.LTGRAY);
    ((XYSeriesRenderer) renderer.getSeriesRendererAt(0)).setDisplayChartValues(true);
    ((XYSeriesRenderer) renderer.getSeriesRendererAt(1)).setDisplayChartValues(true);
    renderer.setXLabels(12);
    renderer.setYLabels(10);
    renderer.setXLabelsAlign(Align.LEFT);
    renderer.setYLabelsAlign(Align.LEFT);
    renderer.setPanEnabled(true, false);
    // renderer.setZoomEnabled(false);
    renderer.setZoomRate(1.1f);
    renderer.setBarSpacing(0.5f);
    return ChartFactory.getBarChartIntent(context, buildBarDataset(titles, values), renderer,
        Type.STACKED);

How to set the margins to avoid the bars overlap the values at their ends?

5
  • Please note that this horizontal bar chart is only an experimental one.
    – Dan D.
    Oct 20, 2014 at 10:02
  • @Dan It's a very useful chart for comparison it's a pity that has bug like this. I really like achartengine library and hope these issues will be fixed asap. PS I have seen that singe 15th october no more night buld have been released.. what happens?
    – AndreaF
    Oct 20, 2014 at 22:51
  • Cloudbees has probably blocked the AChartEngine account due to some changes in their pricing policies.
    – Dan D.
    Oct 21, 2014 at 5:45
  • Is there any other ste where I could stay updated with latest 1.2 builds?
    – AndreaF
    Oct 21, 2014 at 20:19
  • No, there isn't as far as I can tell.
    – Dan D.
    Oct 22, 2014 at 6:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.