1

EDIT

I've spent a very long time trying to find a relationship between BubbleChartDataEntry.size and BarLineChartViewBase.leftAxis/rightAxis min and max values. I can't seem to find a connection. I'm trying to get bubbles of absolute size that correspond to the axis unit of measure, rather than normalized sizes per set, where the largest BubbleChartDataEntry.size is the height of the chart.

Any help with the below problem is appreciated. Please stop voting to close this. I need some assistance.


There's a really great Cocoapod for iOS called Charts that I'm trying.

Say I have a BubbleChartView where the leftAxis or rightAxis min and max is 0 and 20.

The chart is rendered with two BubbleChartDataEntry bubbles, size 9 and 10. The bubbles are about the same height as the left/right axis.

Then the chart is rendered with two different BubbleChartDataEntry bubbles, size 4.5 and 5. These bubbles are also about the same height as left/right axis even though their sizes are half the previous bubbles.

This appears to happen because of a normalization setting on the bubble data. If normalization is disabled, the bubbles are much, much larger than before.

Is there a setting or suggested way to render bubbles so that their sizes use the same unit of measure as the left/right axis? For example, a bubble with size 10 will have a height equal to 10 units on the left/right axis.

1192805
  • 988
  • 2
  • 10
  • 26
  • this seems to be defeating the purpose of a bubble chart which uses the radius to convey a data dimension. I'm not familiar with the package you're using, but perhaps a scatter plot with a circle symbol would get you what you need? – Mike M Sep 05 '19 at 15:46
  • An example of the issue is that vertical axis min=0, max=10, bubble size 1, is rendered as height 10 on the axis. In another chart, bubble size 7 is rendered, its height is also 10. Eg, the largest bubble rendered in the set is height 10, no matter the actual size value. I'm trying to get bubble size 1 to matches height 1 on axis, bubble size 7 to match 7 on axis, etc. – 1192805 Sep 05 '19 at 15:53
  • again, that's not how bubble charts work. The actual size of the bubble has no relation to the x/y scales which are for the bubble position. The bubble "size" adjusts the radius relative to the other bubbles and not to the x/y scale. – Mike M Sep 05 '19 at 16:21
  • I noticed that this library can work this way (I've already described that). But there are numerous options for axes, data entry, data sets, and so on. Documentation is sparse, and I would like to find out if there are settings or approaches on how to match bubble sizes according to left/right axes. – 1192805 Sep 05 '19 at 16:35

3 Answers3

1

Posting in case this might be helpful. For now I'm adding an extra invisible bubble where bubble size = height of axis. All visible bubbles render with diameters that match units on the vertical axis. This may be an unusual use-case but it solves the requirements.

1192805
  • 988
  • 2
  • 10
  • 26
1

This may be a little late for my answer but for anyone facing the same issue:

The problem with bubble circles resizing to huge circles in case of small amount of data in the dataset is that since the chart tries to scale the X Axis so that all the data are shown in one page, thus the circle sizes you set become too bulky!

what you can do to prevent this is to set the bubble Size in the set dynamically according to the number of data in the data set.

for example assuming that my X Axis is from 0 to 10 and I have only 2 data in my dataset; in order to get small sized bubbles I have to set my bubble size equal to maximum x value of x Axis divided by a value, usually I set this dividing value to 15 or 20 in order to have small nice bubbles but you can have the constant as suits you. so in this case we will have 10/20 = 0.5 for bubble size. if you have for example 20 bubbles distributed normally in you x axises in a way that maximum value for x axis is 20 then you can set bubble size 20 / 20 = 1 for nice small bubbles.

Also don't forget to set the normalizeSizeEnabled property of you BubbleChartDataSet to false, this way you are forcing the bubble size to a specific size, and chart does not normalize it automatically.

Sajede Nouri
  • 121
  • 1
  • 3
1

I ended up using ScatterChart (because i wanted same size in all of my bubbles ) and solved my problem.

so consider using ScatterChart if in your representation of data , you only care about two dimensions (like: x,y) and you want a fixe bubble size

Alireza aj
  • 71
  • 1
  • 11