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);
本文地址:http://com.8s8s.com/it/it8312.htm