We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ClusteredColumn chart type only displays 4 items instead of all

Hi,

I’m running into some issues with the chart I’m working on which is a ClusteredColumn chart type. Eventhough there’s at least 15 items in the embedded worksheet, only 4 items keep showing up in the chart. Can somebody please help me with this? Here’s a part of the code I’m using below to generate the chart where “tbl” is a type of System.Data.DataTable (.NET).

// Add chart with default data
ChartEx ch = slide.Shapes.AddChart(ChartTypeEx.ClusteredColumn, x, y, 300, 370);

// Set chart style sheet
ch.Style = StyleTypeEx.Style12;
ch.HasDataTable = false;
ch.HasLegend = false;
ch.HasTitle = false;
ch.Rotation = 180;
ch.ChartDataTable.ShowLegendKey = false;

//If you want to change the data then create Workbook object
Workbook Wb = (Workbook)ch.ChartData.Workbook;

// Clear all contents of the worksheet object
int maxrows = 1000; // provide default number of rows to clear
int maxcols = 1000; // provide default number of columns to clear
Wb.Worksheets[0].Cells.ClearContents(0, 0, maxrows, maxcols);

Aspose.Cells.Cell cell = Wb.Worksheets[0].Cells[0, 0];
cell.PutValue(“Keywords”);

cell = Wb.Worksheets[0].Cells[0, 1];
cell.PutValue(“Totals”);

// Create list of keywords as series
for (int r = 0; r < tbl.Rows.Count; r++)
{
cell = Wb.Worksheets[0].Cells[r + 1, 0];
cell.PutValue(tbl.Rows[r][“Keyword”].ToString());

cell = Wb.Worksheets[0].Cells[r + 1, 1];
cell.PutValue(Convert.ToDouble(tbl.Rows[r][“All”].ToString().Replace("%", “”)));
}

Best,
Rex

is there anyone online now??

Hi Rex,

Thanks for your interest in Aspose.Slides.

I have tried to understand the issue shared by you. I am afraid that with part of information shared I am unable to reproduce the issue. It will be really nice, if you may please share the generated presentation with charts and source excel file as well with chart. Please also share the working project code by using which you can reproduce the issue and I may also be able to do the same for quick and precise investigation. I really appreciate your cooperation in advance for this.

Thanks and Regards,