日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Asp.net之MsChart控件动态绑定温度曲线图

發布時間:2025/3/13 编程问答 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Asp.net之MsChart控件动态绑定温度曲线图 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<div><div style="position: absolute; z-index: 200; background-color: #FFFFFF; height: 130px;width: 47px; top: 168px; left: 10px;"><br /><br /><span style="color: Red; font-size: 12px;">最高(℃)</span> </br></br><span style="color: Blue; font-size: 12px;">最低(℃)</span></div><div style="position: absolute; z-index: 30; height: 119px; width: 729px; left: 31px;"><asp:Chart ID="Chart1" runat="server" Height="145px" IsSoftShadows="False" Palette="None"Style="margin-left: 0px" Width="729px"><Series><asp:Series ChartArea="ChartArea1" ChartType="Line" IsValueShownAsLabel="True" MarkerSize="10"MarkerStyle="Circle" Name="Series2" BorderColor="Red" LabelBorderColor="Transparent"MarkerBorderColor="Transparent" MarkerColor="Red"></asp:Series><asp:Series ChartArea="ChartArea1" ChartType="Line" IsValueShownAsLabel="True" MarkerSize="10"MarkerStyle="Circle" Name="Series4" BorderColor="Blue" MarkerColor="Blue"></asp:Series></Series><ChartAreas><asp:ChartArea Name="ChartArea1"></asp:ChartArea></ChartAreas></asp:Chart></div></div> 前臺設計

?

string conn = ConfigurationManager.AppSettings["ConnectionString1"].ToString();DataTable dtTable = new DataTable();protected void Page_Load(object sender, EventArgs e){double[] xValues = { 1, 2, 3, 4, 5, 6, 7 };GetData();Chart1.DataSource = dtTable;int len = dtTable.Rows.Count;double[] yValues = new double[len];double[] y2Values = new double[len];for (int i = 0; i < dtTable.Rows.Count; i++){yValues[i] =Convert.ToDouble( dtTable.Rows[i]["Temperature_max_60"].ToString());y2Values[i] = Convert.ToDouble( dtTable.Rows[i]["Temperature_min_60"].ToString());}Chart1.Series["Series2"].Points.DataBindXY(xValues, yValues);Chart1.Series["Series4"].Points.DataBindXY(xValues, y2Values);Chart1.ChartAreas["ChartArea1"].Position.X = 0;Chart1.ChartAreas["ChartArea1"].Position.Y = 0;Chart1.ChartAreas["ChartArea1"].Position.Height = 100;Chart1.ChartAreas["ChartArea1"].Position.Width = 100;Chart1.ChartAreas["ChartArea1"].AxisX.Minimum = 1;Chart1.ChartAreas["ChartArea1"].AxisX.Maximum = 7.05;Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;Chart1.ChartAreas["ChartArea1"].AxisX.IntervalAutoMode = IntervalAutoMode.FixedCount;Chart1.ChartAreas["ChartArea1"].BorderColor = Color.Gray;Chart1.ChartAreas["ChartArea1"].AxisX.LineColor = Color.Gray;Chart1.ChartAreas["ChartArea1"].AxisY.LineColor = Color.Gray;Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.LineColor = Color.Gray;Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.LineColor = Color.Gray;Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.ForeColor = Color.Transparent;Chart1.ChartAreas["ChartArea1"].AxisY.LabelStyle.ForeColor = Color.Transparent;Chart1.Series["Series2"].Color = Color.Red;Chart1.Series["Series4"].Color = Color.Blue;}public DataTable GetData(){SqlConnection con = new SqlConnection(conn);con.Open();string strsql = "SELECT top 7 CollectDate, zdz_min .Station, Temperature, Temperature_max_60, Temperature_max_time, Temperature_min_60, Temperature_min_time, AirPressure, Rain_sum_60, RelativeHumidity, RelativeHumidity_min_60, RelativeHumidity_min_time, WindDirection, WindSpeed, WindDirection_aver_2, WindSpeed_aver_2, WindDirection_Flurry_max, WindSpeed_Flurry_max, Wind_Flurry_max_time, Visibility, Visibility_min_60 FROM zdz_min where station between 98000 and 99501 or station =58366 order by zdz_min.CollectDate desc";SqlCommand cmd = new SqlCommand(strsql, con);SqlDataAdapter sda = new SqlDataAdapter(cmd);sda.Fill(dtTable);return dtTable;} 后臺代碼

?

轉載于:https://www.cnblogs.com/652769324qq/p/3192653.html

總結

以上是生活随笔為你收集整理的Asp.net之MsChart控件动态绑定温度曲线图的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。