Search code examples
androidandroidplot

AndroidPlot - Stacked Bar Z-order


I'm creating a bar graph using AndroidPlot. I'd like to use stacked bar renderer style, but the z-order seems incorrect. This is the graph using side_by_side

side by side bar graph

When using stacked style, july's blue graph bar dissappears, not sure if hidden behind the orange bar or simply not placed (I suspect the first)

stacked bar graph

The overlay style works fine in this case, but if two values are equal in a given month, one of them is hidden

This is how I'm adding the series

Iterator it = mymap.entrySet().iterator();
int count = 0;
while (it.hasNext()) {
    Map.Entry<String, List<Number>> pairs = (Map.Entry<String, List<Number>>) it.next();
    XYSeries series = new SimpleXYSeries(pairs.getValue(), SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, pairs.getKey());

    mXYPlot.addSeries(series, new MyBarFormatter(barColor, borderColor));
}

Solution

  • One thing that could be happening is that the display is being clipped exactly at the "879" and the blue bar is actually being drawn on top of the orange bar in the clipped region and thus invisible. Do you set your plot's boundaries? If so, how? If not, does the missing bar appear when you constrain your range boundaries like this?

    plot.setRangeBoundaries(0, 2000, BoundaryMode.FIXED);