当前位置: 首页>>代码示例>>C#>>正文


C# SeriesCollection.Add方法代码示例

本文整理汇总了C#中SeriesCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# SeriesCollection.Add方法的具体用法?C# SeriesCollection.Add怎么用?C# SeriesCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SeriesCollection的用法示例。


在下文中一共展示了SeriesCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BasicLine

        public BasicLine()
        {
            InitializeComponent();

            //we create a new SeriesCollection
            Series = new SeriesCollection();

            //create some LineSeries
            var charlesSeries = new LineSeries
            {
                Title = "Charles",
                Values = new ChartValues<double> {10, 5, 7, 5, 7, 8}
            };

            var jamesSeries = new LineSeries
            {
                Title = "James",
                Values = new ChartValues<double> { 5, 6, 9, 10, 11, 9 }
            };

            //add our series to our SeriesCollection
            Series.Add(charlesSeries);
            Series.Add(jamesSeries);

            //that's it, LiveCharts is ready and listening for your data changes.
            DataContext = this;
        }
开发者ID:g1ga,项目名称:Live-Charts,代码行数:27,代码来源:BasicLine.xaml.cs

示例2: ComboHorizontal

 public static void ComboHorizontal(dotnetCHARTING.Chart chart, int width, int height, string title, DataTable table, string xColumn, string yColumn)
 {
     SeriesCollection SC = new SeriesCollection();
     Series s = new Series();
     foreach (DataRow row in table.Rows)
     {
         string telType = row[xColumn].ToString();
         Element e = new Element();
         e.Name = telType;
         e.LabelTemplate = "%PercentOfTotal";
         e.YValue = Convert.ToDouble(row[yColumn].ToString());
         s.Elements.Add(e);
     }
     SC.Add(s);
     chart.TempDirectory = "temp";
     chart.Use3D = false;
     chart.DefaultAxis.Interval = 10;
     chart.DefaultAxis.CultureName = "zh-CN";
     chart.Palette = new Color[] { Color.FromArgb(49, 255, 49), Color.FromArgb(255, 255, 0), Color.FromArgb(255, 99, 49), Color.FromArgb(0, 156, 255) };
     chart.DefaultElement.SmartLabel.AutoWrap = true;
     chart.Type = ChartType.ComboHorizontal;
     chart.Size = width + "x" + height;
     chart.DefaultElement.SmartLabel.Text = "";
     chart.Title = title;
     chart.DefaultElement.ShowValue = true;
     chart.PieLabelMode = PieLabelMode.Outside;
     chart.ShadingEffectMode = ShadingEffectMode.Three;
     chart.NoDataLabel.Text = "û��������ʾ";
     chart.SeriesCollection.Add(SC);
 }
开发者ID:wengyuli,项目名称:ecsms,代码行数:30,代码来源:ChartHelper.cs

示例3: FilterChart

        public FilterChart()
        {
            InitializeComponent();

            //create a configuration for City class
            var config = new SeriesConfiguration<City>()
                .Y(city => city.Population); // use Population an Y
                                             // X will use default config, a zero based index
            
            //create a series collection with this config
            Series = new SeriesCollection(config);

            //lets pull some initials results
            var results = DataBase.Cities.OrderByDescending(city => city.Population).Take(15).ToArray();

            PopulationSeries = new BarSeries
            {
                Title = "Population by city 2015",
                Values = results.AsChartValues(),
                DataLabels = true
            };

            //there are 2 types of labels, when we use a formatter, and a strong array mapping
            //in this case instead of a label formatter we use a strong array labels
            //since X is a zero based index LiveCharts automatically maps this array with X
            //so when X = 0 label will be labels[0], when X = 1 labels[1], X = 2 labels[2], X = n labels[n]
            Labels = results.Select(city => city.Name).ToArray();

            Series.Add(PopulationSeries);

            DataContext = this;
        }
开发者ID:Beanium,项目名称:Live-Charts,代码行数:32,代码来源:FilterChart.xaml.cs

