示例#1
0
        private void ShowCount(DirectoryData root, int nbShown)
        {
            FileCategories fc = (FileCategories)tscbCategories.SelectedItem;
            Dictionary<string, int> count = root.TotalCount(fc);
            var sortedDict = from entry in count orderby entry.Value descending select entry;

            dotnetCHARTING.WinForms.SeriesCollection sc = new dotnetCHARTING.WinForms.SeriesCollection();
            int nb = 0;
            dotnetCHARTING.WinForms.Series sOther = new dotnetCHARTING.WinForms.Series("Other");
            dotnetCHARTING.WinForms.Element elOther = new dotnetCHARTING.WinForms.Element();
            elOther.Color = Color.White;
            elOther.YValue = 0;
            sOther.Elements.Add(elOther);
            foreach (KeyValuePair<string, int> ext in sortedDict) {
                if (nb < nbShown) {
                    dotnetCHARTING.WinForms.Series s = new dotnetCHARTING.WinForms.Series(ext.Key);
                    dotnetCHARTING.WinForms.Element el = new dotnetCHARTING.WinForms.Element();
                    el.Color = Color.White;
            #if DEBUG
                    Console.WriteLine("{0}: {1}", s.Name, el.Color);
            #endif
                    el.YValue = ext.Value;
                    s.Elements.Add(el);
                    sc.Add(s);
                } else {
                    elOther.YValue += ext.Value;
                }

                //dotnetCHARTING.WinForms.SmartPalette sp = s.GetSmartPalette(dotnetCHARTING.WinForms.Palette.One);
                //sp.SaveState("PaletteOne.xml");
                nb++;
            }

            // Check if there are some aggregated values
            if (elOther.YValue > 0) {
                sc.Add(sOther);
            }

            //sc.Sort(dotnetCHARTING.WinForms.ElementValue.YValue, "Desc");
            chart1.SeriesCollection.Clear();
            chart1.SeriesCollection.Add(sc);
            dotnetCHARTING.WinForms.SmartPalette sp = new dotnetCHARTING.WinForms.SmartPalette();
            //dotnetCHARTING.WinForms.Palette.Autumn;
            Color c = new Color();
            c = Color.FromArgb(156, 154, 255);
        }
示例#2
0
 private void ShowSize(DirectoryData root)
 {
     FileCategories fc = (FileCategories)tscbCategories.SelectedItem;
     Dictionary<string, long> size = root.TotalSize(fc);
     dotnetCHARTING.WinForms.SeriesCollection sc = new dotnetCHARTING.WinForms.SeriesCollection();
     foreach (KeyValuePair<string, long> ext in size) {
         dotnetCHARTING.WinForms.Series s = new dotnetCHARTING.WinForms.Series(ext.Key);
         dotnetCHARTING.WinForms.Element el = new dotnetCHARTING.WinForms.Element();
         el.YValue = ext.Value;
         s.Elements.Add(el);
         sc.Add(s);
     }
     sc.Sort(dotnetCHARTING.WinForms.ElementValue.YValue, "Desc");
     chart1.SeriesCollection.Clear();
     chart1.SeriesCollection.Add(sc);
 }
示例#3
0
        private void ShowCount(DirectoryData root)
        {
            FileCategories fc = (FileCategories)tscbCategories.SelectedItem;
            Dictionary<string, int> count = root.TotalCount(fc);

            dotnetCHARTING.WinForms.SeriesCollection sc = new dotnetCHARTING.WinForms.SeriesCollection();
            foreach (KeyValuePair<string, int> ext in count) {
                dotnetCHARTING.WinForms.Series s = new dotnetCHARTING.WinForms.Series(ext.Key);
                dotnetCHARTING.WinForms.Element el = new dotnetCHARTING.WinForms.Element();
                el.Color = Color.White;
                Console.WriteLine("{0}: {1}", s.Name, el.Color);
                el.YValue = ext.Value;
                s.Elements.Add(el);
                sc.Add(s);

                //dotnetCHARTING.WinForms.SmartPalette sp = s.GetSmartPalette(dotnetCHARTING.WinForms.Palette.One);
                //sp.SaveState("PaletteOne.xml");
            }

            sc.Sort(dotnetCHARTING.WinForms.ElementValue.YValue, "Desc");
            chart1.SeriesCollection.Clear();
            chart1.SeriesCollection.Add(sc);
            dotnetCHARTING.WinForms.SmartPalette sp = new dotnetCHARTING.WinForms.SmartPalette();
            //dotnetCHARTING.WinForms.Palette.Autumn;
            Color c = new Color();
            c = Color.FromArgb(156, 154, 255);
        }