Exemple #1
0
        protected void ShowInfo(string path, string colname)
        {
            FileStream   fs  = new FileStream(@".\\colors\\" + path, FileMode.Open);
            StreamReader sr  = new StreamReader(fs);
            string       tmp = "";

            while (!sr.EndOfStream)
            {
                /*Console.Write(sr.ReadLine());*/
                tmp += sr.ReadLine();
            }
            sr.Close();
            sr.Dispose();
            //MessageBox.Show("Характеристика", tmp);
            OutPut.GetSetInfo = tmp;
            InfColors.SetInfo(colname, tmp);
            //Console.WriteLine("\n\n");
        }
Exemple #2
0
 public DiagramColor(Dictionary <string, double> tmp)
 {
     InitializeComponent();
     dc = new Dictionary <string, double>(tmp);
     dc.Remove("Коричневый");
     for (int i = 0; i < dc.Count; i++)
     {
         chart1.Series.Add(dc.ElementAt(i).Key);
         chart1.Series[dc.ElementAt(i).Key].BorderWidth = 10;
         chart1.Series[dc.ElementAt(i).Key].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;
         chart1.Series[dc.ElementAt(i).Key].ToolTip     = InfColors.GetHColor(dc.ElementAt(i).Key); //info color
         chart1.Series[dc.ElementAt(i).Key].Color       = Color.Black;                              //можно реализовать изменение цвета по ключу
         chart1.Series[dc.ElementAt(i).Key].Points.AddXY((i + 1) * 3, dc.ElementAt(i).Value * 100);
         chart1.Series[dc.ElementAt(i).Key].Points.AddXY((i + 1) * 3, dc.ElementAt(i).Value * 100);
         //можно обернуть в паттерн...
     }
     if (dc.Count == 0)
     {
         MessageBox.Show("Преобладающих цветов не найдено");
         this.Close();
     }
     chart1.Update();
 }