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

how to create bubble chart

Hi,

I am try to create bubble chart . I am successful create chart series but X value for series is not set  and bubble size is not set.
I am using following this code.            

IWorksheet osheet = oWorBook.Workshhets[0];
IChartshapes ocharts = osheet.Charts;
IChartshape  ochart = ocharts.Add();
IChartSeries oseries = ochart.Series;
IChartSerie oserie = = oseries.Add();

oSerie.values = osheet.Range[A1:A23];                   ->  x values is not set
oSeire.SeriesType = ExcelChartType.Bubble;
oSeries.vales = osheet.Range[B1:B23];                   ->   y value is set    

and bubble size is ={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};   

Please find the Excel file.
                         

Thanks

Attachment: 8Bubblechart2check_19a67e3.zip

4 Replies

AV Abirami Varadharajan Syncfusion Team September 23, 2016 03:32 PM UTC

Hi Sharad, 
  
Thank you for contacting Syncfusion support. 
  
The Bubble size of series can be set though EnteredDirectlyBubbles and Bubbles properties of chart series. The following code snippet illustrates this behavior. 
 
Code Example: 
//setting bubble size through an array. 
(serie.EnteredDirectlyBubbles = new object[]{1,1,1,1,1,1,1,1,1,1}; 
(OR) 
//setting bubble size through range value. 
serie.Bubbles = worksheet.Range["B2:B10"]; 
  
             
  
  
  
We have prepared sample for your scenario and shared it for your reference which can be downloaded from following location. 
  
  
Kindly refer it and let us know whether your requirement is fulfilled. 
  
Regards, 
Abirami. 



SK Sharad Kumar September 26, 2016 05:42 AM UTC

thanks for replay.

if bubble size value is pass directly in function then after bubble size is set successfully.
oserie.EnteredDirectyBubble = new object[] {1,1,1,1,1,1,1,1,1,1,1}  


But In my case , bubble size value as a string type , then after bubble size is not set.
string bubbleSize = {1,1,1,1,1,1,1,1,1,1,1,1};
object[] yValue = (object[])bubbleSize;
oseries.EnteredDirectlyBubble = yValue;

How to convert string value to object[] array . which run to successfuly in bubble chart.

Thanks
sharad kumar


AV Abirami Varadharajan Syncfusion Team September 27, 2016 01:25 PM UTC

Hi Sharad,
 
Thank you for updating us.
 
Bubble size type is Integer and it accepts only integer value. you can provide integer array as bubble size for the chart. Kindly refer below code snippet to achieve this.
 
Code Example:
 
            int[] bubbleSize = { 1, 1, 1, 1, 1, 1, 1, 1, 1};
            object[] yValue = new object[bubbleSize.Length];
            for(int i = 0; i < bubbleSize.Length; i++)
            {
                yValue[i] = bubbleSize[i];
            }
           
            serie.SerieType = ExcelChartType.Bubble;
            serie.EnteredDirectlyBubbles = yValue;
 
Please let us now if you have any concerns.
 
Regards,
Abirami.



SK Sharad Kumar October 3, 2016 10:44 AM UTC



Thanks Abirami

Loader.
Up arrow icon