Cannot plot data on ChartSpace

C

Cindy Lliu

Hi,

I'm new on OWC11. I tried to plot a chart. But I got
problem when calling SetData method. Here is my code.

ChCharts oCharts=axChartSpace1.Charts;
ChChart oChart=oCharts.Add(0);
oChart.Type=ChartChartTypeEnum.chChartTypeScatterSmoothLine
Markers;

int [,] categories={{1,1},{2,2},{3,3},{4,4}};
int [] xValues={1,2,3,4};
int [] yValues={1,2,3,4};
ChSeriesCollection oCol=oChart.SeriesCollection;
ChSeries oSeries=oChart.SeriesCollection.Add(0);
oChart.SetData(ChartDimensionsEnum.chDimValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),categories);

I also tried ...

oChart.SetData(ChartDimensionsEnum.chDimYValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),yValues);
oChart.SetData(ChartDimensionsEnum.chDimXValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),xValues);

and ...
oSeries.SetData(ChartDimensionsEnum.chDimYValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),yValues);
oSeries.SetData(ChartDimensionsEnum.chDimXValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),xValues);

They all gave me the runtime error.

Can anybody help me out here?
Thanks in advance!!!
Cindy
 
C

cindy liu

Hi Thao,

Then can I just cast it as Object like

oSeries.SetData(ChartDimensionsEnum.chDimYValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),(Object)
yValues);

Can you give a simple sample to fix my code?

Thanks,
Cindy
-----Original Message-----
You cannot declare the categoies, YValue, or XValue array
as a fixed type. They must all be declared object or
variant.

Thao Moua
OWC Webchart Support
-----Original Message-----
Hi,

I'm new on OWC11. I tried to plot a chart. But I got
problem when calling SetData method. Here is my code.

ChCharts oCharts=axChartSpace1.Charts;
ChChart oChart=oCharts.Add(0);
oChart.Type=ChartChartTypeEnum.chChartTypeScatterSmoothLi ne
Markers;

int [,] categories={{1,1},{2,2},{3,3},{4,4}};
int [] xValues={1,2,3,4};
int [] yValues={1,2,3,4};
ChSeriesCollection oCol=oChart.SeriesCollection;
ChSeries oSeries=oChart.SeriesCollection.Add(0);
oChart.SetData(ChartDimensionsEnum.chDimValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),categories);

I also tried ...

oChart.SetData(ChartDimensionsEnum.chDimYValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),yValues);
oChart.SetData(ChartDimensionsEnum.chDimXValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),xValues);

and ...
oSeries.SetData(ChartDimensionsEnum.chDimYValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),yValues);
oSeries.SetData(ChartDimensionsEnum.chDimXValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),xValues);

They all gave me the runtime error.

Can anybody help me out here?
Thanks in advance!!!
Cindy



.
.
 
T

Thao Moua [ms]

Here's a sample of setting literal data.

-------------------------
object[] Data = new object[3] {1, 4, -3};
objHost.Charts[0].SeriesCollection[0].SetData
(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimV
alues, -1, Data);
-------------------------

Thao Moua
OWC Webchart Support
-----Original Message-----
Hi Thao,

Then can I just cast it as Object like

oSeries.SetData(ChartDimensionsEnum.chDimYValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),(Object)
yValues);

Can you give a simple sample to fix my code?

Thanks,
Cindy
-----Original Message-----
You cannot declare the categoies, YValue, or XValue array
as a fixed type. They must all be declared object or
variant.

Thao Moua
OWC Webchart Support
-----Original Message-----
Hi,

I'm new on OWC11. I tried to plot a chart. But I got
problem when calling SetData method. Here is my code.

ChCharts oCharts=axChartSpace1.Charts;
ChChart oChart=oCharts.Add(0);
oChart.Type=ChartChartTypeEnum.chChartTypeScatterSmooth
Li
ne
Markers;

int [,] categories={{1,1},{2,2},{3,3},{4,4}};
int [] xValues={1,2,3,4};
int [] yValues={1,2,3,4};
ChSeriesCollection oCol=oChart.SeriesCollection;
ChSeries oSeries=oChart.SeriesCollection.Add(0);
oChart.SetData(ChartDimensionsEnum.chDimValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),categories);

I also tried ...

oChart.SetData(ChartDimensionsEnum.chDimYValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),yValues);
oChart.SetData(ChartDimensionsEnum.chDimXValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),xValues);

and ...
oSeries.SetData(ChartDimensionsEnum.chDimYValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),yValues);
oSeries.SetData(ChartDimensionsEnum.chDimXValues,(int)
(ChartSpecialDataSourcesEnum.chDataLiteral),xValues);

They all gave me the runtime error.

Can anybody help me out here?
Thanks in advance!!!
Cindy



.
.
.
 

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