Ejemplo n.º 1
0
        public override async Task OnInitializing()
        {
            var model = new Chart.PlotModel {
                Title = "ScatterSeries"
            };
            var scatterSeries = new Chart.Scatter();
            var r             = new Random(314);

            for (int i = 0; i < 100; i++)
            {
                var x          = r.NextDouble();
                var y          = r.NextDouble();
                var size       = r.Next(5, 15);
                var colorValue = r.Next(100, 1000);
                scatterSeries.Data.Add(new Chart.ScatterPoint(x, y, size, colorValue));
            }

            model.Series.Add(scatterSeries);
            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(200)
            });
            await base.OnInitializing();

            await scatterBarPlotView.Add(model);
        }
Ejemplo n.º 2
0
        public override async Task OnInitializing()
        {
            var barPlotModel = new Chart.PlotModel {
                Title = "zebbleBarChart"
            };

            barPlotModel.Series.Add(new Chart.Bar(new List <Chart.Item>
            {
                new Chart.Item(25),
                new Chart.Item(137),
                new Chart.Item(13),
                new Chart.Item(40),
            }));
            barPlotModel.Axes.Add(new CategoryAxis
            {
                Position    = AxisPosition.Left,
                Key         = "CakeAxis",
                ItemsSource = new[]
                {
                    "Apple cake",
                    "Baumkuchen",
                    "Bundt Cake",
                    "Chocolate cake",
                    "Carrot cake"
                }
            });
            await base.OnInitializing();

            await barPlotView.Add(barPlotModel);
        }
Ejemplo n.º 3
0
        public override async Task OnInitializing()
        {
            var linePlotModel = new Chart.PlotModel {
                Title = "zebbleLineChart"
            };

            linePlotModel.Series.Add(new Chart.Line(new List <Chart.DataPoint>
            {
                new Chart.DataPoint(0.0, 6.0),
                new Chart.DataPoint(1.4, 2.1),
                new Chart.DataPoint(2.0, 4.2),
                new Chart.DataPoint(3.3, 2.3),
                new Chart.DataPoint(4.7, 7.4),
                new Chart.DataPoint(6.0, 6.2),
            }));
            await base.OnInitializing();

            linePlotModel.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, Title = "Temperature", Unit = "°C"
            });
            linePlotModel.Axes.Add(new LinearAxis {
                Position = AxisPosition.Bottom, Title = "Date"
            });
            await linePlotView.Add(linePlotModel);
        }
Ejemplo n.º 4
0
        public override async Task OnInitializing()
        {
            var areaTemperatures = new[] { 5, 0, 7, 7, 4, 3, 5, 5, 11, 4, 2, 3, 2, 1, 0, 2, -1, 0, 0, -3, -6, -13, -10, -10, 0, -4, -5, -4, 3, 0, -5 };

            var areadataPoints = new List <Chart.DataPoint>();

            for (int i = 0; i < areaTemperatures.Length; i++)
            {
                areadataPoints.Add(new Chart.DataPoint(i + 1, areaTemperatures[i]));
            }
            var twoColorAreaPlotModel = new Chart.PlotModel {
                Title = "TwoColorAreaChart"
            };

            twoColorAreaPlotModel.Series.Add(new Chart.TwoColorArea()
            {
                Color  = Colors.Tomato,
                Color2 = Colors.LightBlue,
                Limit  = -1,
                Data   = areadataPoints
            });
            twoColorAreaPlotModel.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, Title = "Temperature", Unit = "°C", ExtraGridlines = new[] { 0.0 }
            });
            twoColorAreaPlotModel.Axes.Add(new LinearAxis {
                Position = AxisPosition.Bottom, Title = "Date"
            });
            await base.OnInitializing();

            await twoColorAreaPlotView.Add(twoColorAreaPlotModel);
        }
Ejemplo n.º 5
0
        public override async Task OnInitializing()
        {
            double x0 = -3.1;
            double x1 = 3.1;
            double y0 = -3;
            double y1 = 3;

            //generate values
            Func <double, double, double> peaks = (x, y) =>
                                                  3 * (1 - x) * (1 - x) * Math.Exp(-(x * x) - (y + 1) * (y + 1))
                                                  - 10 * (x / 5 - x * x * x - y * y * y * y * y) * Math.Exp(-x * x - y * y)
                                                  - 1.0 / 3 * Math.Exp(-(x + 1) * (x + 1) - y * y);
            var xx = ArrayBuilder.CreateVector(-3, 3, 0.05);
            var yy = ArrayBuilder.CreateVector(-3.1, 3.1, 0.05);

            var contourPlotModel = new Chart.PlotModel {
                Title = "zebbleContourChart"
            };

            contourPlotModel.Series.Add(new Chart.Contour()
            {
                Data = ArrayBuilder.Evaluate(peaks, xx, yy),
                ColumnCoordinates = xx,
                RowCoordinates    = yy
            });
            await base.OnInitializing();

            await contourPlotView.Add(contourPlotModel);
        }
