예제 #1
0
 public void UpdateAppsCTChart(List <Classes.AppData> statsList)
 {
     if (this.chart5.InvokeRequired)
     {
         SetChartApp d = new SetChartApp(UpdateAppsCTChart);
         this.Invoke(d, new object[] { statsList });
     }
     else
     {
         int points = Classes.Helper.maxPoint(chart5) + 1;
         for (int i = 0; i < statsList.Count * 2; i = i + 2)
         {
             if (chart5.Series.IndexOf(statsList[i / 2].name + " - Current") == -1)
             {
                 chart5.Series.Add(statsList[i / 2].name + " - Current");
                 chart5.Series.Add(statsList[i / 2].name + " - Goal");
                 chart5.Series[statsList[i / 2].name + " - Goal"].ChartType      = SeriesChartType.Line;
                 chart5.Series[statsList[i / 2].name + " - Current"].ChartType   = SeriesChartType.Line;
                 chart5.Series[statsList[i / 2].name + " - Goal"].BorderWidth    = 1;
                 chart5.Series[statsList[i / 2].name + " - Current"].BorderWidth = 2;
             }
             chart5.Series[statsList[i / 2].name + " - Current"].Points.AddXY(points, statsList[i / 2].currentms);
             chart5.Series[statsList[i / 2].name + " - Goal"].Points.AddXY(points, statsList[i / 2].goal);
             if (chart5.ChartAreas[0].AxisX.Maximum >= 100)
             {
                 chart5.ChartAreas[0].AxisX.ScaleView.Scroll(chart5.ChartAreas[0].AxisX.Maximum);
             }
         }
         chart5.ChartAreas["ChartArea1"].AxisX.Title = "Current Sampling Rate: " + Program.watcher.statsRefreshRate + " milliseconds";
     }
 }
예제 #2
0
        public void UpdateAppsChart(List <Classes.AppData> statsList)
        {
            if (this.chart1.InvokeRequired)
            {
                SetChartApp d = new SetChartApp(UpdateAppsChart);
                this.Invoke(d, new object[] { statsList });
            }
            else
            {
                int points = Classes.Helper.maxPoint(chart1) + 1;
                for (int i = 0; i < statsList.Count * 4; i = i + 4)
                {
                    if (chart1.Series.IndexOf("AV[" + statsList[i / 4].name + "]") == -1)
                    {
                        chart1.Palette = ChartColorPalette.None;
                        chart1.Series.Add("AV[" + statsList[i / 4].name + "]");
                        chart1.Series.Add("GL[" + statsList[i / 4].name + "]");
                        chart1.Series.Add("MN[" + statsList[i / 4].name + "]");
                        chart1.Series.Add("MX[" + statsList[i / 4].name + "]");
                        chart1.Series["GL[" + statsList[i / 4].name + "]"].ChartType       = SeriesChartType.Line;
                        chart1.Series["AV[" + statsList[i / 4].name + "]"].ChartType       = SeriesChartType.Line;
                        chart1.Series["MN[" + statsList[i / 4].name + "]"].ChartType       = SeriesChartType.Line;
                        chart1.Series["MX[" + statsList[i / 4].name + "]"].ChartType       = SeriesChartType.Line;
                        chart1.Series["GL[" + statsList[i / 4].name + "]"].BorderWidth     = 1;
                        chart1.Series["AV[" + statsList[i / 4].name + "]"].BorderWidth     = 2;
                        chart1.Series["MN[" + statsList[i / 4].name + "]"].BorderWidth     = 1;
                        chart1.Series["MX[" + statsList[i / 4].name + "]"].BorderWidth     = 1;
                        chart1.Series["GL[" + statsList[i / 4].name + "]"].BorderDashStyle = ChartDashStyle.Dash;
                        chart1.Series["MN[" + statsList[i / 4].name + "]"].BorderDashStyle = ChartDashStyle.Dot;
                        chart1.Series["MX[" + statsList[i / 4].name + "]"].BorderDashStyle = ChartDashStyle.Dot;
                        chart1.Series["MX[" + statsList[i / 4].name + "]"].Color           = chart1.Series["MX[" + statsList[i / 4].name + "]"].Color;
                        chart1.Series["MN[" + statsList[i / 4].name + "]"].Color           = chart1.Series["MN[" + statsList[i / 4].name + "]"].Color;
                        chart1.Series["GL[" + statsList[i / 4].name + "]"].Color           = chart1.Series["GL[" + statsList[i / 4].name + "]"].Color;
                        chart1.Series["AV[" + statsList[i / 4].name + "]"].Color           = chart1.Series["AV[" + statsList[i / 4].name + "]"].Color;
                    }

                    if (chart1.Series["AV[" + statsList[i / 4].name + "]"].Points.Count < points - 1)
                    {
                        while (chart1.Series["AV[" + statsList[i / 4].name + "]"].Points.Count != points - 1)
                        {
                            chart1.Series["AV[" + statsList[i / 4].name + "]"].Points.AddXY(chart1.Series["AV[" + statsList[i / 4].name + "]"].Points.Count, 0);
                        }
                    }
                    if (chart1.Series["GL[" + statsList[i / 4].name + "]"].Points.Count < points - 1)
                    {
                        while (chart1.Series["GL[" + statsList[i / 4].name + "]"].Points.Count != points - 1)
                        {
                            chart1.Series["GL[" + statsList[i / 4].name + "]"].Points.AddXY(chart1.Series["GL[" + statsList[i / 4].name + "]"].Points.Count, 0);
                        }
                    }
                    if (chart1.Series["MN[" + statsList[i / 4].name + "]"].Points.Count < points - 1)
                    {
                        while (chart1.Series["MN[" + statsList[i / 4].name + "]"].Points.Count != points - 1)
                        {
                            chart1.Series["MN[" + statsList[i / 4].name + "]"].Points.AddXY(chart1.Series["MN[" + statsList[i / 4].name + "]"].Points.Count, 0);
                        }
                    }
                    if (chart1.Series["MX[" + statsList[i / 4].name + "]"].Points.Count < points - 1)
                    {
                        while (chart1.Series["MX[" + statsList[i / 4].name + "]"].Points.Count != points - 1)
                        {
                            chart1.Series["MX[" + statsList[i / 4].name + "]"].Points.AddXY(chart1.Series["MX[" + statsList[i / 4].name + "]"].Points.Count, 0);
                        }
                    }

                    chart1.Series["AV[" + statsList[i / 4].name + "]"].Points.AddXY(points, statsList[i / 4].averagems);
                    chart1.Series["GL[" + statsList[i / 4].name + "]"].Points.AddXY(points, statsList[i / 4].goal);
                    chart1.Series["MN[" + statsList[i / 4].name + "]"].Points.AddXY(points, statsList[i / 4].min);
                    chart1.Series["MX[" + statsList[i / 4].name + "]"].Points.AddXY(points, statsList[i / 4].max);
                    if (chart1.ChartAreas[0].AxisX.Maximum >= 100)
                    {
                        chart1.ChartAreas[0].AxisX.ScaleView.Scroll(chart1.ChartAreas[0].AxisX.Maximum);
                    }
                    Classes.Helper.SetChartTransparency(chart1, "GL[" + statsList[i / 4].name + "]", 2);
                    Classes.Helper.SetChartTransparency(chart1, "MX[" + statsList[i / 4].name + "]", 2);
                    Classes.Helper.SetChartTransparency(chart1, "MN[" + statsList[i / 4].name + "]", 2);
                }
                chart1.ChartAreas["ChartArea1"].AxisX.Title = "Current Sampling Rate: " + Program.watcher.statsRefreshRate + " milliseconds";
            }
        }