Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combined Chart: Bubble Chart- bubble size not getting changed, size getting displayed in bubbles not value #3304

Open
sarada2823 opened this issue Aug 1, 2017 · 2 comments

Comments

@sarada2823
Copy link

sarada2823 commented Aug 1, 2017

`BubbleData bubbleData = new BubbleData();

    ArrayList<BubbleEntry> entries2 = new ArrayList<>();
    for (int i = 0; i < newData.size(); i++) {
        entries2.add(new BubbleEntry((float) i, Float.valueOf(newData.get(i).toString()), 10f));
    }

    BubbleDataSet set2 = new BubbleDataSet(entries2, "Data");
    set2.setColors(Color.rgb(140, 234, 255), Color.rgb(255, 208, 140));
    set2.setValueTextSize(10f);
    set2.setValueTextColor(R.color.dark_gray);
    set2.setHighlightCircleWidth(1.5f);
    set2.setDrawValues(true);
    set2.setAxisDependency(YAxis.AxisDependency.LEFT);
    bubbleData.addDataSet(set2);
    data.setData(bubbleData);`

screen shot 2017-08-01 at 3 06 21 pm

I defined size as 10 but the bubbles are larger and 10.0 is getting displayed in all bubbles whereas it should have shown the value from arraylist.
The graph is getting displayed properly.

@mohan9
Copy link

mohan9 commented Jan 4, 2019

what is solution for this?

@regas99
Copy link

regas99 commented Mar 8, 2019

I have a several comments:

  1. Your expectation that the bubble size will be 10 does not make any sense. 10 what? If you look at your chart, each bubble is 1 x-unit wide and about 20 left-axis-units high (~90 - 110) and 35 right-axis-units high (~185 to 220). The bubbles must be scaled to make them round rather than oval, so the radius of the circle drawn on the chart can not be the size field of the BubbleEntry (although they are directly proportional).

  2. The size of the largest drawn circle in a data set is computed to be one x-unit wide. (This maximum size is reduced if that would make the largest circle bigger than the y range.) That is exactly what you got, and is what you will always get. (Although you might play around with the idea of putting a large BubbleEntry outside the chart area to limit the size of the visible circles. I am not sure how that might work.)

  3. The mapping from BubbleEntry size to drawn radius is not intuitive. It depends on the size of the largest entry in the data set (see MarkerView not working #2), the scaling of the axes, and whether BubbleDataSet mNormalizeSize is true or false. If true, the entry size is assumed to be an area; if false it is assumed to be a radius. If you had different size bubbles, the drawn circles would scale accordingly.

  4. The value that is displayed in the circle is provided by ValueFormatter.getBubbleLabel(entry). It defaults to getFormattedValue(bubbleEntry.getSize()). If you want to display something different, you need to override this method or provide a different formatter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants