Use the column series to plot horizontal bars in a cartesian chart
Inheritance: Series, IColumnSeriesView
Beispiel #1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 9 "..\..\..\UcKozos\ucKimutatas.xaml"
                ((System.Windows.Controls.Grid)(target)).Loaded += new System.Windows.RoutedEventHandler(this.FrameworkElement_OnLoaded);

            #line default
            #line hidden
                return;

            case 2:
                this.Border2 = ((System.Windows.Controls.Border)(target));
                return;

            case 3:
                this.TimePowerChart = ((LiveCharts.Wpf.CartesianChart)(target));
                return;

            case 4:
                this.Adatok = ((LiveCharts.Wpf.ColumnSeries)(target));
                return;
            }
            this._contentLoaded = true;
        }
        public MixingTypes()
        {
            InitializeComponent();

            LineSeries = new LineSeries
            {
                Values = new ChartValues<ObservableValue>
                {
                    new ObservableValue(5),
                    new ObservableValue(7),
                    new ObservableValue(2),
                    new ObservableValue(3)
                },
                PointForeround = new SolidColorBrush(Color.FromRgb(50,50,50)),
                AreaLimit = 0
            };

            ScatterSeries = new ScatterSeries
            {
                Values = new ChartValues<ScatterPoint>
                {
                    new ScatterPoint(0, 2, 10),
                    new ScatterPoint(1, 1, 2),
                    new ScatterPoint(2, 3, 7),
                    new ScatterPoint(3, 4, 9)
                }
            };

            ColumnSeries = new ColumnSeries
            {
                Values = new ChartValues<ObservableValue>
                {
                    new ObservableValue(5),
                    new ObservableValue(7),
                    new ObservableValue(2),
                    new ObservableValue(3)
                }
            };

            SeriesCollection = new SeriesCollection
            {
                LineSeries,
                ScatterSeries,
                ColumnSeries
            };

            DataContext = this;
        }
        public MixingTypes()
        {
            InitializeComponent();

            LineSeries = new LineSeries
            {
                Values = new ChartValues<ObservableValue>
                {
                    new ObservableValue(5),
                    new ObservableValue(7),
                    new ObservableValue(2),
                    new ObservableValue(3),
                },
                Fill = Brushes.Transparent
            };

            BubbleSeries = new BubbleSeries
            {
                Values = new ChartValues<BubblePoint>
                {
                    new BubblePoint(0, 2, 10),
                    new BubblePoint(1, 1, 2),
                    new BubblePoint(2, 3, 7),
                    new BubblePoint(3, 4, 9)
                }
            };

            ColumnSeries = new ColumnSeries
            {
                Values = new ChartValues<ObservableValue>
                {
                    new ObservableValue(5),
                    new ObservableValue(7),
                    new ObservableValue(2),
                    new ObservableValue(3),
                }
            };

            SeriesCollection = new SeriesCollection
            {
                LineSeries,
                BubbleSeries,
                ColumnSeries
            };

            DataContext = this;
        }
        public UielementsExample()
        {
            InitializeComponent();

            var lineSeries = new LineSeries
            {
                Values = new ChartValues<double> {4, 6, 6, 3, 5},
                Fill = Brushes.Transparent,
                StrokeThickness = 4,
                PointGeometry = null
            };
            var barSeries = new ColumnSeries
            {
                Values = new ChartValues<double> { 2,6,8,9,4}
            };

            cartesianChart1.Series.Add(lineSeries);
            cartesianChart1.Series.Add(barSeries);

            cartesianChart1.VisualElements.Add(new VisualElement
            {
                X = 0.5,
                Y = 7,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Top,
                UIElement = new TextBlock //notice this property must be a wpf control
                {
                    Text = "Warning!",
                    FontWeight = FontWeights.Bold,
                    FontSize = 16,
                    Opacity = 0.6
                }
            });
            var uri = new Uri("Cartesian/UielementsExample/warning.png", UriKind.Relative);
            cartesianChart1.VisualElements.Add(new VisualElement
            {
                X = 0.5,
                Y = 6.9,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Bottom,
                UIElement = new System.Windows.Controls.Image
                {
                    Source = new BitmapImage(uri),
                    Width = 24,
                    Height = 24
                }
            });

            cartesianChart1.AxisY.Add(new Axis
            {
                IsMerged = true,
                Sections = new SectionsCollection
                {
                    new AxisSection
                    {
                        Value = 7,
                        Stroke = Brushes.YellowGreen,
                        StrokeThickness = 3,
                        StrokeDashArray = new DoubleCollection(new [] {10d})
                    }
                }
            });
            cartesianChart1.AxisX.Add(new Axis
            {
                Labels = new[] {"Jan", "Feb", "Mar", "Apr", "May"}
            });

            Panel.SetZIndex(barSeries, 0);
            Panel.SetZIndex(lineSeries, 1);

            cartesianChart1.Base.MouseMove += BaseOnMouseMove;
            cartesianChart1.DataClick += cartesianChart1_DataClick;
        }
