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


C# SeriesCollection类代码示例

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


SeriesCollection类属于命名空间,在下文中一共展示了SeriesCollection类的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: RotatedStackedBar

        public RotatedStackedBar()
        {
            InitializeComponent();

            var config = new SeriesConfiguration<double>().X(val => val);

            SeriesCollection = new SeriesCollection(config)
            {
                new StackedBarSeries
                {
                    Title = "Stacked Serie 1",
                    Values = new double[] {3,6,2,7}.AsChartValues(),
                    DataLabels = true
                },
                new StackedBarSeries
                {
                    Title = "Stacked Serie 1",
                    Values = new double[] {6,3,5,2}.AsChartValues(),
                    DataLabels = true
                },
                new LineSeries
                {
                    Title = "Line Series",
                    Values = new double[] {10, 11, 8, 9}.AsChartValues(),
                    Fill = Brushes.Transparent
                }
            };

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

示例4: InitializeBarGraph

        private static Chart InitializeBarGraph(SeriesCollection seriesCollection, string yAxisTitle)
        {
            var chart = new Chart();
            //chart.Title = "Burndown";
            chart.Type = ChartType.Combo;
            chart.TempDirectory = VirtualPathUtility.ToAbsolute("~/file/chart");
            chart.SeriesCollection.Add(seriesCollection);
            chart.YAxis.Label.Text = yAxisTitle;
            chart.YAxis.Label.Color = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
            chart.YAxis.DefaultTick.Label.Color = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
            chart.XAxis.DefaultTick.Label.Color = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
            chart.LegendBox.Visible = false;
            chart.BorderStyle = System.Web.UI.WebControls.BorderStyle.None;
            chart.TitleBox.Visible = false;
            chart.Background.Color = System.Drawing.ColorTranslator.FromHtml("#333333");
            chart.DefaultSeries.Element.Color = System.Drawing.ColorTranslator.FromHtml("#1B12A6");
            chart.DefaultElement.Color = System.Drawing.ColorTranslator.FromHtml("#1B12A6");
            chart.Width = new System.Web.UI.WebControls.Unit(600, System.Web.UI.WebControls.UnitType.Pixel);
            chart.Height = new System.Web.UI.WebControls.Unit(400, System.Web.UI.WebControls.UnitType.Pixel);
            chart.Font.Name = "Helvetica";
            chart.Font.Size = new System.Web.UI.WebControls.FontUnit(24, System.Web.UI.WebControls.UnitType.Pixel);
            chart.YAxis.Label.Font = new System.Drawing.Font("Helvetica", 8);
            chart.YAxis.DefaultTick.Label.Font = new System.Drawing.Font("Helvetica", 8);
            chart.XAxis.DefaultTick.Label.Font = new System.Drawing.Font("Helvetica", 8);

            //NOTE: needed to do this for the old version of .net charting (3.4).
            chart.FileManager.TempDirectory = VirtualPathUtility.ToAbsolute("~/file/chart");
            chart.FileManager.SaveImage(chart.GetChartBitmap());

            //chart.FileManager.FileName = chart.FileManager.TempDirectory + "/" + chart.FileManager.FileName + ".png";
            return chart;
        }
开发者ID:rkurz,项目名称:Cerebro,代码行数:32,代码来源:ChartService.cs

示例5: 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

示例6: MissingPointsExample

        public MissingPointsExample()
        {
            InitializeComponent();

            Series = new SeriesCollection
            {
                new LineSeries
                {
                    Values = new ChartValues<double>
                    {
                        4,
                        5,
                        7,
                        8,
                        double.NaN,
                        5,
                        2,
                        8,
                        double.NaN,
                        6,
                        2
                    }
                }
            };

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

示例7: FetchAll

 public SeriesCollection FetchAll()
 {
     var coll = new SeriesCollection();
     var qry = new Query(Series.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
开发者ID:khaha2210,项目名称:radio,代码行数:7,代码来源:SeriesController.cs

示例8: LogarithmicAxis

        public LogarithmicAxis()
        {
            InitializeComponent();

            //we create a configuration to map our values type, in this case System.Windows.Point
            var config = new SeriesConfiguration<Point>()
                .X(point => Math.Log(point.X, 10)) // we use log10(point.X) as X
                .Y(point => point.Y); // we use point.Y as the Y of our chart (amm.... yes, we are so f* smart!)

            //we pass the config to the SeriesCollection constructor, or you can use Series.Setup(config)
            Series = new SeriesCollection(config)
            {
                new LineSeries
                {
                    Values = new ChartValues<Point>
                    {
                        new Point(1, 10),
                        new Point(10, 15),
                        new Point(100, 29),
                        new Point(1000, 38),
                        new Point(10000, 45),
                        new Point(100000, 55)
                    }
                }
            };

            //to display labels we convert back from log
            //this is just the inverse operation 
            XFormatter = x =>
            {
                return Math.Pow(10, x).ToString();
            };

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

示例9: RotatedBar

        public RotatedBar()
        {
            InitializeComponent();

            var config = new SeriesConfiguration<double>().X(value => value);

            SeriesCollection =
                new SeriesCollection(config)
                {
                    new BarSeries
                    {
                        Title = "inverted series",
                        Values = new double[] {10, 15, 18, 20, 15, 13}.AsChartValues(),
                        DataLabels = true
                    },
                    new BarSeries
                    {
                        Title = "inverted series 2",
                        Values = new double[] {4, 8, 19, 19, 16, 12}.AsChartValues(),
                        DataLabels = true
                    },
                    new LineSeries
                    {
                        Title = "inverted line series",
                        Values = new double[] {10, 15, 18, 20, 15, 13}.AsChartValues(),
                        Fill = Brushes.Transparent
                    }
                };

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

示例10: ZoomingAndPanning

        public ZoomingAndPanning()
        {
            InitializeComponent();

            var gradientBrush = new LinearGradientBrush {StartPoint = new Point(0, 0),
                EndPoint = new Point(0, 1)};
            gradientBrush.GradientStops.Add(new GradientStop(Color.FromRgb(33, 148, 241), 0));
            gradientBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 1));

            SeriesCollection = new SeriesCollection
            {
                new LineSeries
                {
                    Values = GetData(),
                    Fill = gradientBrush,
                    StrokeThickness = 1,
                    PointGeometrySize = 0
                }
            };

            ZoomingMode = ZoomingOptions.X;

            XFormatter = val => new DateTime((long) val).ToString("dd MMM");
            YFormatter = val => val.ToString("C");

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

示例11: 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

示例12: IrregularLine

        public IrregularLine()
        {
            InitializeComponent();

            //we create a configuration to map our values type, in this case System.Windows.Point
            var config = new SeriesConfiguration<Point>()
                .X(point => point.X) // we use point.X as the X of our chart (you don't say!)
                .Y(point => point.Y); // we use point.Y as the Y of our chart -.-"

            //we pass the config to the SeriesCollection constructor, or you can use Series.Setup(config)
            Series = new SeriesCollection(config)
            {
                new LineSeries
                {
                    Values = new ChartValues<Point>
                    {
                        new Point(1, 10),
                        new Point(2, 15),
                        new Point(4, 29),
                        new Point(8, 38),
                        new Point(16, 45),
                        new Point(32, 55),
                        new Point(64, 62),
                        new Point(128, 76),
                        new Point(256, 95)
                    },
                    Fill = Brushes.Transparent
                }
            };
            
            DataContext = this;
        }
开发者ID:g1ga,项目名称:Live-Charts,代码行数:32,代码来源:IrregularLine.xaml.cs

示例13: SalesViewModel

 public SalesViewModel()
 {
     var config = new SeriesConfiguration<SalesData>().Y(data => data.ItemsSold);
     Salesmen = new SeriesCollection(config)
     {
         new PieSeries
         {
             Title = "Charles",
             Values = new ChartValues<SalesData>
             {
                 new SalesData {ItemsSold = 15, Rentability = .15, ItemsAverageSellPrice = 5000}
             }
         },
         new PieSeries
         {
             Title = "Frida",
             Values = new ChartValues<SalesData>
             {
                 new SalesData {ItemsSold = 16, Rentability = .12, ItemsAverageSellPrice = 5200}
             }
         },
         new PieSeries
         {
             Title = "George",
             Values = new ChartValues<SalesData>
             {
                 new SalesData {ItemsSold = 22, Rentability = .11, ItemsAverageSellPrice = 5100}
             }
         }
     };
 }
开发者ID:g1ga,项目名称:Live-Charts,代码行数:31,代码来源:MvvmPie.xaml.cs

示例14: DynamicLine

        public DynamicLine()
        {
            InitializeComponent();

            //In this case we will not only plot double values
            //to make it easier to handle "live-data" we are going to use WeatherViewModel class
            //we need to let LiveCharts know how to use this model

            //first we create a new configuration for WeatherViewModel
            var config = new SeriesConfiguration<WeatherViewModel>();

            //now we map X and Y
            //we will use Temperature as Y
            config.Y(model => model.Temperature);
            //and DateTime as X, we convert to OADate so we can plot it easly.
            config.X(model => model.DateTime.ToOADate());

            //now we create our series with this configuration
            Series = new SeriesCollection(config) {new LineSeries {Values = new ChartValues<WeatherViewModel>()}};

            //to display a custom label we will use a formatter,
            //formatters are just functions that take a double value as parameter
            //and return a string, in this case we will convert the OADate to DateTime
            //and then use a custom date format
            XFormatter = val => DateTime.FromOADate(val).ToString("hh:mm:ss tt");
            //now for Y we are rounding and adding ° for degrees
            YFormatter = val => Math.Round(val) + " °";

            //Don't forget DataContext so we can bind these properties.
            DataContext = this;

            _timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
            _timer.Tick += TimerOnTick;
        }
开发者ID:Beanium,项目名称:Live-Charts,代码行数:34,代码来源:DynamicLine.xaml.cs

示例15: StackedColumnExample

        public StackedColumnExample()
        {
            InitializeComponent();

            SeriesCollection = new SeriesCollection
            {
                new StackedColumnSeries
                {
                    Values = new ChartValues<ObservableValue>
                    {
                        new ObservableValue(5),
                        new ObservableValue(8),
                        new ObservableValue(2),
                        new ObservableValue(4),
                        new ObservableValue(6),
                        new ObservableValue(2),
                        new ObservableValue(9),
                        new ObservableValue(3)
                    },
                    DataLabels = true
                },
                new StackedColumnSeries
                {
                    Values = new ChartValues<ObservableValue>
                    {
                        new ObservableValue(7),
                        new ObservableValue(4),
                        new ObservableValue(1),
                        new ObservableValue(7),
                        new ObservableValue(2),
                        new ObservableValue(7),
                        new ObservableValue(0),
                        new ObservableValue(3)
                    },
                    DataLabels = true
                },
                new StackedColumnSeries
                {
                    Values = new ChartValues<ObservableValue>
                    {
                        new ObservableValue(6),
                        new ObservableValue(2),
                        new ObservableValue(8),
                        new ObservableValue(2),
                        new ObservableValue(9),
                        new ObservableValue(2),
                        new ObservableValue(3),
                        new ObservableValue(3)
                    },
                    DataLabels = true
                }
            };

            Labels = new[]
            {
                "Jan", "Feb","Mar", "Apr", "May", "Jun", "Jul", "Ago"
            };

            DataContext = this;
        }
开发者ID:Chandu-cuddle,项目名称:Live-Charts,代码行数:60,代码来源:StackedColumnExample.xaml.cs


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