C# OWC生成图表

2019-05-11 23:55:48丽君

//给定series的分类
myChart.SeriesCollection[1].SetData(OWC10.ChartDimensionsEnum.chDimCategories, (int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, strCateory);
//给定具体值
myChart.SeriesCollection[1].SetData(OWC10.ChartDimensionsEnum.chDimValues, (int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, strValue1);
//添加一个series
myChart.SeriesCollection.Add(2);
//给定series的名字
myChart.SeriesCollection[2].SetData(OWC10.ChartDimensionsEnum.chDimSeriesNames, (int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, "总成交");
//给定series的分类
myChart.SeriesCollection[2].SetData(OWC10.ChartDimensionsEnum.chDimCategories, (int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, strCateory);
//给定具体值
myChart.SeriesCollection[2].SetData(OWC10.ChartDimensionsEnum.chDimValues, (int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, strValue2);
//输出成GIF文件
string strAbsolutePath = (Server.MapPath(".")) + @"ImagestempChart.gif";
Response.Write(strAbsolutePath);
mySpace.ExportPicture(strAbsolutePath, "GIF", 300, 300); //输出图表
//创建GIF文件的相对路径
string strRelativePath = "Images/tempChart.gif";
//把图片添加到Image
Image1.ImageUrl = strRelativePath;
}
//图表类型枚举
OWC11.ChartChartTypeEnum[] chartTypes = new OWC11.ChartChartTypeEnum[]{
ChartChartTypeEnum.chChartTypeColumnClustered,
  ChartChartTypeEnum.chChartTypeColumn3D,
  ChartChartTypeEnum.chChartTypeBarClustered,
  ChartChartTypeEnum.chChartTypeBar3D,
  ChartChartTypeEnum.chChartTypeArea,
  ChartChartTypeEnum.chChartTypeArea3D,
  ChartChartTypeEnum.chChartTypeDoughnut,
  ChartChartTypeEnum.chChartTypeLineStacked,
  ChartChartTypeEnum.chChartTypeLine3D,
  ChartChartTypeEnum.chChartTypeLineMarkers,
  ChartChartTypeEnum.chChartTypePie,
  ChartChartTypeEnum.chChartTypePie3D,
  ChartChartTypeEnum.chChartTypeRadarSmoothLine,
  ChartChartTypeEnum.chChartTypeSmoothLine};
string[] chartTypesCh = new string[] { "垂直柱状统计图", "3D垂直柱状统计图", "水平柱状统计图", "3D水平柱状统计图", "区域统计图", "3D区域统计图", "中空饼图", "折线统计图", "3D折线统计图", "折线带点统计图", "饼图", "3D饼图", "网状统计图", "弧线统计图" };