zoukankan      html  css  js  c++  java
  • 用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"
  • 相关阅读:
    volatile关键字,使一个变量在多个线程间可见。
    grep sed awk
    mysql高级聚合
    Hive高级聚合GROUPING SETS,ROLLUP以及CUBE
    用SecureCRT来上传和下载文件
    mysql导出导入数据
    redis入门
    spark 常用技巧总结2
    生成数据库字典
    spark 常用技巧总结
  • 原文地址:https://www.cnblogs.com/lovesangel/p/1288807.html
Copyright © 2011-2022 走看看