D
Dewy
Hi,
I am having a major problem with the OWC. I am trying to have multiple
series on a chart, where one series is a line series and the other a
scatter series.
The ultimate goal is to use scalings on the scatter series so that
vertical lines can be drawn on the chart at specific points. I have
achieved this result in Excel, but this was just a test harness and I
am aware that the OWC have only a subset of the functionality of the
actual office counterparts.
I am using C# and my code looks like the following
string[] chartArrLineXValues = new string [] {"Jan 2004",
"Feb 2004", "Mar 2004", "Apr 2004", "May 2004"};
string[] chartArrLineYValues = new string []{"1", "2",
"5", "4", "5"};
string chartStrLineXValues = String.Join ("\t",
chartArrLineXValues);
string chartStrLineYValues = String.Join ("\t",
chartArrLineYValues);
string[] chartArrScatterXValues = new string [] {"5",
"5"};
string[] chartArrScatterYValues = new string []{"0", "1"};
string chartStrScatterXValues = String.Join ("\t",
chartArrScatterXValues);
string chartStrScatterYValues = String.Join ("\t",
chartArrScatterYValues);
ChartSpaceClass chartSpace = new ChartSpaceClass ();
ChChart chart = chartSpace.Charts.Add(0);
ChSeries lineSeries = chart.SeriesCollection.Add(0);
lineSeries.Ungroup(true);
lineSeries.Line.Color = "green";
lineSeries.Type =
ChartChartTypeEnum.chChartTypeSmoothLine;
lineSeries.SetData (ChartDimensionsEnum.chDimValues,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral),
chartStrLineYValues);
lineSeries.SetData (ChartDimensionsEnum.chDimCategories,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral),
chartStrLineXValues);
ChScaling lineScalingXAxis =
lineSeries.get_Scalings(ChartDimensionsEnum.chDimCategories);
ChAxis lineXAxis = chart.Axes.Add(lineScalingXAxis);
ChScaling lineScalingYAxis =
lineSeries.get_Scalings(ChartDimensionsEnum.chDimValues);
ChAxis lineYAxis = chart.Axes.Add(lineScalingYAxis);
ChSeries scatterSeries = chart.SeriesCollection.Add(0);
scatterSeries.Ungroup(true);
scatterSeries.Line.Color = "red";
scatterSeries.Type =
ChartChartTypeEnum.chChartTypeScatterLine;
scatterSeries.SetData (ChartDimensionsEnum.chDimXValues,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral),
chartStrScatterXValues);
scatterSeries.SetData (ChartDimensionsEnum.chDimYValues,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral),
chartStrScatterYValues);
ChScaling scatterScalingXAxis =
scatterSeries.get_Scalings(ChartDimensionsEnum.chDimXValues);
ChAxis scatterXAxis = chart.Axes.Add(scatterScalingXAxis);
scatterXAxis.Position =
ChartAxisPositionEnum.chAxisPositionTop;
ChScaling scatterScalingYAxis =
scatterSeries.get_Scalings(ChartDimensionsEnum.chDimYValues);
ChAxis scatterYAxis = chart.Axes.Add(scatterScalingYAxis);
scatterYAxis.Position =
ChartAxisPositionEnum.chAxisPositionRight;
The problem that I am encountering is that I can't seem to seperate
out the axis. If I change the scalings on one axis it effects that
other series' scaling as well.
Can any one help or suggest an alternative please?
Dewy
I am having a major problem with the OWC. I am trying to have multiple
series on a chart, where one series is a line series and the other a
scatter series.
The ultimate goal is to use scalings on the scatter series so that
vertical lines can be drawn on the chart at specific points. I have
achieved this result in Excel, but this was just a test harness and I
am aware that the OWC have only a subset of the functionality of the
actual office counterparts.
I am using C# and my code looks like the following
string[] chartArrLineXValues = new string [] {"Jan 2004",
"Feb 2004", "Mar 2004", "Apr 2004", "May 2004"};
string[] chartArrLineYValues = new string []{"1", "2",
"5", "4", "5"};
string chartStrLineXValues = String.Join ("\t",
chartArrLineXValues);
string chartStrLineYValues = String.Join ("\t",
chartArrLineYValues);
string[] chartArrScatterXValues = new string [] {"5",
"5"};
string[] chartArrScatterYValues = new string []{"0", "1"};
string chartStrScatterXValues = String.Join ("\t",
chartArrScatterXValues);
string chartStrScatterYValues = String.Join ("\t",
chartArrScatterYValues);
ChartSpaceClass chartSpace = new ChartSpaceClass ();
ChChart chart = chartSpace.Charts.Add(0);
ChSeries lineSeries = chart.SeriesCollection.Add(0);
lineSeries.Ungroup(true);
lineSeries.Line.Color = "green";
lineSeries.Type =
ChartChartTypeEnum.chChartTypeSmoothLine;
lineSeries.SetData (ChartDimensionsEnum.chDimValues,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral),
chartStrLineYValues);
lineSeries.SetData (ChartDimensionsEnum.chDimCategories,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral),
chartStrLineXValues);
ChScaling lineScalingXAxis =
lineSeries.get_Scalings(ChartDimensionsEnum.chDimCategories);
ChAxis lineXAxis = chart.Axes.Add(lineScalingXAxis);
ChScaling lineScalingYAxis =
lineSeries.get_Scalings(ChartDimensionsEnum.chDimValues);
ChAxis lineYAxis = chart.Axes.Add(lineScalingYAxis);
ChSeries scatterSeries = chart.SeriesCollection.Add(0);
scatterSeries.Ungroup(true);
scatterSeries.Line.Color = "red";
scatterSeries.Type =
ChartChartTypeEnum.chChartTypeScatterLine;
scatterSeries.SetData (ChartDimensionsEnum.chDimXValues,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral),
chartStrScatterXValues);
scatterSeries.SetData (ChartDimensionsEnum.chDimYValues,
Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral),
chartStrScatterYValues);
ChScaling scatterScalingXAxis =
scatterSeries.get_Scalings(ChartDimensionsEnum.chDimXValues);
ChAxis scatterXAxis = chart.Axes.Add(scatterScalingXAxis);
scatterXAxis.Position =
ChartAxisPositionEnum.chAxisPositionTop;
ChScaling scatterScalingYAxis =
scatterSeries.get_Scalings(ChartDimensionsEnum.chDimYValues);
ChAxis scatterYAxis = chart.Axes.Add(scatterScalingYAxis);
scatterYAxis.Position =
ChartAxisPositionEnum.chAxisPositionRight;
The problem that I am encountering is that I can't seem to seperate
out the axis. If I change the scalings on one axis it effects that
other series' scaling as well.
Can any one help or suggest an alternative please?
Dewy