Ejemplo n.º 6
0
        public override async Task OnInitializing()
        {
            var columnPlotModel = new Chart.PlotModel {
                Title = "zebbleColumnChart"
            };

            columnPlotModel.Series.Add(new Chart.Column(new List <Chart.Item>
            {
                new Chart.Item(25),
                new Chart.Item(137),
                new Chart.Item(13),
                new Chart.Item(40),
            }));
            columnPlotModel.Axes.Add(new CategoryAxis
            {
                Position    = AxisPosition.Bottom,
                Key         = "CakeAxis",
                ItemsSource = new[]
                {
                    "A",
                    "B",
                    "C",
                    "D",
                    "E"
                }
            });
            await base.OnInitializing();

            await columnPlotView.Add(columnPlotModel);
        }
Ejemplo n.º 7
0
        public override async Task OnInitializing()
        {
            var rectangleBarPlotModel = new Chart.PlotModel {
                Title = "RectangleBarChart"
            };

            rectangleBarPlotModel.Series.Add(new Chart.RectangleBar("RectangleBarSeries 1", new List <Chart.RectangleBarItem>
            {
                new Chart.RectangleBarItem()
                {
                    X0 = 2, X1 = 8, Y0 = 1, Y1 = 4
                },
                new Chart.RectangleBarItem()
                {
                    X0 = 6, X1 = 12, Y0 = 6, Y1 = 7
                },
            }));

            rectangleBarPlotModel.Series.Add(new Chart.RectangleBar("RectangleBarSeries 2", new List <Chart.RectangleBarItem>
            {
                new Chart.RectangleBarItem()
                {
                    X0 = 2, X1 = 8, Y0 = -4, Y1 = -1
                },
                new Chart.RectangleBarItem()
                {
                    X0 = 6, X1 = 12, Y0 = -7, Y1 = -6
                },
            }));
            await base.OnInitializing();

            await rectangleBarPlotView.Add(rectangleBarPlotModel);
        }
Ejemplo n.º 8
0
        public override async Task OnInitializing()

        {
            var highLowPlotModel = new Chart.PlotModel {
                Title = "zebbleHighLowChart"
            };
            var s1    = new Chart.HighLow();
            var r     = new Random(314);
            var price = 100.0;

            for (int x = 0; x < 24; x++)
            {
                price = price + r.NextDouble() + 0.1;
                var high  = price + 10 + r.NextDouble() * 10;
                var low   = price - (10 + r.NextDouble() * 10);
                var open  = low + r.NextDouble() * (high - low);
                var close = low + r.NextDouble() * (high - low);
                s1.Data.Add(new Chart.HighLowItem(x, high, low, open, close));
            }

            highLowPlotModel.Series.Add(s1);
            highLowPlotModel.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, MaximumPadding = 0.3, MinimumPadding = 0.3
            });
            await base.OnInitializing();

            await highLowPlotView.Add(highLowPlotModel);
        }
Ejemplo n.º 9
0
        public override async Task OnInitializing()
        {
            var intervalBarPlotModel = new Chart.PlotModel {
                Title = "IntervalBarSeries"
            };

            var s1 = new Chart.IntervalBar {
                Title = "IntervalBarSeries 1"
            };

            s1.Data.Add(new IntervalBarItem {
                Start = 6, End = 8
            });
            s1.Data.Add(new IntervalBarItem {
                Start = 4, End = 8
            });
            s1.Data.Add(new IntervalBarItem {
                Start = 5, End = 11
            });
            s1.Data.Add(new IntervalBarItem {
                Start = 4, End = 12
            });
            intervalBarPlotModel.Series.Add(s1);
            var s2 = new Chart.IntervalBar {
                Title = "IntervalBarSeries 2"
            };

            s2.Data.Add(new IntervalBarItem {
                Start = 8, End = 9
            });
            s2.Data.Add(new IntervalBarItem {
                Start = 8, End = 10
            });
            s2.Data.Add(new IntervalBarItem {
                Start = 11, End = 12
            });
            s2.Data.Add(new IntervalBarItem {
                Start = 12, End = 12.5
            });
            intervalBarPlotModel.Series.Add(s2);

            var categoryAxis = new CategoryAxis {
                Position = AxisPosition.Left
            };

            categoryAxis.Labels.Add("Activity A");
            categoryAxis.Labels.Add("Activity B");
            categoryAxis.Labels.Add("Activity C");
            categoryAxis.Labels.Add("Activity D");
            var valueAxis = new LinearAxis {
                Position = AxisPosition.Bottom, MinimumPadding = 0.1, MaximumPadding = 0.1
            };

            intervalBarPlotModel.Axes.Add(categoryAxis);
            intervalBarPlotModel.Axes.Add(valueAxis);
            await base.OnInitializing();

            await intervalBarPlotView.Add(intervalBarPlotModel);
        }
