1

See picture below, trying to figure out why they it is skipping the '1', '3', and so forth.

Bar Graph Example

Where i set the series and graph:

DataPoint[] dataPoints = new DataPoint[rankList.size()]; // declare an array of DataPoint objects with the same size as your list

        for (int i = 0; i < rankList.size(); i++) {

            dataPoints[i] = new DataPoint(i, Double.parseDouble(rankList.get(i))); // not sure but I think the second argument should be of type double
        }

        BarGraphSeries<DataPoint> series2 = new BarGraphSeries<DataPoint>(dataPoints); // This one should be obvious right? :)

        series2.setAnimated(true);
        series2.setTitle("Random Curve 1");
        series2.setColor(Color.GREEN);

        series2.setSpacing(30);

        series2.setDataWidth(1);

        graph2.getViewport().setMinX(-1);
        graph2.getViewport().setMaxX(12);

        graph2.addSeries(series2);

The right info is being plotted, but i've tried a bunch of stuff from the docs and get get it to work.

AndroidDev21921
  • 695
  • 1
  • 8
  • 21

2 Answers2

1

Sorry I misunderstood your question...

This will help:

yourGraph.getGridLabelRenderer().setNumHorizontalLabels(numberOfBars);
0

It actually shows all bars. You've set series2.setSpacing(30);. Instead do series2.setSpacing(0);.

lou
  • 1