示例4: BasicLineExample

        public BasicLineExample()
        {
            InitializeComponent();

            SeriesCollection = new SeriesCollection
            {
                new LineSeries
                {
                    Title = "Series 1",
                    Values = new ChartValues<double> { 4, 6, 5, 2 ,7 }
                },
                new LineSeries
                {
                    Title = "Series 2",
                    Values = new ChartValues<double> { 6, 7, 3, 4 ,6 }
                }
            };

            Labels = new[] {"Jan", "Feb", "Mar", "Apr", "May"};
            YFormatter = value => value.ToString("C");

            //modifying the series collection will animate and update the chart
            SeriesCollection.Add(new LineSeries
            {
                Values = new ChartValues<double> {5, 3, 2, 4},
                LineSmoothness = 0 //straight lines, 1 really smooth lines
            });

            //modifying any series values will also animate and update the chart
            SeriesCollection[2].Values.Add(5d);

            DataContext = this;
        }
开发者ID:beto-rodriguez,项目名称:Live-Charts,代码行数:33,代码来源:BasicLineExample.xaml.cs

示例5: HighPerformanceLine

        public HighPerformanceLine()
        {
            InitializeComponent();

            //First you need to install LiveCharts.Optimizations
            //from Nuget:
            //Install-Package LiveCharts.Optimizations

            //LiveCharts.Optimization contains a class called ChartOptimizations where you can find 
            //algorithms according to your chart type, they also have a good description, indicating 
            //which is the best according to your case, using a wrong algorithm could not display data
            //to an optimized quality.

            //var algorithm = ChartOptimizations.Lines.RegularX<double>()
            //    // low quality is the default, but it is really accurate, it could fail only for +-3 pixels
            //    .WithQuality(DataQuality.Low);

            //create a configuration in this case we will use X as a zero based index,
            //and Y as the stored value in Series.Values
            //we will also attach the algorithm we just selected.
            var config = new SeriesConfiguration<double>()
                .X((val, index) => index)
                .Y(val => val);
                //.HasHighPerformanceMethod(algorithm);

            //create a SeriesCollection with this configuration
            Series = new SeriesCollection(config);

            //create a new line series
            var line = new LineSeries {Values = new ChartValues<double>()};


            //add some random values to test
            var r = new Random();
            var trend = 0d;

            for (var i = 0; i < 1000000; i++)
            {
                if (i%1000 == 0) trend += r.Next(-500, 500);
                line.Values.Add(trend + r.Next(-10, 10));
            }

            Series.Add(line);

            //some format
            var now = DateTime.Now.ToOADate();
            XFormat = val => DateTime.FromOADate(now + val/100).ToShortDateString();
            YFormat = val => Math.Round(val) + " ms";

            //set zooming if needed.
            ZoomingMode = ZoomingOptions.XY;

            DataContext = this;
        }
开发者ID:Beanium,项目名称:Live-Charts,代码行数:54,代码来源:HighPerformanceLine.xaml.cs

示例6: FillData

 /// <summary>метод который формирует данные для chart-а на основе колекции серий, 
 /// поинтов и их пересечений </summary>
 private SeriesCollection FillData(
     Dictionary<string, float> seriesDef, 
     Dictionary<string, float> pointDef,
     Dictionary<Intersection, float> intersections)
 {
     SeriesCollection result = new SeriesCollection();
     if (!subDiagramMode)
     {
         switch (this.DiagramType)
         {
             case DiagramTypeEnum.Graph:
                 result.Add(CreateDataForFullDiagram(seriesDef, pointDef, intersections, true));
                 break;
             case DiagramTypeEnum.ColumnDetail:
                 result.Add(CreateDataForFullDiagram(seriesDef, pointDef, intersections, false));
                 break;
             case DiagramTypeEnum.ColumnGeneral:
                 result.Add(CreateDataForColumnGeneral(seriesDef));
                 break;
             case DiagramTypeEnum.PieGeneral:
                 result.Add(CreateDataForPieGeneral(seriesDef));
                 break;
             case DiagramTypeEnum.Speedometer:
             case DiagramTypeEnum.TrafficLight:
                 if (seriesDef.Any( s => s.Key.Equals(defaultSeries)))
                     result.Add(FillSeriesData(seriesDef.First(s => s.Key.Equals(defaultSeries))));
                 break;
             case DiagramTypeEnum.PieDetail:
                 if (seriesDef.Any(s => s.Key.Equals(defaultSeries)))
                     result.Add(FillPointsData(seriesDef.First(s => s.Key.Equals(defaultSeries)),
                         pointDef, intersections, false));
                 break;
         }
     }
     else
     {
         if (string.IsNullOrEmpty(detalizedSeriesName)) detalizedSeriesName = this.defaultSeries;
         if (seriesDef.Any(s => s.Key.Equals(detalizedSeriesName)))
         {
             switch (this.SubDiagramType)
             {
                 case SubDiagramTypeEnum.Graph:
                 case SubDiagramTypeEnum.ColumnDetail:
                 case SubDiagramTypeEnum.PieDetail:
                     result.Add(FillPointsData(seriesDef.First(s => s.Key.Equals(detalizedSeriesName)),
                         pointDef, intersections, false));
                     break;
             }
         }
     }
     FillEmptyVisibleSeries(seriesDef.Keys.ToList());
     return result;
 }
