用OWC绘制饼图

       //创建X坐标的值,表示月份 
        int[] Month =123 };
        
//创建Y坐标的值,表示销售额 
        double[] Count =120240220 };
        
string strDataName = "";
        
string strData = "";
        
//创建图表空间 
        ChartSpace mychartSpace = new ChartSpace();
        
//在图表空间内添加一个图表对象 
        ChChart mychart = mychartSpace.Charts.Add(0);
        
//设置每块饼的数据 
        for (int i = 0; i < Count.Length; i++)
        
{
            strDataName 
+= Month[i] + "\t";
            strData 
+= Count[i].ToString() + "\t";
        }

        
//设置图表类型,本例使用柱形 
        mychart.Type = ChartChartTypeEnum.chChartTypePie3D;
        
//设置图表的一些属性 
        
//是否需要图例 
        mychart.HasLegend = true;
        
//是否需要主题 
        mychart.HasTitle = true;
        
//主题内容 
        mychart.Title.Caption = "一季度总结";
        
//添加图表块 
        mychart.SeriesCollection.Add(0);
        
//设置图表块的属性 
        
//分类属性 
        mychart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strDataName);
        
//值属性 
        mychart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strData);
        
//显示百分比 
        ChDataLabels mytb = mychart.SeriesCollection[0].DataLabelsCollection.Add();
        mytb.HasPercentage 
= true;
        
//生成图片 
        mychartSpace.ExportPicture(Server.MapPath("img/chart.gif") , "gif"500450);
        
//加载图片 
        this.imgChart.ImageUrl = "img/chart.gif"
原文地址:https://www.cnblogs.com/lovesangel/p/1288807.html