示例#1
0
        public void draw()
        {
            for (int championIndex = startIndex; championIndex < (endIndex + 1); championIndex++)
            {
                int    targetChampion = NameIndex.ChampionIndex[championIndex];
                bool   sum            = false;
                string myChampion     = NameIndex.IndexParse(NameIndex.ChampionIndex[championIndex]);

                // for (int i = 0; i < NameIndex.ChampionIndex.Length; i++)
                for (int i = 0; i < 10; i++)
                {
                    if (NameIndex.ChampionIndex[i] != targetChampion)
                    {
                        string enemyChampion = NameIndex.IndexParse(NameIndex.ChampionIndex[i]);
                        Console.WriteLine(myChampion + " vs " + enemyChampion);
                        queryBegin(targetChampion.ToString(), NameIndex.ChampionIndex[i].ToString());
                        chartGraphConstruction(targetChampion, NameIndex.ChampionIndex[i], sum);
                        for (int j = 1; j < 19; j++)
                        {
                            for (int k = 1; k < 11; k++)
                            {
                                statSumChart[j, k] += statChart[j, k] / NameIndex.ChampionIndex.Length;
                            }
                        }
                    }
                }
                sum = true;
                chartGraphConstruction(targetChampion, 999, sum);
            }
        }
示例#2
0
        void chartGraphConstruction(int Id1T, int Id2T, bool sum)
        {
            string Series1Name = NameIndex.IndexParse(Id1T);
            string Series2Name = "";

            if (!sum)
            {
                Series2Name = NameIndex.IndexParse(Id2T);
            }
            else if (sum)
            {
                Series2Name = "总计";
            }
            Font Title1Font = new Font("微软雅黑", 15);

            // 表格真初始化
            System.Windows.Forms.DataVisualization.Charting.Chart chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
            chart1.Size = new System.Drawing.Size(640, 320);
            chart1.ChartAreas.Add("ChartArea1");
            chart1.Legends.Add("Legend1");

            System.Windows.Forms.DataVisualization.Charting.Chart chart2 = new System.Windows.Forms.DataVisualization.Charting.Chart();
            chart2.Size = new System.Drawing.Size(640, 320);
            chart2.ChartAreas.Add("ChartArea1");
            chart2.Legends.Add("Legend1");

            System.Windows.Forms.DataVisualization.Charting.Chart chart3 = new System.Windows.Forms.DataVisualization.Charting.Chart();
            chart3.Size = new System.Drawing.Size(640, 320);
            chart3.ChartAreas.Add("ChartArea1");
            chart3.Legends.Add("Legend1");

            System.Windows.Forms.DataVisualization.Charting.Chart chart4 = new System.Windows.Forms.DataVisualization.Charting.Chart();
            chart4.Size = new System.Drawing.Size(640, 320);
            chart4.ChartAreas.Add("ChartArea1");
            chart4.Legends.Add("Legend1");

            System.Windows.Forms.DataVisualization.Charting.Chart chart5 = new System.Windows.Forms.DataVisualization.Charting.Chart();
            chart5.Size = new System.Drawing.Size(640, 320);
            chart5.ChartAreas.Add("ChartArea1");
            chart5.Legends.Add("Legend1");

            System.Windows.Forms.DataVisualization.Charting.Chart chart6 = new System.Windows.Forms.DataVisualization.Charting.Chart();
            chart6.Size = new System.Drawing.Size(640, 320);
            chart6.ChartAreas.Add("ChartArea1");
            chart6.Legends.Add("Legend1");



            #region 表格初始化

            //击杀总量表
            chart3.Series.Add(Series1Name);
            chart3.Series.Add(Series2Name);

            chart3.Legends["Legend1"].Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;
            chart3.Titles.Add("Title1");
            chart3.Titles["Title1"].Text = "全等级击杀量对比";
            chart3.Titles["Title1"].Font = Title1Font;
            chart3.ChartAreas["ChartArea1"].AxisX.Title = "等级";
            chart3.ChartAreas["ChartArea1"].AxisY.Title = "击杀量";

            //单挑表
            chart1.Series.Add("单挑流行度");
            chart1.Series.Add("单挑胜率");
            chart1.Series["单挑胜率"].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chart1.Series["单挑流行度"].YAxisType  = System.Windows.Forms.DataVisualization.Charting.AxisType.Secondary;
            chart1.Series["单挑胜率"].BorderWidth = 5;
            chart1.Series["单挑胜率"].Color       = Color.DodgerBlue;
            chart1.Series["单挑流行度"].Color      = Color.Orange;
            chart1.Legends["Legend1"].Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;
            chart1.Titles.Add("Title1");
            chart1.Titles["Title1"].Text = "全等级单挑分析";
            chart1.Titles["Title1"].Font = Title1Font;
            chart1.ChartAreas["ChartArea1"].AxisX.Title              = "等级";
            chart1.ChartAreas["ChartArea1"].AxisY.Title              = "胜率百分比";
            chart1.ChartAreas["ChartArea1"].AxisY2.Title             = "流行度百分比";
            chart1.ChartAreas["ChartArea1"].AxisY2.MajorGrid.Enabled = false;
            chart1.ChartAreas["ChartArea1"].AxisY.Maximum            = 1.0;

            //GANK表
            chart2.Series.Add("GANK流行度");
            chart2.Series.Add("GANK胜率");
            chart2.Series["GANK胜率"].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chart2.Series["GANK流行度"].YAxisType  = System.Windows.Forms.DataVisualization.Charting.AxisType.Secondary;
            chart2.Series["GANK胜率"].BorderWidth = 5;
            chart2.Series["GANK胜率"].Color       = Color.DodgerBlue;
            chart2.Series["GANK流行度"].Color      = Color.Orange;
            chart2.Legends["Legend1"].Docking   = System.Windows.Forms.DataVisualization.Charting.Docking.Top;
            chart2.Titles.Add("Title1");
            chart2.Titles["Title1"].Text = "全等级GANK分析";
            chart2.Titles["Title1"].Font = Title1Font;
            chart2.ChartAreas["ChartArea1"].AxisX.Title              = "等级";
            chart2.ChartAreas["ChartArea1"].AxisY.Title              = "胜率百分比";
            chart2.ChartAreas["ChartArea1"].AxisY2.Title             = "流行度百分比";
            chart2.ChartAreas["ChartArea1"].AxisY2.MajorGrid.Enabled = false;
            chart2.ChartAreas["ChartArea1"].AxisY.Maximum            = 1.0;

            //死亡表
            chart4.Series.Add(Series1Name);
            chart4.Series.Add(Series2Name);
            chart4.Legends["Legend1"].Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;
            chart4.Titles.Add("Title1");
            chart4.Titles["Title1"].Text = "全等级死亡量对比";
            chart4.Titles["Title1"].Font = Title1Font;
            chart4.ChartAreas["ChartArea1"].AxisX.Title = "等级";
            chart4.ChartAreas["ChartArea1"].AxisY.Title = "死亡量";

            //KDA表
            chart5.Series.Add(Series1Name);
            chart5.Series.Add(Series2Name);
            chart5.Legends["Legend1"].Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;
            chart5.Titles.Add("Title1");
            chart5.Titles["Title1"].Text = "全等级KDA对比";
            chart5.Titles["Title1"].Font = Title1Font;
            chart5.ChartAreas["ChartArea1"].AxisX.Title = "等级";
            chart5.ChartAreas["ChartArea1"].AxisY.Title = "KDA";

            #endregion

            if (!sum)
            {
                for (int i = 1; i < 19; i++)
                {
                    chart1.Series["单挑流行度"].Points.AddXY(i, statChart[i, 1]);
                    chart1.Series["单挑胜率"].Points.AddXY(i, statChart[i, 2]);
                    chart2.Series["GANK流行度"].Points.AddXY(i, statChart[i, 3]);
                    chart2.Series["GANK胜率"].Points.AddXY(i, statChart[i, 4]);
                    chart3.Series[Series1Name].Points.AddXY(i, statChart[i, 5]);
                    chart3.Series[Series2Name].Points.AddXY(i, statChart[i, 6]);
                    chart4.Series[Series1Name].Points.AddXY(i, statChart[i, 7]);
                    chart4.Series[Series2Name].Points.AddXY(i, statChart[i, 8]);
                    chart5.Series[Series1Name].Points.AddXY(i, statChart[i, 9]);
                    chart5.Series[Series2Name].Points.AddXY(i, statChart[i, 10]);
                }


                Directory.CreateDirectory(@"E:\lolLaneStat\" + Series1Name);

                chart1.SaveImage(@"E:\lolLaneStat\" + Series1Name + @"\" + Series2Name + "_1.png", System.Drawing.Imaging.ImageFormat.Png);
                chart2.SaveImage(@"E:\lolLaneStat\" + Series1Name + @"\" + Series2Name + "_2.png", System.Drawing.Imaging.ImageFormat.Png);
                chart3.SaveImage(@"E:\lolLaneStat\" + Series1Name + @"\" + Series2Name + "_3.png", System.Drawing.Imaging.ImageFormat.Png);
                chart4.SaveImage(@"E:\lolLaneStat\" + Series1Name + @"\" + Series2Name + "_4.png", System.Drawing.Imaging.ImageFormat.Png);
                chart5.SaveImage(@"E:\lolLaneStat\" + Series1Name + @"\" + Series2Name + "_5.png", System.Drawing.Imaging.ImageFormat.Png);
            }

            if (sum)
            {
                for (int i = 1; i < 19; i++)
                {
                    chart1.Series["单挑流行度"].Points.AddXY(i, statSumChart[i, 1]);
                    chart1.Series["单挑胜率"].Points.AddXY(i, statSumChart[i, 2]);
                    chart2.Series["GANK流行度"].Points.AddXY(i, statSumChart[i, 3]);
                    chart2.Series["GANK胜率"].Points.AddXY(i, statSumChart[i, 4]);
                    chart3.Series[Series1Name].Points.AddXY(i, statSumChart[i, 5]);
                    chart3.Series[Series2Name].Points.AddXY(i, statSumChart[i, 6]);
                    chart4.Series[Series1Name].Points.AddXY(i, statSumChart[i, 7]);
                    chart4.Series[Series2Name].Points.AddXY(i, statSumChart[i, 8]);
                    chart5.Series[Series1Name].Points.AddXY(i, statSumChart[i, 9]);
                    chart5.Series[Series2Name].Points.AddXY(i, statSumChart[i, 10]);
                }


                Directory.CreateDirectory(@"E:\lolLaneStat\" + Series1Name);

                chart1.SaveImage(@"E:\lolLaneStat\" + Series1Name + @"\" + Series2Name + "1.png", System.Drawing.Imaging.ImageFormat.Png);
                chart2.SaveImage(@"E:\lolLaneStat\" + Series1Name + @"\" + Series2Name + "2.png", System.Drawing.Imaging.ImageFormat.Png);
                chart3.SaveImage(@"E:\lolLaneStat\" + Series1Name + @"\" + Series2Name + "3.png", System.Drawing.Imaging.ImageFormat.Png);
                chart4.SaveImage(@"E:\lolLaneStat\" + Series1Name + @"\" + Series2Name + "4.png", System.Drawing.Imaging.ImageFormat.Png);
                chart5.SaveImage(@"E:\lolLaneStat\" + Series1Name + @"\" + Series2Name + "5.png", System.Drawing.Imaging.ImageFormat.Png);
            }

            chart1.Series.Clear();
            chart1.Titles.Clear();
            chart2.Series.Clear();
            chart2.Titles.Clear();
            chart3.Series.Clear();
            chart3.Titles.Clear();
            chart4.Series.Clear();
            chart4.Titles.Clear();
            chart5.Series.Clear();
            chart5.Titles.Clear();
            chart1.Dispose();
            chart2.Dispose();
            chart3.Dispose();
            chart4.Dispose();
            chart5.Dispose();

            GC.Collect();
        }