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.

# Bubbles are overlapping for two same coordinates in bubble chart

Is there's any way to differentiate overlapped bubbles ?

SK Sanjith Kesavan Syncfusion Team August 26, 2015 11:13 AM UTC

Hi Gitesh,
Thanks for using Syncfusion product.
We have analyzed your query. We can differentiate the overlapping bubble by changing the opacity.  Please find the below code example
[JS]

\$("#container").ejChart(
{

seriesRendering: "seriesRender",

});

function seriesRender(sender) {

var x = [];

var y = [];

for (var i = 0; i < sender.data.series.points.length; i++) {

x.push(sender.data.series.points[i].x);

y.push(sender.data.series.points[i].y);

}

var a = arrhasDup(x);

var b = arrhasDup(y);

index1 = x.indexOf(a[0]);

index2 = y.indexOf(b[0]);

if (index1 == index2) {

sender.data.series.points[index1].opacity = 0.5;

}

}

function arrhasDup(x) {

var a = [];

n = x.length;

for (i = 0; i < n; i++) {

for (j = i + 1; j < n; j++) {

if (x[i] == x[j])

a.push(x[j]);

}

}

return a;
}

In the above code we have checked whether bubbles are overlapping or not in the seriesRendering event. If the bubbles are overlapped means we have set the opacity of the bubble as 0.5

In the above screen shot opacity of the overlapped bubble has been changed.

We have prepared the sample as per your requirement. Please find the sample from below location

Please let us know if you have any queries.

Regards,

Sanjith K.​