C# WEBFORM动态曲线
时间: 2023-11-25 11:51:57 浏览: 218
C# 动态曲线
以下是一个使用C# WEBFORM动态曲线的例子:
```csharp
// 引用ckpApp.Drawing.Chart.dll
using ckpApp.Drawing.Chart;
protected void Page_Load(object sender, EventArgs e)
{
// 数据初始化
string[] month = new string[12] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" };
int[] d = new int[12] { 23, 66, 38, 56, 39, 79, 75, 142, 134, 112, 134, 127 };
// 创建曲线图对象
Chart chart = new Chart();
chart.Width = 600;
chart.Height = 400;
// 添加数据
chart.AddSeries("Sales", month, d);
// 设置标题和坐标轴标签
chart.Title = "Monthly Sales";
chart.XAxis.Title = "Month";
chart.YAxis.Title = "Sales";
// 输出图像
Response.ContentType = "image/png";
chart.Save(Response.OutputStream, ImageFormat.Png);
}
```
阅读全文