We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Change bubble size of chart as per data associated with it

this is my code where I am fetching data from database and then binding it to bubble chart
now what i want is to change size of bubble as per the size of data changes. The data can be anything it starts from 1 to a millions not able to give exact size of data to size. please suggest

sr.Points(pt =>
                        {
                            foreach (KeyValuePair<String, Double> pair in series)
                            {
                                pt.X(pair.Key).Y(pair.Value).Size(????).Add();
                            }
                        }
                       ).Name(seriesName)
                         .Type(SeriesType.Bubble)
                         .Fill(Utility.getColor(counter))
                         .EnableAnimation(true)
                         .Tooltip(tt =>
                          tt.Visible(true)
                          )
                         .Add();

1 Reply

DP Deepaa Pragaasam Syncfusion Team September 3, 2015 05:17 AM UTC

Hi Ameya,
Thanks for contacting Syncfusion Support. We have analyized your query.
The bubble size can be set according to your requirement.
Example:
When there are millions of data, you can specify the bubble size of first thousand points in a particular size and next thousand points in another size.
We have provided a sample with the datasource containing XValues , YValues and Size of the bubble.
The bubble size also varies according to the chart size. When the width of the chart is less ,the size of the bubble also becomes less due to the responsive behavior of the bubble chart.

Please refer the below sample for your reference
WebApplication1
Code Snippet:
[MVC]

sr.DataSource((IEnumerable<object>)ViewBag.dataSource).XName("xValues").YName("yValues1")  

.Size("size").Type(SeriesType.Bubble).Add();


ScreenShots :
Bubble chart rendered with the size specified in the database with  chart width of 1140 px.

Bubble size when the chart width is given as 400px.

Regards,
Deepaa.


Loader.
Live Chat Icon For mobile
Up arrow icon