Beispiel #5
0
        private void dashboard_Load(object sender, EventArgs e)
        {
            Func <ChartPoint, string> labelPoint = chartPoint => string.Format("{0} ({1:P})", chartPoint.Y, chartPoint.Participation);
            // Define a collection of items to display in the chart
            SeriesCollection piechartData = new SeriesCollection
            {
                new PieSeries
                {
                    Title   = "entree",
                    PushOut = 5,
                    Values  = new ChartValues <double> {
                        25
                    },
                    DataLabels = true,
                    LabelPoint = labelPoint
                },
                new PieSeries
                {
                    Title  = "sortee",
                    Values = new ChartValues <double> {
                        25
                    },
                    DataLabels = true,
                    LabelPoint = labelPoint
                },
                new PieSeries
                {
                    Title  = "stock",
                    Values = new ChartValues <double> {
                        25
                    },
                    DataLabels = true,
                    LabelPoint = labelPoint
                }
            };


            pieChart1.Series = piechartData;

            pieChart1.LegendLocation = LegendLocation.Right;


            cartesianChart1.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Values = new ChartValues <ObservablePoint>
                    {
                        new ObservablePoint(0, 10),    //First Point of First Line
                        new ObservablePoint(4, 7),     //2nd POint
                        new ObservablePoint(5, 3),     //------
                        new ObservablePoint(7, 6),
                        new ObservablePoint(10, 8)
                    },
                    PointGeometrySize = 25
                },
                new LineSeries
                {
                    Values = new ChartValues <ObservablePoint>
                    {
                        new ObservablePoint(0, 2),     //First Point of 2nd Line
                        new ObservablePoint(2, 5),     //2nd POint
                        new ObservablePoint(3, 6),     //------
                        new ObservablePoint(6, 8),
                        new ObservablePoint(10, 5)
                    },
                    PointGeometrySize = 15
                },
                new LineSeries
                {
                    Values = new ChartValues <ObservablePoint>
                    {
                        new ObservablePoint(0, 4),     //First Point of 3rd Line
                        new ObservablePoint(5, 5),     //2nd POint
                        new ObservablePoint(7, 7),     //------
                        new ObservablePoint(9, 10),
                        new ObservablePoint(10, 9)
                    },
                    PointGeometrySize = 15,
                    LineSmoothness    = 1
                }
            };
            cartesianChart2.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Values = new ChartValues <ObservablePoint>
                    {
                        new ObservablePoint(0, 1),     //First Point of First Line
                        new ObservablePoint(4, 2),     //2nd POint
                        new ObservablePoint(5, 3),     //------
                        new ObservablePoint(7, 7),
                        new ObservablePoint(10, 82)
                    },
                    PointGeometrySize = 25
                },
                new LineSeries
                {
                    Values = new ChartValues <ObservablePoint>
                    {
                        new ObservablePoint(0, 0),     //First Point of 2nd Line
                        new ObservablePoint(2, 0),     //2nd POint
                        new ObservablePoint(3, 0),     //------
                        new ObservablePoint(6, 8),
                        new ObservablePoint(10, 5)
                    },
                    PointGeometrySize = 15
                },
                new LineSeries
                {
                    Values = new ChartValues <ObservablePoint>
                    {
                        new ObservablePoint(0, 7),     //First Point of 3rd Line
                        new ObservablePoint(5, 0),     //2nd POint
                        new ObservablePoint(7, 0),     //------
                        new ObservablePoint(9, 10),
                        new ObservablePoint(10, 19)
                    },
                    PointGeometrySize = 15,
                    LineSmoothness    = 1
                }
            };


            // generate some random Y data
            int pointCount = 5;

            double[] ys1 = RandomWalk(pointCount);
            double[] ys2 = RandomWalk(pointCount);

            // create series and populate them with data
            var series1 = new LiveCharts.Wpf.ColumnSeries
            {
                Title  = "Group A",
                Values = new LiveCharts.ChartValues <double>(ys1)
            };

            var series2 = new LiveCharts.Wpf.ColumnSeries()
            {
                Title  = "Group B",
                Values = new LiveCharts.ChartValues <double>(ys2)
            };

            // display the series in the chart control
            chart1.Series.Clear();
            chart1.Series.Add(series1);
            chart1.Series.Add(series2);
        }