Free Support Forum - aspose.com

How do I create a clustered chart ?!

Hello,

I would like to create a clustered chart (see attached spreadsheet).
I have the below data which I wish to create a chart out of:

Territory

RO Label

This Month (Jun)

Last Month (May)

Previous Month (Apr)

Previous 3 Months (Jan - Mar)

Last 12 Months (Jul-Jun)

UK

Parlophone

50

41

40

42

34

UK

EMI Marketing

21

34

30

25

41

UK

Capitol

14

12

2

10

9

UK

Virgin

50

41

40

42

34

US

EMI Marketing

21

34

30

25

41

US

VRA - Virgin

14

12

2

10

9

US

Blue Note

14

12

2

10

9

US

Capitol

50

41

40

42

34

I think the problem I have is defining the series correctly, so far I have been playing around with the following code:

int chartIndex = worksheet.Charts.Add(ChartType.Column3DClustered, 9, 9, 21, 15);
Chart chart = worksheet.Charts[chartIndex];chart.NSeries.Add(string.Format(@"A1:A9), true);
chart.NSeries.Add(string.Format(@"B1:B9), true);
chart.NSeries.Add(string.Format(@"C1:C9), true);
chart.NSeries.Add(string.Format(@"D1: D9), true);
chart.NSeries.Add(string.Format(@"E1:E9), true);
chart.NSeries.Add(string.Format(@"F1:F9), true);
chart.NSeries.Add(string.Format(@"G2:G9), true);
chart.NSeries.CategoryData = "A1:G1";

Any ideas on how I can generate a chart as in the attachment ?

Please try the following code:


int chartIndex = excel.Worksheets[0].Charts.Add(ChartType.Column3DClustered, 10, 1, 31, 14);
Chart chart = excel.Worksheets[0].Charts[0];
chart.NSeries.Add("C2:G9", true);
chart.NSeries.CategoryData = "A2:B9";
chart.NSeries[0].Name = "=C1";
chart.NSeries[1].Name = "=D1";
chart.NSeries[2].Name = "=E1";
chart.NSeries[3].Name = "=F1";
chart.NSeries[4].Name = "=G1";

Laurence, that is simply superb Idea

Thank you very much for your help ! Cool