TinyMind
.net.cn
首页
资讯
文章
注册
登录
Web页面折线图控件(可以直接绑定数据)
特困生
关注文章
TinyMind专栏频道
Web页面折线图事例(代码),带有控件!
支持直接绑定数据库
绑定数据库代码如下:
/**/
///
<summary>
///
Thismethodiswhereyougenerateyourgraph.
///
</summary>
///
<paramname="masterPane">
YouareprovidedwithaMasterPaneinstancethat
///
containsoneGraphPanebydefault(accessibleviamasterPane[0]).
</param>
///
<paramname="g">
AgraphicsinstancesoyoucaneasilymakethecalltoAxisChange()
</param>
private
void
OnRenderGraph(ZedGraphWebzgw,Graphicsg,MasterPanemasterPane)
{
//
GettheGraphPanesowecanworkwithit
GraphPanemyPane
=
masterPane[
0
];
//
Setthetitlesandaxislabels
myPane.Title.Text
=
"
访问统计折线图
"
;
myPane.XAxis.Title.Text
=
"
日期
"
;
myPane.YAxis.Title.Text
=
"
访问量
"
;
//
CreateanewDataSourcePointListtohandlethedatabaseconnection
DataSourcePointListdspl
=
new
DataSourcePointList();
//
Specifythetableasthedatasource
dspl.DataSource
=
GetData().Tables[
0
];
//
TheXdatawillcomefromthe"Period"column
dspl.XDataMember
=
"
datere
"
;
//
TheYdatawillcomefromthe"Forecast"column
dspl.YDataMember
=
"
countre
"
;
//
TheZdataarenotused
dspl.ZDataMember
=
null
;
//
dspl.TagDataMember="DJAHolt'sforecasting";
//
Generateabluecurvewithcirclesymbols,and"MyCurve2"inthelegend
LineItemmyCurve2
=
myPane.AddCurve(
"
MyCurve2
"
,dspl,Color.Blue,
SymbolType.Circle);
//
Filltheareaunderthecurvewithawhite-redgradientat45degrees
myCurve2.Line.Fill
=
new
Fill(Color.White,Color.Red,45F);
//
Makethesymbolsopaquebyfillingthemwithwhite
myCurve2.Symbol.Fill
=
new
Fill(Color.White);
//
SettheXAxistodatetype
myPane.XAxis.Type
=
AxisType.Date;
myPane.XAxis.CrossAuto
=
true
;
//
Filltheaxisbackgroundwithacolorgradient
myPane.Chart.Fill
=
new
Fill(Color.White,Color.LightGoldenrodYellow,45F);
masterPane.AxisChange(g);
}
protected
DataSetGetData()
{
SqlConnectionconn
=
new
SqlConnection(
"
server=.;database=hodovoddb;uid=sa;pwd=sa
"
);
SqlDataAdapterda
=
new
SqlDataAdapter(
"
selectcountre,daterefromt_BRowseRecord
"
,conn);
DataSetds
=
new
DataSet();
da.Fill(ds);
return
ds;
}
事例及控件下载
/Files/tks/zedgraph_web_sample_v5.0.7.rar
优质内容筛选与推荐
>>
1、iOS UI布局-回到顶部
2、Apple移动设备处理器指令集 armv6、armv7、armv7s及arm64
3、使用 CLion + MSYS2 配置 C 语言编程环境
4、python调用tcpdump抓包过滤
5、同步父子组件和异步父子组件的生命周期顺序
赞赏
长按二维码向我转账
受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。
阅读
好看
已推荐到看一看
你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
取消
推荐
我知道了
已取消,“好看”想法已同步删除
知道了
已推荐到看一看
和朋友分享想法
最多200字,当前共
字
发送
已发送
朋友将在看一看看到
确定
分享你的想法...
取消
分享想法到看一看
确定
最多200字,当前共
字
发送中
网络异常,请稍后重试
知道了
微信扫一扫
关注该公众号
0
│
收藏
│
举报