开发者ID:AlexSneg,项目名称:VIRD-1.0,代码行数:55,代码来源:DataWorker.cs

示例7: AutoSeriesColors

        public void AutoSeriesColors()
        {
            var testguy = new CartesianChart();
            testguy.MockIt(new CoreSize(200, 200));

            var seriesCollection = new SeriesCollection();

            for (var i = 0; i < 100; i++)
            {
                seriesCollection.Add(new LineSeries {Values = new ChartValues<double> {1, 2, 3}});
            }

            testguy.Series = seriesCollection;
        }
开发者ID:beto-rodriguez,项目名称:Live-Charts,代码行数:14,代码来源:SeriesAutoColors.cs

示例8: BasicLine

        public BasicLine()
        {
            InitializeComponent();

            Series = new SeriesCollection();

            var charlesSeries = new LineSeries
            {
                Title = "Charles",
                Values = new ChartValues<double> {10, 5, 7, 5, 7, 8}
            };

            var jamesSeries = new LineSeries
            {
                Title = "James",
                Values = new ChartValues<double> {5, 6, 9, 10, 11, 9}
            };

            Series.Add(charlesSeries);
            Series.Add(jamesSeries);

            DataContext = this;
        }
开发者ID:IGNATIUSLIJO,项目名称:Live-Charts,代码行数:23,代码来源:BasicLine.xaml.cs

示例9: PointPropertyChangedBar

        public PointPropertyChangedBar()
        {
            InitializeComponent();

            StoresCollection = new SeriesCollection(new SeriesConfiguration<StoreViewModel>().Y(y => y.Income));
            StoresCollection.Add(new BarSeries
            {
                Title = "Apple Store",
                Values = new ChartValues<StoreViewModel>
                {
                    new StoreViewModel {Income = 15, Collection = StoresCollection}
                }
            });
            StoresCollection.Add(new BarSeries
            {
                Title = "Google Play",
                Values = new ChartValues<StoreViewModel>
                {
                    new StoreViewModel {Income = 5, Collection = StoresCollection}
                }
            });

            DataContext = this;
        }
开发者ID:JackWangCUMT,项目名称:Live-Charts,代码行数:24,代码来源:PointPropertyChangedBar.xaml.cs

示例10: load

        private SeriesCollection load(ObservableCollection<Model> tmpCollection)
        {
            ObservableCollection<Model> Collection;
            SeriesCollection LineSeries;

            LineSeries = new SeriesCollection();
            Collection = new ObservableCollection<Model>();
            //readClimateAnomaly(Collection);
            Collection = tmpCollection;
            LineSeries Series1 = new LineSeries();
            Series1.XPath = "XData";
            Series1.YPath = "YValue";
            Series1.PointsSource = Collection;

            LineSeries.Add(Series1);
            return LineSeries;
        }
开发者ID:stefanoschrs,项目名称:n.s.a.c.14,代码行数:17,代码来源:MainPage.xaml.cs

