zoukankan
html css js c++ java
用OWC绘制饼图
//
创建X坐标的值,表示月份
int
[] Month
=
{
1
,
2
,
3
}
;
//
创建Y坐标的值,表示销售额
double
[] Count
=
{
120
,
240
,
220
}
;
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
"
,
500
,
450
);
//
加载图片
this
.imgChart.ImageUrl
=
"
img/chart.gif
"
;
查看全文
相关阅读:
任正非用人:砍掉高层手脚、中层屁股、基层脑袋、全身赘肉!
SourceTree的基本使用
Spring学习(三)
Spring学习(二)
Spring学习(一)
SpringBoot学习(五)
SpringBoot学习(四)
SpringBoot学习(二)
SpringBoot学习(三)
SpringBoot学习(一)
原文地址:https://www.cnblogs.com/lovesangel/p/1288807.html
最新文章
const *char p和char const *p
冯诺依曼,哈佛,改进的哈佛
负数在计算机中如何存储
NAND flash坏区
stm32GPIO8种模式
C语言关键字
大端小端
define与typedef
Windows10 安装 Docker
docker中安装宝塔面板
热门文章
为什么公司招聘一个好员工很难,程序员找份好工作也不容易
vi/vim 编辑、搜索、查找、定位
轮询、长轮询、长连接、socket连接、WebSocket
使用Application Loader打包上传AppStore流程
PHP 代码规范
常用 Git 命令清单
简单的php基于curl的反向代理程序
适时把自己归零
Linux查看系统信息的一些命令及查看已安装软件包的命令
git修改远程仓库地址
Copyright © 2011-2022 走看看