Exemplo n.º 1
0
        private void PlotWindRose()
        {
            if (_model.NDirs <= 0) return;
            if (_model.NBins <= 0) return;
            if (_model.FreqByDirs.Count <= 0) return;
            if (_model.FreqByBins.Count <= 0) return;

            double width = gridWindRose.ActualWidth;
            double height = gridWindRose.ActualHeight;
            double side = width;
            if (side > height)
                side = height;
            Debug.WriteLine("W: {0}, H: {1}, S: {2}", width, height, side);
            canvasWindRose.Width = side;
            canvasWindRose.Height = side;
            canvasWindRose.Children.Clear();

            var plotter = new WindRosePlotter();
            var plot = plotter.CreatePlot("W1", Colors.Gray, Colors.Red);
            for (var i = 0; i < _model.FreqByDirs.Count; i++)
            {
                var freq = _model.FreqByDirs[i];
                plot.AddPoint(i, Convert.ToDouble(freq));
            }

            var max = _model.FreqByDirs.Max();
            max = max + (max / 100) * 15;
            plotter.Plot(canvasWindRose, 0, Convert.ToDouble(max), _model.FreqByDirs.Count);
        }
Exemplo n.º 2
0
        private void PlotWindRose()
        {
            if (_model.NDirs <= 0)
            {
                return;
            }
            if (_model.NBins <= 0)
            {
                return;
            }
            if (_model.MeanVelocityPerDir.Count <= 0)
            {
                return;
            }
            if (_model.MeanVelocityPerDir.Count <= 0)
            {
                return;
            }

            double width  = gridWindRose.ActualWidth;
            double height = gridWindRose.ActualHeight;
            double side   = width;

            if (side > height)
            {
                side = height;
            }
            Debug.WriteLine("W: {0}, H: {1}, S: {2}", width, height, side);
            canvasWindRose.Width  = side;
            canvasWindRose.Height = side;
            canvasWindRose.Children.Clear();

            var plotter = new WindRosePlotter();
            var plot    = plotter.CreatePlot("W1", Colors.Gray, Colors.Red);

            for (var i = 0; i < _model.MeanVelocityPerDir.Count; i++)
            {
                var freq = _model.MeanVelocityPerDir[i];
                plot.AddPoint(i, Convert.ToDouble(freq));
            }

            var max = _model.MeanVelocityPerDir.Max();

            max = max + (max / 100) * 15;
            plotter.Plot(canvasWindRose, 0, Convert.ToDouble(max), _model.MeanVelocityPerDir.Count);
        }
Exemplo n.º 3
0
        private void chartGrid_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            double width  = chartGrid.ActualWidth;
            double height = chartGrid.ActualHeight;
            double side   = width;

            if (width > height)
            {
                side = height;
            }
            chartCanvas.Width  = side;
            chartCanvas.Height = side;
            chartCanvas.Children.Clear();
            //AddChart1();
            var plotter = new WindRosePlotter();

            plotter.CreatePlot("W1", Colors.Gray, Colors.Red)
            .AddPoint(0, 4)
            .AddPoint(1, 4.4)
            .AddPoint(2, 1.3)
            .AddPoint(3, 1.3)
            .AddPoint(4, 2.3)
            .AddPoint(5, 1.3)
            .AddPoint(6, 3.3)
            .AddPoint(7, 9)
            .AddPoint(8, 1.3)
            .AddPoint(9, 3)
            .AddPoint(10, 1)
            .AddPoint(11, 3);
            //plotter.CreatePlot("W2", Colors.Gray, Colors.Blue)
            //    .AddPoint(0, 5)
            //    .AddPoint(1, 6)
            //    .AddPoint(2, 2.3)
            //    .AddPoint(3, 3.3)
            //    .AddPoint(4, 4.3)
            //    .AddPoint(5, 3.3)
            //    .AddPoint(6, 5.3)
            //    .AddPoint(7, 9.5)
            //    .AddPoint(8, 2.3)
            //    .AddPoint(9, 4)
            //    .AddPoint(10, 2)
            //    .AddPoint(11, 5);

            plotter.Plot(chartCanvas, 0, 10, 12);
        }
Exemplo n.º 4
0
        private void chartGrid_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            double width = chartGrid.ActualWidth;
            double height = chartGrid.ActualHeight;
            double side = width;
            if (width > height)
                side = height;
            chartCanvas.Width = side;
            chartCanvas.Height = side;
            chartCanvas.Children.Clear();
            //AddChart1();
            var plotter = new WindRosePlotter();
            plotter.CreatePlot("W1", Colors.Gray, Colors.Red)
                .AddPoint(0, 4)
                .AddPoint(1, 4.4)
                .AddPoint(2, 1.3)
                .AddPoint(3, 1.3)
                .AddPoint(4, 2.3)
                .AddPoint(5, 1.3)
                .AddPoint(6, 3.3)
                .AddPoint(7, 9)
                .AddPoint(8, 1.3)
                .AddPoint(9, 3)
                .AddPoint(10, 1)
                .AddPoint(11, 3);
            //plotter.CreatePlot("W2", Colors.Gray, Colors.Blue)
            //    .AddPoint(0, 5)
            //    .AddPoint(1, 6)
            //    .AddPoint(2, 2.3)
            //    .AddPoint(3, 3.3)
            //    .AddPoint(4, 4.3)
            //    .AddPoint(5, 3.3)
            //    .AddPoint(6, 5.3)
            //    .AddPoint(7, 9.5)
            //    .AddPoint(8, 2.3)
            //    .AddPoint(9, 4)
            //    .AddPoint(10, 2)
            //    .AddPoint(11, 5);

            plotter.Plot(chartCanvas, 0, 10, 12);
        }