yunjianwu / achartengine

Automatically exported from code.google.com/p/achartengine
0 stars 0 forks source link

Bar chart single series issue #252

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In trying to create a bar chart with single series, an exception occurs using 
the current version of ACE "1.0.0". Please refer to previous issue #9.

Modifying the "StackedSalesChart" demo to include only one series created this 
exception (see below).

  public Intent execute(Context context) {
///    String[] titles = new String[] { "2008", "2007" };
    String[] titles = new String[] { "2008" };
    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);
    renderer.getSeriesRendererAt(0).setDisplayChartValues(true);
    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);
  }

Original issue reported on code.google.com by burnsy1...@gmail.com on 28 Oct 2012 at 4:23

GoogleCodeExporter commented 9 years ago
Please disregard this issue. 
Sorry, but I found the issue was related to the bar colors creating the 
additional series. Will post to forum first in the future.

Original comment by burnsy1...@gmail.com on 28 Oct 2012 at 7:36

GoogleCodeExporter commented 9 years ago

Original comment by dandrome...@gmail.com on 8 Jan 2013 at 12:29