Ejemplo n.º 10
0
        public override async Task OnInitializing()
        {
            var functionPlotModel = new Chart.PlotModel {
                Title = "FunctionChart"
            };

            functionPlotModel.Series.Add(new Chart.Function(Math.Sin, -10, 10, 0.1, "sin(x)"));
            functionPlotModel.Series.Add(new Chart.Function(Math.Cos, -10, 10, 0.1, "cos(x)"));
            functionPlotModel.Series.Add(new Chart.Function(t => 5 * Math.Cos(t), t => 5 * Math.Sin(t), 0, 2 * Math.PI, 1000, "cos(t),sin(t)"));
            await base.OnInitializing();

            await functionPlotView.Add(functionPlotModel);
        }
Ejemplo n.º 11
0
        public override async Task OnInitializing()
        {
            var heatMapPlotModel = new Chart.PlotModel {
                Title = "HeatMapSeries"
            };

            // Color axis (the X and Y axes are generated automatically)
            heatMapPlotModel.Axes.Add(new LinearColorAxis
            {
                Palette = OxyPalettes.Rainbow(100)
            });

            // generate 1d normal distribution
            var singleData = new double[100];

            for (int x = 0; x < 100; ++x)
            {
                singleData[x] = Math.Exp((-1.0 / 2.0) * Math.Pow(((double)x - 50.0) / 20.0, 2.0));
            }

            // generate 2d normal distribution
            var data = new double[100, 100];

            for (int x = 0; x < 100; ++x)
            {
                for (int y = 0; y < 100; ++y)
                {
                    data[y, x] = singleData[x] * singleData[(y + 30) % 100] * 100;
                }
            }

            var heatMapSeries = new Chart.HeatMap
            {
                X0           = 0,
                X1           = 99,
                Y0           = 0,
                Y1           = 99,
                Interpolate  = true,
                RenderMethod = HeatMapRenderMethod.Bitmap,
                Data         = data
            };


            heatMapPlotModel.Series.Add(heatMapSeries);
            await base.OnInitializing();

            await heatMapPlotView.Add(heatMapPlotModel);
        }
Ejemplo n.º 12
0
        public override async Task OnInitializing()
        {
            var       random       = new Random(31);
            const int boxes        = 10;
            var       boxPlotModel = new Chart.PlotModel {
                Title = "zebbleBoxChart"
            };
            var list = new List <Chart.BoxPlotItem>();

            for (var i = 0; i < boxes; i++)
            {
                double myxx   = i;
                var    points = 5 + random.Next(15);
                var    values = new List <double>();
                for (var j = 0; j < points; j++)
                {
                    values.Add(random.Next(0, 20));
                }

                values.Sort();
                var    median       = Chart.Box.GetMedian(values);
                var    mean         = values.Average();
                int    r            = values.Count % 2;
                double firstQuartil = Chart.Box.GetMedian(values.Take((values.Count + r) / 2));
                double thirdQuartil = Chart.Box.GetMedian(values.Skip((values.Count - r) / 2));

                var iqr          = thirdQuartil - firstQuartil;
                var step         = iqr * 1.5;
                var upperWhisker = thirdQuartil + step;
                upperWhisker = values.Where(v => v <= upperWhisker).Max();
                var lowerWhisker = firstQuartil - step;
                lowerWhisker = values.Where(v => v >= lowerWhisker).Min();

                var outliers = new[] { upperWhisker + random.Next(1, 10), lowerWhisker - random.Next(1, 10) };
                list.Add(new Chart.BoxPlotItem(myxx, lowerWhisker, firstQuartil, median, thirdQuartil, upperWhisker));
            }
            boxPlotModel.Series.Add(new Chart.Box(list));
            boxPlotModel.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left
            });
            boxPlotModel.Axes.Add(new LinearAxis {
                Position = AxisPosition.Bottom, MinimumPadding = 0.1, MaximumPadding = 0.1
            });
            await base.OnInitializing();

            await boxPlotView.Add(boxPlotModel);
        }
Ejemplo n.º 13
0
        public override async Task OnInitializing()
        {
            var piePlotModel = new Chart.PlotModel {
                Title = "zebblePieChart"
            };

            piePlotModel.Series.Add(new Chart.Pie(new List <Chart.PieSlice>
            {
                new Chart.PieSlice("Africa", 1030),
                new Chart.PieSlice("Americas", 929),
                new Chart.PieSlice("Asia", 4157),
                new Chart.PieSlice("Europe", 739),
                new Chart.PieSlice("Oceania", 35)
            }));
            await base.OnInitializing();

            await piePlotView.Add(piePlotModel);
        }
