OWC chChartTypeColumnStacked Example (Pref C#)

R

Rhonda

Hi,

I am trying to built several charts for reports using OWC. I want them to be stacked column charts that would display data for a table/matrix such as

Browser U1 U2 U3 Total
Internet Explorer 2 6 0 8
Netscape 0 3 3 6
Other 0 6 4 10
Total 2 15 7 24

Browser type would be the category and U1, U2, U3 would be the stacked series for each browser.

I have not been able to find a single example on how to create the series' correctly. I can get the chart displayed but adding series' has me stumped.

I have something like this but I only get the last columns results instead of each stacked on top of each other.

objChart.SeriesCollection[0].SetData (OWC.ChartDimensionsEnum.chDimCategories, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "Internet Explorer");
objChart.SeriesCollection[1].SetData (OWC.ChartDimensionsEnum.chDimCategories, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "Netscape");
objChart.SeriesCollection[2].SetData (OWC.ChartDimensionsEnum.chDimCategories, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "Other");

objChart.SeriesCollection[0].SetData (OWC.ChartDimensionsEnum.chDimSeriesNames, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "U1");
objChart.SeriesCollection[1].SetData (OWC.ChartDimensionsEnum.chDimSeriesNames, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "U2");
objChart.SeriesCollection[2].SetData (OWC.ChartDimensionsEnum.chDimSeriesNames, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "U3");

objChart.SeriesCollection[0].SetData (OWC.ChartDimensionsEnum.chDimValues, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, sIEData[1]);
objChart.SeriesCollection[1].SetData (OWC.ChartDimensionsEnum.chDimValues, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, sNSData[1]);
objChart.SeriesCollection[2].SetData (OWC.ChartDimensionsEnum.chDimValues, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, sOtherData[1]);

Can anyone please point me to an example or give me an idea about how to accomplish this? I would very much appreciate it. I have been struggling for days.

Thanks in advance.

Rhonda
 
J

Jon Peltier

Rhonda -

I hope I'm not off base, I have never programmed for the OWC beyond a
textbook example, and until recently I thought C# was "cee-pound". But I
assume there are some similarities with Excel's charting object model.

I think you're defining the series names and values properly, but each
series should use the same categories. In Excel they only need to be
stated for the first series in the chart, but it never hurts to specify
all of them. Your categories for all three series are the array {IE, NS,
Other}. I'll leave it up to you to get that array into the OWC.

Good luck,

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Hi,

I am trying to built several charts for reports using OWC. I want them to be stacked column charts that would display data for a table/matrix such as

Browser U1 U2 U3 Total
Internet Explorer 2 6 0 8
Netscape 0 3 3 6
Other 0 6 4 10
Total 2 15 7 24

Browser type would be the category and U1, U2, U3 would be the stacked series for each browser.

I have not been able to find a single example on how to create the series' correctly. I can get the chart displayed but adding series' has me stumped.

I have something like this but I only get the last columns results instead of each stacked on top of each other.

objChart.SeriesCollection[0].SetData (OWC.ChartDimensionsEnum.chDimCategories, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "Internet Explorer");
objChart.SeriesCollection[1].SetData (OWC.ChartDimensionsEnum.chDimCategories, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "Netscape");
objChart.SeriesCollection[2].SetData (OWC.ChartDimensionsEnum.chDimCategories, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "Other");

objChart.SeriesCollection[0].SetData (OWC.ChartDimensionsEnum.chDimSeriesNames, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "U1");
objChart.SeriesCollection[1].SetData (OWC.ChartDimensionsEnum.chDimSeriesNames, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "U2");
objChart.SeriesCollection[2].SetData (OWC.ChartDimensionsEnum.chDimSeriesNames, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "U3");

objChart.SeriesCollection[0].SetData (OWC.ChartDimensionsEnum.chDimValues, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, sIEData[1]);
objChart.SeriesCollection[1].SetData (OWC.ChartDimensionsEnum.chDimValues, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, sNSData[1]);
objChart.SeriesCollection[2].SetData (OWC.ChartDimensionsEnum.chDimValues, (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, sOtherData[1]);

Can anyone please point me to an example or give me an idea about how to accomplish this? I would very much appreciate it. I have been struggling for days.

Thanks in advance.

Rhonda
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top