示例11: BuildBurndownChart

        public static ChartViewModel BuildBurndownChart(Iteration iteration, List<Assignable> tasks)
        {
            SeriesCollection sc;
            Series s;

            sc = new SeriesCollection();

            s = new Series();
            s.Name = "Effort";
            s.Type = SeriesType.Bar;
            //s.DefaultElement.ShowValue = true;

            for (var day = iteration.StartDate.Date; day.Date <= iteration.EndDate.AddDays(1).Date; day = day.AddDays(1))
            {
                var remainingTime = 0.0;
                //Do not show values for future dates.
                if (day <= DateTime.Today.AddDays(1))
                {
                    foreach (var task in tasks)
                    {
                        if (task.Times.Items.Count == 0)
                        {
                            remainingTime += task.Effort;
                        }
                        else
                        {
                            //NOTE: The Remain property on a Time object represents only the remaining time for that role (ie/ developer/qa) so we can't use it here.
                            var timeSpent = task.Times.Items.Where(t => t.Date.Date < day).Sum(t => t.Spent);
                            remainingTime += task.Effort - timeSpent;
                        }
                    }
                }
                s.AddElements(new Element(day.ToShortDateString(), remainingTime));
            }

            sc.Add(s);

            var chart = InitializeBarGraph(sc, "Time Remaining");
            return new ChartViewModel
                        {
                            ImageFileName = string.Format("{0:s}/{1:s}.png", chart.TempDirectory, chart.FileName)
                        };
        }
开发者ID:rkurz,项目名称:Cerebro,代码行数:43,代码来源:ChartService.cs

示例12: EmployeesHiredAndDismissedViewModel

        public EmployeesHiredAndDismissedViewModel()
        {
            SeriesCollection = new SeriesCollection
            {
                new ColumnSeries
                {
                    Title = "Contratados",
                    Values = new ChartValues<double> { 8, 10, 12, 10, 13, 18, 14, 16, 19, 21, 18, 17 }
                }
            };

            SeriesCollection.Add(new ColumnSeries
            {
                Title = "Despedidos",
                Values = new ChartValues<double> { 8, 10, 12, 10, 13, 18, 14, 16, 19, 21, 18, 17 }
            });

            Labels = new[] { "Ago", "Sep", "Oct", "Nov", "Dic", "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul" };
        }
开发者ID:yureru,项目名称:tkUI,代码行数:19,代码来源:EmployeesHiredAndDismissedViewModel.cs

示例13: backgroundWorker1_DoWork

        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            SeriesCollection sc = new SeriesCollection();

            foreach (object o in ethnicities)
            {
                if (o is EthnicityFrequency.EthnicityStat)
                {
                    Series theSeries = new Series();
                    EthnicityFrequency.EthnicityStat stat = (EthnicityFrequency.EthnicityStat)o;
                    Element elem = new Element();
                    theSeries.Name = stat.racialBackground;
                    elem.Name = stat.racialBackground;
                    elem.YValue = stat.frequency;
                    total += stat.frequency;
                    theSeries.AddElements(elem);
                    sc.Add(theSeries);
                }
            }
            e.Result = sc;
        }
开发者ID:mahitosh,项目名称:HRA4,代码行数:21,代码来源:EthnicityFrequencyControl.cs

示例14: DoCreateChartImage

        protected override Image DoCreateChartImage()
        {
            var chart = new Chart();
            chart.Type = ChartType.Combo;
            chart.Width = Parameters.ChartWidth;
            chart.Height = Parameters.ChartHeight;
            chart.Series.Data = Parameters.SeriaData;
            var seriesCollection = new SeriesCollection();
            var s = new Series("", SeriesType.Line);
            foreach (var pair in Parameters.SeriaData)
            {
                s.Elements.Add(new Element()
                {
                    YValue = pair.Key,
                    XValue = pair.Value
                });
            }
            seriesCollection.Add(s);
            chart.SeriesCollection.Add(seriesCollection);

            return chart.GetChartBitmap();
        }
开发者ID:perevernihata,项目名称:DotNetChartingOverview,代码行数:22,代码来源:dotnetChartAdapter.cs

示例15: getChartData

        private SeriesCollection getChartData(DataTable dt)
        {
            SeriesCollection SC = new SeriesCollection();

            Series s = new Series();

            Random ro = new Random();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Element e = new Element();

                e.Name = dt.Rows[i][0].ToString();
                e.YValue = Convert.ToDouble(dt.Rows[i][1].ToString());
                e.ShowValue = true;
                s.Elements.Add(e);

            }

            SC.Add(s);

            return SC;
        }
开发者ID:hitpisces,项目名称:testfield,代码行数:23,代码来源:Form3.cs


注:本文中的SeriesCollection.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。