如何使用C#在ASP.NET中的样条图中突出显示最高日期和最低日期值

问题描述

我正在为我的组织准备Graph。我想使用C#在Asp.net中的SPLINE Graph的最高(870)和最低(600)学生姓名/系列值中用不同的颜色突出显示。

请帮助!!!

表格数据:

大卫700 约翰870 尼尔810 罗伯特720 安德鲁600

''''隐藏代码:

    protected void Page_Load(object sender,EventArgs e)
    {
           DataBindingToChart();
    }
    public void DataBindingToChart()
    {
            string Query = "select * from Student;";
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DB_Connection"].ConnectionString);
            con.Open();
            DataSet ds = new DataSet();
            DataTable dt = new DataTable();
            SqlDataAdapter adp = new SqlDataAdapter(Query,con);
            adp.Fill(ds);
            dt = ds.Tables[0];
            string[] x = new string[dt.Rows.Count];
            int[] y = new int[dt.Rows.Count];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                x[i] = dt.Rows[i][0].ToString();
                y[i] = Convert.ToInt32(dt.Rows[i][1]);
            }

            Chart1.Series[0].Points.DataBindXY(x,y);
            Chart1.Series[0].ChartType = SeriesChartType.Spline; // Here We Can Change Chart Type
            Chart1.Series[0].Color = Color.Cyan;
            Chart1.Series[0].BorderColor = Color.Black;
            Chart1.Series[0].BorderWidth = 5;
            Chart1.Series[0].MarkerStyle = MarkerStyle.Circle;
            Chart1.Series[0].MarkerBorderWidth = 5;
            Chart1.Legends[0].Enabled = false;
            Chart1.Series[0].IsValueShownAsLabel = true;
            Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = false;
            Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
            Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
            Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
            Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Angle = -90;
            Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font = new Font("Calibri",12f,System.Drawing.FontStyle.Bold);
            Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.ForeColor = Color.DeepPink;
            Chart1.ChartAreas["ChartArea1"].AxisY.LabelStyle.Font = new Font("Calibri",System.Drawing.FontStyle.Bold);
            Chart1.ChartAreas["ChartArea1"].AxisY.LabelStyle.ForeColor = Color.Green;
            Chart1.ChartAreas["ChartArea1"].AxisX.Title = "Students";
            Chart1.ChartAreas["ChartArea1"].AxisX.TitleAlignment = StringAlignment.Center;
            Chart1.ChartAreas["ChartArea1"].AxisX.TitleForeColor = Color.DarkBlue;
            Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont = new Font("Calibri",16f,System.Drawing.FontStyle.Bold);
            Chart1.ChartAreas["ChartArea1"].AxisY.Title = "Marks";
            Chart1.ChartAreas["ChartArea1"].AxisY.TitleAlignment = StringAlignment.Center;
            Chart1.ChartAreas["ChartArea1"].AxisY.TitleForeColor = Color.Orange;
            Chart1.ChartAreas["ChartArea1"].AxisY.TitleFont = new Font("Calibri",System.Drawing.FontStyle.Bold);
            con.Close();
    }

'''

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...