chart画图

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data; using System.Web.UI.DataVisualization.Charting;
using System.Drawing; namespace Chart
{
public partial class ChartTest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GetDataTable get = new GetDataTable();
DataTable dt = get.GetTable(); this.Chart1.DataSource = dt;//绑定数据
this.Chart1.Series["统计量折线"].ChartType = SeriesChartType.Spline;//图像类型
this.Chart1.Series["统计量折线"].MarkerStyle = MarkerStyle.Cross; this.Chart1.Series[].XValueMember = "Language";//X轴成员显示
this.Chart1.Series[].YValueMembers = "Count";//Y轴成员显示
this.Chart1.Series[].IsValueShownAsLabel = true;//显示坐标值 this.Chart1.ChartAreas["ChartArea1"].AxisX.Title = "语言";//X轴标题
//this.Chart1.ChartAreas["ChartArea1"].AxisX.TitleAlignment = System.Drawing.StringAlignment.Far;//X设置对其方式
this.Chart1.ChartAreas["ChartArea1"].AxisY.Title = "统计";
//this.Chart1.ChartAreas["ChartArea1"].AxisY.TitleAlignment = System.Drawing.StringAlignment.Far;//Y设置对其方式
this.Chart1.ChartAreas["ChartArea1"].AxisX.Interval = ;//X轴间距
Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;//不显示竖着的分割线 this.Chart1.DataSource = dt;//绑定数据
this.Chart1.Series["统计量折线图2"].ChartType = SeriesChartType.Spline;//图像类型
this.Chart1.Series["统计量折线图2"].MarkerStyle = MarkerStyle.Cross; this.Chart1.Series[].XValueMember = "Language";//X轴成员显示
this.Chart1.Series[].YValueMembers = "Count";//Y轴成员显示
this.Chart1.Series[].IsValueShownAsLabel = true;//显示坐标值 this.Chart1.ChartAreas["ChartArea2"].AxisX.Title = "语言";//X轴标题
//this.Chart1.ChartAreas["ChartArea1"].AxisX.TitleAlignment = System.Drawing.StringAlignment.Far;//X设置对其方式
this.Chart1.ChartAreas["ChartArea2"].AxisY.Title = "统计";
//this.Chart1.ChartAreas["ChartArea1"].AxisY.TitleAlignment = System.Drawing.StringAlignment.Far;//Y设置对其方式
this.Chart1.ChartAreas["ChartArea2"].AxisX.Interval = ;//X轴间距
Chart1.ChartAreas["ChartArea2"].AxisX.MajorGrid.Enabled = false;//不显示竖着的分割线 //Chart2.Series["Series1"].Points.DataBind(dt.Rows, "Count", "Language", "LegendText=Language,YValues=Count,ToolTip=Count");
this.Chart2.DataSource = dt;//绑定数据
Chart2.Series["Series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie;//设置图表类型
Chart2.Series[].XValueMember = "Language";//X轴数据成员列
Chart2.Series[].YValueMembers = "Count";//Y轴数据成员列
//Chart2.Series[0].LegendText = "Language";
Chart2.Series[].IsValueShownAsLabel = true;//显示坐标值 Chart3.DataSource = dt;//绑定数据
Chart3.Series["Series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Bar;//设置图表类型
Chart3.Series[].XValueMember = "Language";//X轴数据成员列
Chart3.Series[].YValueMembers = "Count";//Y轴数据成员列
Chart3.ChartAreas["ChartArea1"].AxisX.Title = "语言";//X轴标题
Chart3.ChartAreas["ChartArea1"].AxisX.TitleAlignment = StringAlignment.Far;//设置Y轴标题的名称所在位置位远
Chart3.ChartAreas["ChartArea1"].AxisY.Title = "统计";//X轴标题
Chart3.ChartAreas["ChartArea1"].AxisY.TitleAlignment = StringAlignment.Far;//设置Y轴标题的名称所在位置位远
Chart3.ChartAreas["ChartArea1"].AxisX.Interval = ;//X轴数据的间距
Chart3.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;//不显示竖着的分割线
Chart3.Series[].IsValueShownAsLabel = true;//显示坐标值 }
}
}
上一篇:Mybatis-Plus 实战完整学习笔记(六)------select测试一


下一篇:JSON.stringify()与JSON.parse()