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.

1
  • Updated, my apologies. Commented Nov 30, 2016 at 14:45

2 Answers 2

1

Sorry I misunderstood your question...

This will help:

yourGraph.getGridLabelRenderer().setNumHorizontalLabels(numberOfBars);
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.