- 积分
- 130
- 在线时间
- 438 小时
- 主题
- 38
- 注册时间
- 2014-2-15
- 帖子
- 210
- 最后登录
- 2020-11-8
- 帖子
- 210
- 软币
- 2538
- 在线时间
- 438 小时
- 注册时间
- 2014-2-15
|
本帖最后由 人工智能 于 2015-1-23 20:27 编辑
我用过的最简单的C# WebChart控件,特别适合在嵌入式系统下使用。是在一个国外网站上见到的。感觉好的给个评分,谢谢。
<%@ Page Language="C#" %>
<%@ Register tagPrefix="Web" Namespace="WebChart" Assembly="WebChart" %>
<%@ Import Namespace="System.Drawing" %>
<script runat=server>
private void Page_Load(object sender, System.EventArgs e) {
ColumnChart chart = new ColumnChart();
chart.Fill.Color = Color.FromArgb(50, Color.SteelBlue);
chart.Line.Color = Color.SteelBlue;
chart.Line.Width = 2;
chart.Legend = "WebChart information";
chart.Data.Add( new ChartPoint("Jan", 10) );
chart.Data.Add( new ChartPoint("Feb", 20) );
chart.Data.Add( new ChartPoint("Mar", 14) );
chart.Data.Add( new ChartPoint("Apr", 30) );
chart.Data.Add( new ChartPoint("May", 18) );
chart.Data.Add( new ChartPoint("Jun", 7) );
chart.Data.Add( new ChartPoint("Jul", 8) );
chart.Data.Add( new ChartPoint("Aug", 18) );
chart.Data.Add( new ChartPoint("Sep", 24) );
chart.Data.Add( new ChartPoint("Oct", 30) );
chart.Data.Add( new ChartPoint("Nov", 17) );
chart.Data.Add( new ChartPoint("Dec", 5) );
ConfigureColors();
ChartControl1.Charts.Add(chart);
ChartControl1.RedrawChart();
}
// Configure some colors for the Chart, this could be done declaratively also
private void ConfigureColors() {
ChartControl1.Background.Color = Color.FromArgb(75, Color.SteelBlue);
ChartControl1.Background.Type = InteriorType.LinearGradient;
ChartControl1.Background.ForeColor = Color.SteelBlue;
ChartControl1.Background.EndPoint = new Point(500, 350) ;
ChartControl1.Legend.Position = LegendPosition.Bottom;
ChartControl1.Legend.Width = 40;
ChartControl1.YAxisFont.ForeColor = Color.SteelBlue;
ChartControl1.XAxisFont.ForeColor = Color.SteelBlue;
ChartControl1.ChartTitle.Text = "WebChart Control Sample";
ChartControl1.ChartTitle.ForeColor = Color.White;
ChartControl1.Border.Color = Color.SteelBlue;
ChartControl1.BorderStyle = BorderStyle.Ridge;
}
</script>
<html>
<head><title>WebChart Sample</title></head>
<body>
<Web:ChartControl Width="500" Height="350" id="ChartControl1" runat="Server" />
</body>
</html>
|
评分
-
查看全部评分
|