综合

img jk007

asp.net owc11生成图表(C#)

发表于2004/10/21 14:25:00  1216人阅读

string strCategory = "1" + '/t' + "2" + '/t' + "3" + '/t'+"4" + '/t' + "5" + '/t' + "6" + '/t';
   string strValue = "9" + '/t' + "8" + '/t' + "4" + '/t'+"10" + '/t' + "12" + '/t' + "6" + '/t';

   //声明对象
   ChartSpace ThisChart = new ChartSpaceClass();
   ChChart ThisChChart  = ThisChart.Charts.Add(0);
   ChSeries ThisChSeries = ThisChChart.SeriesCollection.Add(0);

   //显示图例
   ThisChChart.HasLegend = true;
   //标题
   ThisChChart.HasTitle = true;
   ThisChChart.Title.Caption = "统计图";

   //给定x,y轴图示说明
   ThisChChart.Axes[0].HasTitle = true;
   ThisChChart.Axes[1].HasTitle = true;
   ThisChChart.Axes[0].Title.Caption = "月份";
   ThisChChart.Axes[1].Title.Caption = "数量";

   //图表类型
   ThisChChart.Type = ChartChartTypeEnum.chChartTypeColumnClustered3D;
   //旋转
   ThisChChart.Rotation  = 360;
   ThisChChart.Inclination = 10;
   //背景颜色
   ThisChChart.PlotArea.Interior.Color = "red";
   //底色
   ThisChChart.PlotArea.Floor.Interior.Color = "green";

   ThisChChart.Overlap = 50;

   ////给定series的名字
   ThisChSeries.SetData(ChartDimensionsEnum.chDimSeriesNames,ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(),"日期");
   //给定分类
   ThisChSeries.SetData(ChartDimensionsEnum.chDimCategories,ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(),strCategory);
   //给定值
   ThisChSeries.SetData(ChartDimensionsEnum.chDimValues,ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(),strValue);
   //导出图像文件
   ThisChart.ExportPicture("G://chart.gif","gif",600,350);

阅读全文
0 0

相关文章推荐

img
取 消
img