How to switch row/column data series using aspose

pls i need to plot the graph attaced from the excel my code is not doing that or Can't aspose help me out


Aspose.Cells.Charts.Chart chart = wrksht.Charts[chartIndex];
int maxdata = counter + 7;
chart.NSeries.Add("B4:Q" + maxdata,true);

//chart.NSeries.CategoryData = "B4:R6";

// string[] startValues = chart.NSeries[0].Values.Split(':');
// string[] endValues = chart.NSeries[chart.NSeries.Count - 1].Values.Split(':');
// chart.NSeries.Clear();
//string area = startValues[0] + ":" + endValues[1];
// chart.NSeries.Add(area, true);

in the attached the chart with my code generated title is what my code is giving me and i need the chart with the title "Output Chart"



//chart.ShowDataTable=true;
// chart.Title.Text="Title Placement";

Hi,


I think you may try to change your line of code accordingly if it works fine for your requirements, i.e.:

chart.NSeries.Add(“B4:Q” + maxdata,true);
to:
chart.NSeries.Add("B4:Q" + maxdata,false);

Thanks but pls chart.NSeries.Add("B4:Q" + maxdata,false); did not work for my requirement

. it is still giving me the same chart. please check the initially attached file "apose.xlsx". i dont want aspose to fail me. in excel if i right click the chart and 'select Data' command if i click swith row/column button it gives me what i want but aspose cant do that.

Hi,

Thanks for your input.

This seems to me a New Feature Request, therefore I have added this feature request in our database.

Development team will look into it and once this feature is implemented or we have some other update for you, we will let you know.

This issue has been logged as CELLSNET-40624.

I have attached a sample workbook and the screenshot explaining this feature for a reference.

Screenshot:

Hi,


Well, this feature is already supported. To switch row/column data series option (in MS Excel), you only need to specify “true” or “false” for the second parameter of Chart.NSeries.Add() method accordingly.

Here is my complete sample code that works fine, it generates the chart according to your desired output chart (in your template file). I have used your template file to fetch the data source for the chart and generated the chart according to your desired output chart. I have also attached my output file here for your reference.

Sample code:

Workbook workbook = new Workbook(“e:\test2\aspose.xlsx”);
Worksheet sheet = workbook.Worksheets[“Sheet1”];
Cells cells = workbook.Worksheets[0].Cells;

int chartIndex = sheet.Charts.Add(ChartType.Column, 14, 1, 44, 18);
Chart chart = sheet.Charts[chartIndex];

chart.NSeries.Add(“C7:Q13”, false);
chart.NSeries.CategoryData = “C4:Q6”;
chart.NSeries.IsColorVaried = true;

for (int i = 0; i < chart.NSeries.Count; i++)
{
chart.NSeries[i].Name = cells[“B” + (i + 7).ToString()].Value.ToString();
}

workbook.Save(“e:\test2\outmyasposechart.xlsx”, SaveFormat.Xlsx);

@cyberspiritwebsoluti
We have added a new method Chart.SwitchRowColumn() to support this feature in the latest fix 20.12.6.

Aspose.Cells20.12.6 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells20.12.6 For .Net4.0.Zip (5.5 MB)
Aspose.Cells20.12.6 For .NetStandard20.Zip (5.5 MB)

The issues you have found earlier (filed as CELLSNET-40624) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao