Chart笔记
前台页面代码:
后台代码以及属性的解释:
static string sqlconn = "Data Source=.;Initial Catalog=XTest;Integrated Security=True";
protected void Page_Load(object sender, EventArgs e)
{
xxw x = getData();
Chart1.DataSource = getlist();
#region 图表样式
Chart1.BackGradientStyle= = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;//指定图表元素的渐变样式(中心向外,从左到右,从上到下等等)
Chart1.BackSecondaryColor = System.Drawing.Color.Yellow;//设置背景的辅助颜色
Chart1.BorderlineColor = System.Drawing.Color.Yellow;//设置图像边框的颜色
Chart1.BorderlineDashStyle= System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Solid;//设置图像边框线的样式(实线、虚线、点线)
Chart1.BorderlineWidth = 2;//设置图像的边框宽度
Chart1.BorderSkin.SkinStyle= System.Windows.Forms.DataVisualization.Charting.BorderSkinStyle.Emboss;//设置图像的边框外观样式
Chart1.BackColor = System.Drawing.Color.Yellow;//设置图表的背景颜色
#endregion
#region 数据样式
Chart1.Series["Series1"].XValueMember = "name";//设置X轴的数据源
Chart1.Series["Series1"].YValueMembers = "mobile";//设置Y轴的数据源
Chart1.Series["Series2"].XValueMember = "name";
Chart1.Series["Series2"].YValueMembers = "id";
Chart1.Series["Series2"].Color = System.Drawing.Color.Red;//设置颜色
Chart1.Series["Series2"].ChartType= System.Web.UI.DataVisualization.Charting.SeriesChartType.Line;//设置图表的类型(饼状、线状等等)
Chart1.Series["Series1"].IsValueShownAsLabel = true;//设置是否在Chart中显示坐标点值
Chart1.Series["Series1"].BorderColor = System.Drawing.Color.Red;//设置数据边框的颜色
Chart1.BackColor = System.Drawing.Color.Red;//设置图