Ejemplo n.º 14
0
        public override async Task OnInitializing()
        {
            var areaPlotModel = new Chart.PlotModel {
                Title = "zebbleAreaChart"
            };

            areaPlotModel.Series.Add(new Chart.Area(new List <Chart.DataPoint>
            {
                new Chart.DataPoint(0, 50),
                new Chart.DataPoint(10, 40),
                new Chart.DataPoint(20, 60),
                new Chart.DataPoint(0, 60),
                new Chart.DataPoint(5, 80),
                new Chart.DataPoint(20, 70)
            }));
            await base.OnInitializing();

            await areaPlotView.Add(areaPlotModel);
        }
Ejemplo n.º 15
0
        public override async Task OnInitializing()
        {
            var startTimeValue       = DateTimeAxis.ToDouble(new DateTime(2016, 1, 1));
            var candleStickPlotModel = new Chart.PlotModel {
                Title = "zebbleCandleStick"
            };

            candleStickPlotModel.Axes.Add(new DateTimeAxis {
                Position = AxisPosition.Bottom, Minimum = startTimeValue - 7, Maximum = startTimeValue + 7
            });
            candleStickPlotModel.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left
            });
            var series = new Chart.CandleStick();

            series.Data.Add(new Chart.HighLowItem(startTimeValue, 100, 80, 92, 94));
            series.Data.Add(new Chart.HighLowItem(startTimeValue + 1, 102, 77, 94, 93));
            candleStickPlotModel.Series.Add(series);
            await base.OnInitializing();

            candleStickPlotView.Add(candleStickPlotModel);
        }
Ejemplo n.º 16
0
        public override async Task OnInitializing()
        {
            var temperatures = new[] { 5, 0, 7, 7, 4, 3, 5, 5, 11, 4, 2, 3, 2, 1, 0, 2, -1, 0, 0, -3, -6, -13, -10, -10, 0, -4, -5, -4, 3, 0, -5 };
            var dataPoints   = new List <Chart.DataPoint>();

            for (int i = 0; i < temperatures.Length; i++)
            {
                dataPoints.Add(new Chart.DataPoint(i + 1, temperatures[i]));
            }
            var twoColorLinePlotModel = new Chart.PlotModel {
                Title = "TwoColorLineChart"
            };

            twoColorLinePlotModel.Series.Add(new Chart.TwoColorLine()
            {
                Color  = Colors.Red,
                Color2 = Colors.LightBlue,
                Limit  = 0,
                Data   = dataPoints
            });
            await base.OnInitializing();

            await twoColorLinePlotView.Add(twoColorLinePlotModel);
        }
Ejemplo n.º 17
0
        public override async Task OnInitializing()
        {
            var errorColumnPlotModel = new Chart.PlotModel {
                Title = "ErrorColumnChart"
            };

            errorColumnPlotModel.Series.Add(new Chart.ErrorColumn()
            {
                Title = "Series 1",
                Data  = new List <Chart.ErrorColumnItem>
                {
                    new Chart.ErrorColumnItem()
                    {
                        Value = 25, Error = 2
                    },
                    new Chart.ErrorColumnItem()
                    {
                        Value = 137, Error = 25
                    },
                    new Chart.ErrorColumnItem()
                    {
                        Value = 18, Error = 4
                    },
                    new Chart.ErrorColumnItem()
                    {
                        Value = 40, Error = 29
                    },
                }
            });

            errorColumnPlotModel.Series.Add(new Chart.ErrorColumn()
            {
                Title = "Series 2",
                Data  = new List <Chart.ErrorColumnItem>
                {
                    new Chart.ErrorColumnItem()
                    {
                        Value = 35, Error = 20
                    },
                    new Chart.ErrorColumnItem()
                    {
                        Value = 17, Error = 7
                    },
                    new Chart.ErrorColumnItem()
                    {
                        Value = 118, Error = 44
                    },
                    new Chart.ErrorColumnItem()
                    {
                        Value = 49, Error = 29
                    },
                }
            });

            var categoryAxis = new CategoryAxis {
                Position = AxisPosition.Bottom
            };

            categoryAxis.Labels.Add("Category A");
            categoryAxis.Labels.Add("Category B");
            categoryAxis.Labels.Add("Category C");
            categoryAxis.Labels.Add("Category D");

            var valueAxis = new LinearAxis {
                Position = AxisPosition.Left, MinimumPadding = 0, MaximumPadding = 0.06, AbsoluteMinimum = 0
            };

            errorColumnPlotModel.Axes.Add(categoryAxis);
            errorColumnPlotModel.Axes.Add(valueAxis);

            await base.OnInitializing();

            await ErrorColumnPlotView.Add(errorColumnPlotModel);
        }