C#图表数据转换错误

时间:2017-11-15 10:52:18

标签: c# web charts

我正在尝试创建一个关于来自sql server的数据的图表。但无论我尝试什么,我都会转换错误。

using (var db = new Entities())
        {
            var q = from u in db.Sites
                    where u.SiteURL == result.SiteURL
                    select u;

            List<webpagespeedtest_flat.DataModel.Sites> l = new List<webpagespeedtest_flat.DataModel.Sites>();
            l= q.OrderByDescending(s => s.CheckDate).Take(10).ToList();
            webpagespeedtest_flat.DataModel.Sites[] z = l.ToArray();
           // for(int j=0; j<10; j++)
           // { 
            //System.Web.UI.DataVisualization.Charting.Series[] x  = Convert.(z[j].CheckDate);
            //}
            for (int i = 0; i < 10; i++)
            {
                Series series1 = this.Chart1.Series.Add(Convert.ToString(z[i].CheckDate));
                //Chart1.Series["Score"].Points.Add(Convert.ToDouble(z[i].PageSpeedScore));
                //Chart1.Series["Date"].Points[i].AxisLabel = Convert.ToString(z[i].CheckDate);
            }

          //  Chart1.ChartAreas[0].AxisX.LabelStyle.Angle = -70;



        }

Series series1 = this.Chart1.Series.Add(Convert.ToString(z [i] .CheckDate));在这一行中,我得到“无法将类型'System.Web.UI.DataVisualization.Charting.Series'隐式转换为'System.Windows.Forms.DataVisualization.Charting.Series'”错误。有人可以帮帮我吗?

0 个答案:

没有答案