private void btnItem_28_Click(object sender, EventArgs e) { frmMonthly_Production fmp = new frmMonthly_Production(); fmp.ShowDialog(); }
/// <summary> /// 每月每天的产量统计 /// </summary> /// <param name="dic_OK"></param> /// <returns></returns> public static PlotModel LineChartSeriesWithDates(Dictionary <int, int> dicX, string time_Year) { var plotmodel = new PlotModel(); var lineSerial = new LineSeries() { Title = "月产量直线图", Background = OxyColors.AliceBlue, TextColor = OxyColors.Blue, LabelFormatString = "{1}", }; int max = dicX[1]; for (int i = 1; i < dicX.Count; i++) { if (dicX[i + 1] > max) { max = dicX[i + 1]; } } plotmodel.Axes.Add(new LinearAxis() { Position = AxisPosition.Left, Minimum = 0, Maximum = max * 1.1, Title = "产量", //显示标题内容 TitlePosition = 0.99, //显示标题位置 TitleColor = OxyColor.Parse("#8B4500"), //显示标题颜色 IsZoomEnabled = false, //坐标轴缩放关闭 IsPanEnabled = false, //图表缩放功能关闭 MajorGridlineStyle = OxyPlot.LineStyle.Solid, }); plotmodel.Axes.Add(new LinearAxis() { Position = AxisPosition.Bottom, Minimum = 0.8, Maximum = 12.2, Title = "月份", //显示标题内容 TitlePosition = 0.99, //显示标题位置 TitleColor = OxyColor.Parse("#8B4500"), //显示标题颜色 IsZoomEnabled = false, //坐标轴缩放关闭 IsPanEnabled = false, //图表缩放功能关闭 MajorGridlineStyle = OxyPlot.LineStyle.Solid, }); frmMonthly_Production frm = new frmMonthly_Production(); List <Point> list = new List <Point>(); for (int i = 0; i < dicX.Count; i++) { lineSerial.Points.Add(new DataPoint(i + 1, dicX[i + 1])); } plotmodel.Series.Add(lineSerial); //---------------- //var rd = new Random(); //Task.Factory.StartNew(() => //{ // while (true) // { // var x = rd.NextDouble() * 10 % 1; // var y = rd.NextDouble() * 5 % 1; // lineSerial.Points.Add(new DataPoint(x, y)); // //刷新视图 // plotmodel.InvalidatePlot(true); // Thread.Sleep(500); // } //}); //---------------- return(plotmodel); }