shuaiwangVM / achartengine

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

getBarChartView with RangeCategorySeries not display value with min positive #364

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
When i build a graphicView with a RangeCAtegory if the min value is under zero 
and max is positive everything works fine. if both are positive (min and max) 
and min > max the column of graph start by zero and not by min value

What is the expected output? What do you see instead?
See the attachment file for output

Please provide a source code snippet that we can use to replicate the
issue.
double[] minValues = new double[] { -24, -19, -10, -1, 7, 12, 15, 14, 9, 1, 
-11, -16 };
    double[] maxValues = new double[] { 7, 12, 24, 28, 33, 35, 37, 36, 28, 19, 11, 4 };

    XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
    RangeCategorySeries series = new RangeCategorySeries("Temperature");
    int length = minValues.length;
    for (int k = 0; k < length; k++) {
      series.add(minValues[k], maxValues[k]);
    }
    dataset.addSeries(series.toXYSeries());
    int[] colors = new int[] { Color.CYAN };
    XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
    setChartSettings(renderer, "Monthly temperature range", "Month", "Celsius degrees", 0.5, 12.5,
        -30, 45, Color.GRAY, Color.LTGRAY);
    renderer.setBarSpacing(0.5);
    renderer.setXLabels(0);
    renderer.setYLabels(10);
    renderer.addXTextLabel(1, "Jan");
    renderer.addXTextLabel(3, "Mar");
    renderer.addXTextLabel(5, "May");
    renderer.addXTextLabel(7, "Jul");
    renderer.addXTextLabel(10, "Oct");
    renderer.addXTextLabel(12, "Dec");
    renderer.addYTextLabel(-25, "Very cold");
    renderer.addYTextLabel(-10, "Cold");
    renderer.addYTextLabel(5, "OK");
    renderer.addYTextLabel(20, "Nice");
    renderer.setMargins(new int[] {30, 70, 10, 0});
    renderer.setYLabelsAlign(Align.RIGHT);
    SimpleSeriesRenderer r = renderer.getSeriesRendererAt(0);
    r.setDisplayChartValues(true);
    r.setChartValuesTextSize(12);
    r.setChartValuesSpacing(3);
    r.setGradientEnabled(true);
    r.setGradientStart(-20, Color.BLUE);
    r.setGradientStop(20, Color.GREEN);
    GraphicalView gw = ChartFactory.getBarChartView(context, dataset, renderer, Type.DEFAULT);

What version of the product binary library are you using?
1.1.0

Please provide any additional information below.

Original issue reported on code.google.com by cappello...@gmail.com on 6 Nov 2013 at 8:16

Attachments:

GoogleCodeExporter commented 9 years ago
the same thing happen if you try with min and max negative with min>max

Original comment by cappello...@gmail.com on 6 Nov 2013 at 10:47

GoogleCodeExporter commented 9 years ago
Try with the version in here and let me know if you still see the issue:
http://repository-achartengine.forge.cloudbees.com/snapshot/org/achartengine/ach
artengine/1.2.0/

Original comment by dandrome...@gmail.com on 6 Nov 2013 at 11:01

GoogleCodeExporter commented 9 years ago

Original comment by dandrome...@gmail.com on 7 Jan 2014 at 11:23