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
close icon

Add multiple ranges to the chart datarange

Hi,

I am a beginner with syncfuion tools.

I am trying to build a radar graph in an Excel sheet.
But I do not understand how to add multiple ranges to the chart datarange like it's possible to do in the excel wizard.

For example:
=Sheet1!$B$2:$B$4;Sheet1!$B$6:$B$8;Sheet1!$B$10:$B$12

I tried this :

chart.DataRange = sheet.Range("B2:B4;B6:B8;B10:B12")

But it didn't work.

Can you tell me How to do it please ?

Thanks

3 Replies

MW Melba Winshia Syncfusion Team March 20, 2007 11:04 AM UTC

Hi Thuric,

Thanks for your interest in Essential XlsIO.

You can add multiple ranges to the chart datarange by using the IRanges collection. Please use the following code snippet to achieve this.

[C#]

//Discontiguous range
IRanges rangesOne = sheet.CreateRangesCollection();
rangesOne.Add(sheet.Range["B2:B4"]);
rangesOne.Add(sheet.Range["B6:B8"]);
rangesOne.Add(sheet.Range["B10:B12"]);

//Set DataRange.
chart.DataRange = rangesOne;

Here is a sample for your reference:

http://websamples.syncfusion.com/samples/XlsIO.Web/4.4.0.51/F58162/main.htm

Kindly let me know if you have any other questions.

Thanks,
Melba


AD Administrator Syncfusion Team March 20, 2007 12:01 PM UTC

Hi Melba,

So simple :)

Thanks for your help.

Regards,
- Thuric


MW Melba Winshia Syncfusion Team March 21, 2007 01:09 PM UTC

Hi Thuric,

Thanks for the update.

Kindly let me know if you have any other questions.

Regards,
Melba

Loader.
Live Chat Icon For mobile
Up arrow icon