遇到一个OWC的问题:我想在一张图片中同时显示散点图和折线图,感觉这方面资料也不好找,不知大家能不能帮助一下?
场景描述:
假定有两个向量:X和Y,现要以(X,Y)为基准画一散点图,以(X, X)为基准作一直线。我写的代码如下:
private static void Draw()
{
OWC11.ChartSpace space = new OWC11.ChartSpaceClass();
OWC11.ChChart chart = space.Charts.Add(0);
//chart.Type = OWC11.ChartChartTypeEnum.chChartTypeLineMarkers;
chart.HasTitle = true;
chart.Title.Caption = "Hello World!";
chart.Axes[0].HasTitle = true;
chart.Axes[0].Title.Caption = "X:Hello";
chart.Axes[1].HasTitle = true;
chart.Axes[1].Title.Caption = "Y:World";
OWC11.ChSeries one = chart.SeriesCollection.Add(0);
one.Type = OWC11.ChartChartTypeEnum.chChartTypeScatterMarkers;//散点图
one.SetData(OWC11.ChartDimensionsEnum.chDimSeriesNames,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, "bbbbb");
one.SetData(OWC11.ChartDimensionsEnum.chDimCategories,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, "30\t35\t40\t45\t50");
//two.SetData(OWC11.ChartDimensionsEnum.chDimXValues,
// (int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,
// "30\t40\t35\t45\t58");
one.SetData(OWC11.ChartDimensionsEnum.chDimYValues,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,
"33\t32\t42\t43\t58");
OWC11.ChSeries two = chart.SeriesCollection.Add(0);
two.Type = OWC11.ChartChartTypeEnum.chChartTypeLine;//线图
two.SetData(OWC11.ChartDimensionsEnum.chDimSeriesNames,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, "aaaaa");
two.SetData(OWC11.ChartDimensionsEnum.chDimCategories,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, "30\t40\t35\t45\t50");
two.SetData(OWC11.ChartDimensionsEnum.chDimValues,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,
"30\t35\t40\t45\t50");
space.ExportPicture(@"D:\my.gif", "GIF", 617, 336);
}
{
OWC11.ChartSpace space = new OWC11.ChartSpaceClass();
OWC11.ChChart chart = space.Charts.Add(0);
//chart.Type = OWC11.ChartChartTypeEnum.chChartTypeLineMarkers;
chart.HasTitle = true;
chart.Title.Caption = "Hello World!";
chart.Axes[0].HasTitle = true;
chart.Axes[0].Title.Caption = "X:Hello";
chart.Axes[1].HasTitle = true;
chart.Axes[1].Title.Caption = "Y:World";
OWC11.ChSeries one = chart.SeriesCollection.Add(0);
one.Type = OWC11.ChartChartTypeEnum.chChartTypeScatterMarkers;//散点图
one.SetData(OWC11.ChartDimensionsEnum.chDimSeriesNames,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, "bbbbb");
one.SetData(OWC11.ChartDimensionsEnum.chDimCategories,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, "30\t35\t40\t45\t50");
//two.SetData(OWC11.ChartDimensionsEnum.chDimXValues,
// (int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,
// "30\t40\t35\t45\t58");
one.SetData(OWC11.ChartDimensionsEnum.chDimYValues,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,
"33\t32\t42\t43\t58");
OWC11.ChSeries two = chart.SeriesCollection.Add(0);
two.Type = OWC11.ChartChartTypeEnum.chChartTypeLine;//线图
two.SetData(OWC11.ChartDimensionsEnum.chDimSeriesNames,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, "aaaaa");
two.SetData(OWC11.ChartDimensionsEnum.chDimCategories,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, "30\t40\t35\t45\t50");
two.SetData(OWC11.ChartDimensionsEnum.chDimValues,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,
"30\t35\t40\t45\t50");
space.ExportPicture(@"D:\my.gif", "GIF", 617, 336);
}
图形效果如下:
而我想要的结果是上图蓝线的转折处以“点”来表示,不要以线图来表现,不知道如何设置图形的对象。谢谢大家的帮助!