Free Support Forum - aspose.com

Can we develop multiple column charts

Hi,

Pls check attachment once.I want develop a multiple column chart which shown in attachment.

Can we do this if so how to develop this one.

Thanks,

Arun

I made some enhancement according to your file. Please try this attached fix with following sample code:

Aspose.Excel.License lic = new Aspose.Excel.License();
lic.SetLicense("d:\\lic\\aspose.lic");

Excel excel = new Excel();
excel.Open("d:\\test\\decile.xls");

int sheetIndex = excel.Worksheets.Add(SheetType.Chart);

Worksheet sheet = excel.Worksheets[sheetIndex];

int chartIndex = sheet.Charts.Add(ChartType.Column, 0, 0, 0, 0);

Chart chart = sheet.Charts[chartIndex];

chart.NSeries.Add("Data!D2,Data!E2,Data!F2,Data!G2,Data!H2", true);
chart.NSeries[0].Name = "=Data!A2";
chart.NSeries[0].DataLabels.IsValueShown = true;

chart.NSeries.Add("Data!D3,Data!E3,Data!F3,Data!G3,Data!H3", true);
chart.NSeries[1].Name = "=Data!A3";
chart.NSeries[1].DataLabels.IsValueShown = true;

chart.NSeries.Add("Data!D4,Data!E4,Data!F4,Data!G4,Data!H4", true);
chart.NSeries[2].Name = "=Data!A4";
chart.NSeries[2].DataLabels.IsValueShown = true;

chart.NSeries.CategoryData = "Data!D1,Data!E1,Data!F1,Data!G1,Data!H1";


chart.Title.Text = "Breakdown of Contribution Margin";
chart.Title.TextFont.Size = 16;
chart.Title.TextFont.IsBold = true;

chart.ValueAxis.IsVisible = false;

chart.Legend.Position = LegendPositionType.Bottom;
chart.Legend.TextFont.Size = 14;

chart.MajorGridLines.IsVisible = false;

chart.ChartArea.Border.IsVisible = false;

sheet.Zoom = 75;

excel.Save("d:\\test\\abc.xls");

Hi,

Thanks a lot,it is working fine now.I appreciate your quick response.

Thanks,

Arun