zoukankan
html css js c++ java
owc11生成饼状图
using
System;
using
System.Collections;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Web;
using
System.Web.SessionState;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.HtmlControls;
using
OWC11;
namespace
WebApplication1
{
/**/
///
<summary>
///
WebForm3 的摘要说明。
///
</summary>
public
class
WebForm3 : System.Web.UI.Page
{
protected
System.Web.UI.WebControls.PlaceHolder ChartHolder;
private
void
Page_Load(
object
sender, System.EventArgs e)
{
//
在此处放置用户代码以初始化页面
//
创建ChartSpace对象来放置图表
OWC11.ChartSpace objCSpace
=
new
OWC11.ChartSpaceClass ();
//
在ChartSpace对象中添加图表,Add方法返回chart对象
OWC11.ChChart objChart
=
objCSpace.Charts.Add (
0
);
//
指定图表的类型。类型由OWC11.ChartChartTypeEnum枚举值得到
objChart.Type
=
OWC11.ChartChartTypeEnum.chChartTypePie ;
//
指定图表是否需要图例
objChart.HasLegend
=
true
;
//
给定标题
objChart.HasTitle
=
true
;
objChart.Title.Caption
=
"
上半年分布图
"
;
//
计算数据
//
categories 和 values 可以用tab分割的字符串来表示*/
string
strSeriesName
=
"
图例 1
"
;
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
'
;
//
添加一个series
objChart.SeriesCollection.Add(
0
);
//
给定series的名字
objChart.SeriesCollection[
0
].SetData (OWC11.ChartDimensionsEnum.chDimSeriesNames,
(
int
)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, strSeriesName);
//
给定分类
objChart.SeriesCollection[
0
].SetData (OWC11.ChartDimensionsEnum.chDimCategories,
(
int
)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, strCategory);
//
给定值
objChart.SeriesCollection[
0
].SetData
(OWC11.ChartDimensionsEnum.chDimValues,
(
int
)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, strValue);
OWC11.ChDataLabels dls
=
objChart.SeriesCollection[
0
].DataLabelsCollection.Add();
dls.HasValue
=
true
;
dls.HasPercentage
=
true
;
dls.Font .Name
=
"
宋体
"
;
//
输出成GIF文件.
string
strAbsolutePath
=
(Server.MapPath(
"
.
"
))
+
"
\\test.gif
"
;
objCSpace.ExportPicture(strAbsolutePath,
"
GIF
"
,
600
,
450
);
//
创建GIF文件的相对路径.
string
strRelativePath
=
"
./test.gif
"
;
//
把图片添加到placeholder.
string
strImageTag
=
"
<IMG SRC='
"
+
strRelativePath
+
"
'/>
"
;
ChartHolder.Controls.Add(
new
LiteralControl(strImageTag));
}
Web 窗体设计器生成的代码
#region
Web 窗体设计器生成的代码
override
protected
void
OnInit(EventArgs e)
{
//
//
CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base
.OnInit(e);
}
/**/
///
<summary>
///
设计器支持所需的方法 - 不要使用代码编辑器修改
///
此方法的内容。
///
</summary>
private
void
InitializeComponent()
{
this
.Load
+=
new
System.EventHandler(
this
.Page_Load);
}
#endregion
}
}
查看全文
相关阅读:
一个短信验证码倒计时插件
记一次图片优化经历
前端开发中两种常见的图片加载方式
《javascript面向对象精要》读书笔记
less hack 兼容
第一次项目总结
你总说毕业遥遥无期,可转眼就各奔东西
【翻译】理念:无冲突的扩展本地DOM原型
【翻译】jQuery是有害的
202002280156-《统治世界的10种算法(摘自极客大学堂)》
原文地址:https://www.cnblogs.com/gwazy/p/262836.html
最新文章
文档ID:某某 模板文件不存在,无法解析文档!
ORM对象/关系模型
软件开发的三层架构
linux crontab命令
误删重要文件后要肉定
Java API使用(不断更新中)
Java程序设计10——与运行环境交互
Java程序设计11——GUI设计与事件处理B
Java程序设计11——GUI设计与事件处理A
mount命令使用
热门文章
Python自然语言处理工具NLTK的安装FAQ
Dashboard
查看 SharePoint Server 中的所有网站集
如何查看SharePoint Server的版本信息
PPT地图
Links for SharePoint learning and troubleshooting
Excel Cannot Connect to SharePoint List
Show username instead of "System Account" in SharePoint 2010
如何迁移SharePoint 2010至新的站点
用户点击数量统计
Copyright © 2011-2022 走看看