C
cindy liu
Hi,
I just tried to plot some data via OWC11 Chart object.
Since I cannot use array of int to plot a chart directly,
so I created OWC11 SpreadSheet object and populated some
data for it. So far so good! Now I have problem to assign
it to ChartSpace.DataSource. Here is my code...
private AxMicrosoft.Office.Interop.Owc11.AxSpreadsheet
axSpreadsheet1;
Range oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[2,1];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,5);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[2,2];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,5);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[3,1];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,1);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[3,2];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,1);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[4,1];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,9);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[4,2];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,5);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[5,1];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,12);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[5,2];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,0);
axChartSpace1.DataSource=(msdatasrc.DataSource)
axSpreadsheet1; // Error occurred here.
oSeries.SetData(ChartDimensionsEnum.chDimXValues,(int)
(ChartSpecialDataSourcesEnum.chDataBound),"A2:A5");
oSeries.SetData(ChartDimensionsEnum.chDimYValues,(int)
(ChartSpecialDataSourcesEnum.chDataBound),"B2:B5");
Can anyone help me out? Why setting a chart data is so
difficult?
Thanks in advance!
Cindy
I just tried to plot some data via OWC11 Chart object.
Since I cannot use array of int to plot a chart directly,
so I created OWC11 SpreadSheet object and populated some
data for it. So far so good! Now I have problem to assign
it to ChartSpace.DataSource. Here is my code...
private AxMicrosoft.Office.Interop.Owc11.AxSpreadsheet
axSpreadsheet1;
Range oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[2,1];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,5);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[2,2];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,5);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[3,1];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,1);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[3,2];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,1);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[4,1];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,9);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[4,2];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,5);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[5,1];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,12);
oRange=(Range)axSpreadsheet1.ActiveSheet.Cells[5,2];
oRange.set_Value(XlRangeValueType.xlRangeValueDefault,0);
axChartSpace1.DataSource=(msdatasrc.DataSource)
axSpreadsheet1; // Error occurred here.
oSeries.SetData(ChartDimensionsEnum.chDimXValues,(int)
(ChartSpecialDataSourcesEnum.chDataBound),"A2:A5");
oSeries.SetData(ChartDimensionsEnum.chDimYValues,(int)
(ChartSpecialDataSourcesEnum.chDataBound),"B2:B5");
Can anyone help me out? Why setting a chart data is so
difficult?
Thanks in advance!
Cindy