コード例 #1
2
ファイル: ViewChart.cs プロジェクト: kajzur/language-worker
        public ViewChart(Group current)
        {
            this.model = new PlotModel("Postęp nauki dla "+current.Name);
            LineSeries basicSerie =  new LineSeries("Postęp nauki");
            LinearAxis ax = new LinearAxis();
            ax.Unit = "%";
            ax.Title = "Poprawne odpowiedzi";
            model.Axes.Add(ax);

            SqlAccess sql = new SqlAccess();
            basicSerie.Smooth = true;
            List<double> list = sql.GetStatsForGroup(current);
            int i = 1;
            if(list.Count>0)
            basicSerie.Points.Add(new DataPoint(0.0,0));
            basicSerie.MarkerType = MarkerType.Circle;
            basicSerie.MarkerSize = 3;
            basicSerie.SelectionMode = SelectionMode.Single;

            foreach (double d in list)
            {

                basicSerie.Points.Add(new DataPoint(i,d));
                i++;
            }

            this.model.Series.Add(basicSerie);
        }
コード例 #2
1
ファイル: Window1.xaml.cs プロジェクト: airaultf/ProjetDotNet
 public static PlotModel LineSerieswithcustomTrackerFormatString()
 {
     var plotModel1 = new PlotModel();
     plotModel1.Subtitle = "TrackerFormatString = \"X={2:0.0} Y={4:0.0}\"";
     plotModel1.Title = "LineSeries with custom TrackerFormatString";
     var linearAxis1 = new LinearAxis();
     linearAxis1.Position = AxisPosition.Bottom;
     plotModel1.Axes.Add(linearAxis1);
     var linearAxis2 = new LinearAxis();
     plotModel1.Axes.Add(linearAxis2);
     var lineSeries1 = new LineSeries();
     lineSeries1.TrackerFormatString = "X={2:0.0} Y={4:0.0}";
     lineSeries1.Points.Add(new DataPoint(0, 20));
     lineSeries1.Points.Add(new DataPoint(10, 21));
     lineSeries1.Points.Add(new DataPoint(20, 24));
     lineSeries1.Points.Add(new DataPoint(30, 22));
     lineSeries1.Points.Add(new DataPoint(40, 17));
     lineSeries1.Points.Add(new DataPoint(50, 21));
     lineSeries1.Points.Add(new DataPoint(60, 23));
     lineSeries1.Points.Add(new DataPoint(70, 27));
     lineSeries1.Points.Add(new DataPoint(80, 27));
     lineSeries1.Points.Add(new DataPoint(90, 22));
     lineSeries1.Points.Add(new DataPoint(100, 25));
     plotModel1.Series.Add(lineSeries1);
     return plotModel1;
 }
コード例 #3
1
 public void AddLine(DataPoint[] data)
 {
     var lineSeries = new LineSeries();
     lineSeries.ItemsSource = data;
     Plot.Series.Add(lineSeries);
     var x = data.Select(d => d.X);
     _xAxis = new LinearAxis { Position = OxyPlot.Axes.AxisPosition.Bottom }; //, Minimum = x.Min(), Maximum = x.Max() };
     Plot.Axes.Add(_xAxis);
 }
コード例 #4
0
		private RadCartesianChartView createChart(){
			RadCartesianChartView chart = new RadCartesianChartView(this.Activity);

			CategoricalAxis horizontalAxis = new CategoricalAxis();
			chart.HorizontalAxis = horizontalAxis;

			LinearAxis vertical1 = new LinearAxis();
			vertical1.LabelFormat = "%.0f";

			LinearAxis vertical2 = new LinearAxis();
			vertical2.LabelFormat = "%.0f";

			BarSeries series1 = new BarSeries();

			ArrayList data = this.getData();

			series1.ValueBinding = new ValueBinding1();
			series1.CategoryBinding = new CategoryBinding();
			series1.VerticalAxis = vertical1;
			series1.Data = data;

			chart.Series.Add(series1);

			LineSeries series2 = new LineSeries();

			series2.ValueBinding = new ValueBinding2();
			series2.CategoryBinding = new CategoryBinding();
			series2.VerticalAxis = (vertical2);
			vertical2.HorizontalLocation = AxisHorizontalLocation.Right;
			series2.Data = data;

			chart.Series.Add(series2);

			return chart;
		}
コード例 #5
0
        /// <summary>
        /// Funkcja przygotowujaca układ współrzędnych, ustala skale osi, tytuły, legendę i kolorystykę układu
        /// </summary>
        /// <param name="xMax"></param>
        /// <param name="yMax"></param>
        /// <param name="titleX"></param>
        /// <param name="titleY"></param>
        public void SetUpLegend(double xMax, double yMax, string titleX, string titleY)
        {
            plotModel.LegendTitle = "Legenda";
            plotModel.LegendOrientation = LegendOrientation.Horizontal;
            plotModel.LegendPlacement = LegendPlacement.Outside;
            plotModel.LegendPosition = LegendPosition.BottomRight;
            plotModel.LegendBackground = OxyColor.FromAColor(200, OxyPlot.OxyColors.White);
            plotModel.LegendBorder = OxyColors.Black;

            var xAxis = new LinearAxis()
            {
                Position = AxisPosition.Bottom,
                Title = titleX,
                Minimum = 0,
                Maximum = xMax
            };
            plotModel.Axes.Add(xAxis);

            var yAxis = new LinearAxis()
            {
                Position = AxisPosition.Left,
                Title = titleY,
                Minimum = 0,
                Maximum = yMax
            };
            plotModel.Axes.Add(yAxis);
        }
コード例 #6
0
        public BarChartMono()
        {
            InitializeComponent();

            plotView1.Dock = DockStyle.Fill;
            plotView1.Model = new PlotModel();

            chart = plotView1.Model;
            chart.IsLegendVisible = false;
            chart.Background = OxyColors.White;

            XAxis = new CategoryAxis();
            XAxis.MajorGridlineThickness = 0;
            XAxis.Position = AxisPosition.Bottom;

            YAxis = new LinearAxis();
            YAxis.MajorGridlineThickness = 0;
            YAxis.TextColor = OxyColors.Transparent;
            YAxis.TickStyle = OxyPlot.Axes.TickStyle.None;

            // Chart area.
            //chartArea.AxisX.MajorGrid.LineWidth = 0;
            //chartArea.AxisY.MajorGrid.LineWidth = 0;

            //chartArea.AxisX.IsLabelAutoFit = true;
            //chartArea.AxisX.Interval = 1;

            //chartArea.AxisY.LabelStyle.Enabled = false;
            //chartArea.AxisY.IsLabelAutoFit = true;

            chart.Axes.Add(XAxis);
            chart.Axes.Add(YAxis);
        }
コード例 #7
0
		private RadCartesianChartView createChart(){
			//Create the Chart View
			RadCartesianChartView chart = new RadCartesianChartView(this.Activity);

			//Create the bar series and attach axes and value bindings.
			BarSeries barSeries = new BarSeries();

			barSeries.ValueBinding  = new ValueBinding();
			barSeries.CategoryBinding = new CategoryBinding();

			LinearAxis verticalAxis = new LinearAxis();
			//The values in the linear axis will not have values after the decimal point.
			verticalAxis.LabelFormat = "%.0f";
			CategoricalAxis horizontalAxis = new CategoricalAxis();
			horizontalAxis.LabelFitMode = AxisLabelFitMode.MultiLine;

			barSeries.VerticalAxis = verticalAxis;
			barSeries.HorizontalAxis = horizontalAxis;

			//Bind series to data
			barSeries.Data = this.getData();

			//Add series to chart
			chart.Series.Add(barSeries);

			ChartSelectionBehavior sb = new ChartSelectionBehavior();
			sb.DataPointsSelectionMode = ChartSelectionMode.Single;

			chart.Behaviors.Add(sb);

			return chart;
		}
コード例 #8
0
        public static PlotModel BarSeries()
        {
            var model = new PlotModel
                            {
                                Title = "BarSeries",
                                LegendPlacement = LegendPlacement.Outside,
                                LegendPosition = LegendPosition.BottomCenter,
                                LegendOrientation = LegendOrientation.Horizontal,
                                LegendBorderThickness = 0
                            };

            var s1 = new BarSeries { Title = "Series 1", StrokeColor = OxyColors.Black, StrokeThickness = 1 };
            s1.Items.Add(new BarItem { Value = 25 });
            s1.Items.Add(new BarItem { Value = 137 });
            s1.Items.Add(new BarItem { Value = 18 });
            s1.Items.Add(new BarItem { Value = 40 });

            var s2 = new BarSeries { Title = "Series 2", StrokeColor = OxyColors.Black, StrokeThickness = 1 };
            s2.Items.Add(new BarItem { Value = 12 });
            s2.Items.Add(new BarItem { Value = 14 });
            s2.Items.Add(new BarItem { Value = 120 });
            s2.Items.Add(new BarItem { Value = 26 });

            var categoryAxis = new CategoryAxis { Position = AxisPosition.Left };
            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.Bottom, MinimumPadding = 0, MaximumPadding = 0.06, AbsoluteMinimum = 0 };
            model.Series.Add(s1);
            model.Series.Add(s2);
            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);
            return model;
        }
コード例 #9
0
        public static PlotModel MinuteData_DateTimeAxis()
        {
            var pm = new PlotModel { Title = "Minute Data (DateTimeAxis)" };

            var timeSpanAxis1 = new DateTimeAxis { Position = AxisPosition.Bottom, StringFormat = "hh:mm" };
            pm.Axes.Add(timeSpanAxis1);
            var linearAxis1 = new LinearAxis { Position = AxisPosition.Left };
            pm.Axes.Add(linearAxis1);
            var candleStickSeries = new CandleStickSeries
            {
                CandleWidth = 6,
                Color = OxyColors.Black,
                IncreasingFill = OxyColors.DarkGreen,
                DecreasingFill = OxyColors.Red,
                DataFieldX = "Time",
                DataFieldHigh = "H",
                DataFieldLow = "L",
                DataFieldOpen = "O",
                DataFieldClose = "C",
                TrackerFormatString = "High: {2:0.00}\nLow: {3:0.00}\nOpen: {4:0.00}\nClose: {5:0.00}",
                ItemsSource = lst
            };
            pm.Series.Add(candleStickSeries);
            return pm;
        }
コード例 #10
0
ファイル: MainPage.xaml.cs プロジェクト: shyshi/App4
 private void setModel()
 {
     LinearAxis lineAxis1 = new LinearAxis();
     LinearAxis lineAxis2 = new LinearAxis();
     LinearAxis lineAxis3 = new LinearAxis();
     LinearAxis lineAxis4 = new LinearAxis();
     lineAxis1.Position = AxisPosition.Bottom;
     lineAxis2.Position = AxisPosition.Left;
     lineAxis3.Position = AxisPosition.Bottom;
     lineAxis4.Position = AxisPosition.Left;
     LogarithmicAxis logAxis1 = new LogarithmicAxis();
     LogarithmicAxis logAxis2 = new LogarithmicAxis();
     LogarithmicAxis logAxis3 = new LogarithmicAxis();
     LogarithmicAxis logAxis4 = new LogarithmicAxis();
     logAxis1.Position = AxisPosition.Bottom;
     logAxis2.Position = AxisPosition.Left;
     logAxis3.Position = AxisPosition.Bottom;
     logAxis4.Position = AxisPosition.Left;
     this.doublelogModel.MyModel.Axes.Add(logAxis1);
     this.doublelogModel.MyModel.Axes.Add(logAxis2);
     this.doublelineModel.MyModel.Axes.Add(lineAxis1);
     this.doublelineModel.MyModel.Axes.Add(lineAxis2);
     this.logxModel.MyModel.Axes.Add(logAxis3);
     this.logxModel.MyModel.Axes.Add(lineAxis4);
     this.logyModel.MyModel.Axes.Add(lineAxis3);
     this.logyModel.MyModel.Axes.Add(logAxis4);
 }
コード例 #11
0
        private RadCartesianChartView createChart()
        {
            //Create the Chart View
            RadCartesianChartView chart = new RadCartesianChartView(this.Activity);

            LinearAxis verticalAxis = new LinearAxis();
            //The values in the linear axis will not have values after the decimal point.
            verticalAxis.LabelFormat = "%.0f";
            CategoricalAxis horizontalAxis = new CategoricalAxis();
            chart.VerticalAxis = verticalAxis;
            chart.HorizontalAxis = horizontalAxis;

            for (int i = 0; i < 3; i++) {
                //Create the spline area series and attach axes and value bindings.
                SplineAreaSeries areaSeries = new SplineAreaSeries();

                //We want to stack the different area series.
                areaSeries.CombineMode = ChartSeriesCombineMode.Stack;

                areaSeries.ValueBinding = new ValueBinding();
                areaSeries.CategoryBinding = new CategoryBinding();

                //Bind series to data
                areaSeries.Data = this.getData();

                //Add series to chart
                chart.Series.Add(areaSeries);
            }

            return chart;
        }
コード例 #12
0
        public static PlotModel TimeSpanaxisPlotModel()
        {
            var start = new TimeSpan(0, 0, 0, 0);
            var end = new TimeSpan(0, 24, 0, 0);
            double increment = 3600;

            // Create a random data collection
            var r = new Random(7);
            var data = new Collection<TimeValue>();
            var current = start;
            while (current <= end)
            {
                data.Add(new TimeValue { Time = current, Value = r.NextDouble() });
                current = current.Add(new TimeSpan(0, 0, (int)increment));
            }

            var plotModel1 = new PlotModel { Title = "TimeSpan axis" };
            var timeSpanAxis1 = new TimeSpanAxis { Position = AxisPosition.Bottom, StringFormat = "h:mm" };
            plotModel1.Axes.Add(timeSpanAxis1);
            var linearAxis1 = new LinearAxis { Position = AxisPosition.Left };
            plotModel1.Axes.Add(linearAxis1);
            var lineSeries1 = new LineSeries
            {
                Color = OxyColor.FromArgb(255, 78, 154, 6),
                MarkerFill = OxyColor.FromArgb(255, 78, 154, 6),
                MarkerStroke = OxyColors.ForestGreen,
                MarkerType = MarkerType.Plus,
                StrokeThickness = 1,
                DataFieldX = "Time",
                DataFieldY = "Value",
                ItemsSource = data
            };
            plotModel1.Series.Add(lineSeries1);
            return plotModel1;
        }
コード例 #13
0
        public static PlotModel IntervalBarSeries()
        {
            var model = new PlotModel { Title = "IntervalBarSeries", LegendPlacement = LegendPlacement.Outside };

            var s1 = new IntervalBarSeries { Title = "IntervalBarSeries 1" };
            s1.Items.Add(new IntervalBarItem { Start = 6, End = 8 });
            s1.Items.Add(new IntervalBarItem { Start = 4, End = 8 });
            s1.Items.Add(new IntervalBarItem { Start = 5, End = 11 });
            s1.Items.Add(new IntervalBarItem { Start = 4, End = 12 });
            model.Series.Add(s1);
            var s2 = new IntervalBarSeries { Title = "IntervalBarSeries 2" };
            s2.Items.Add(new IntervalBarItem { Start = 8, End = 9 });
            s2.Items.Add(new IntervalBarItem { Start = 8, End = 10 });
            s2.Items.Add(new IntervalBarItem { Start = 11, End = 12 });
            s2.Items.Add(new IntervalBarItem { Start = 12, End = 12.5 });
            model.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 };
            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);
            return model;
        }
コード例 #14
0
        public GraphSalesRank()
        {
            model = new PlotModel();
              model.Title = "SalesRank";

              DateTimeAxis axisX = new DateTimeAxis();
              axisX.Position = AxisPosition.Bottom;
              axisX.Title = "Date";
              model.Axes.Add(axisX);

              LinearAxis axisY = new LinearAxis();
              axisY.Position = AxisPosition.Left;
              axisY.Minimum = 0;
              axisY.Title = "SalesRank";
              model.Axes.Add(axisY);

              series = new LineSeries();
              series.Title = string.Format("ASIN: {0}", this.Asin);

              this.Asin = "0061670898";

              model.Series.Add(series);

              InitializeComponent();

              oxyPlotView.Model = model;
        }
コード例 #15
0
ファイル: Issues.cs プロジェクト: Celderon/oxyplot
 public static PlotModel GridLinesBothDifferentColors()
 {
     var plotModel1 = new PlotModel
     {
         Title = "Major grid lines in front of minor",
         Subtitle = "Minor grid lines should be below major grid lines"
     };
     var leftAxis = new LinearAxis
     {
         MajorGridlineStyle = LineStyle.Solid,
         MajorGridlineColor = OxyColors.Black,
         MajorGridlineThickness = 4,
         MinorGridlineStyle = LineStyle.Solid,
         MinorGridlineColor = OxyColors.LightBlue,
         MinorGridlineThickness = 4,
     };
     plotModel1.Axes.Add(leftAxis);
     var bottomAxis = new LinearAxis
     {
         Position = AxisPosition.Bottom,
         MajorGridlineStyle = LineStyle.Solid,
         MajorGridlineColor = OxyColors.Black,
         MajorGridlineThickness = 4,
         MinorGridlineStyle = LineStyle.Solid,
         MinorGridlineColor = OxyColors.LightBlue,
         MinorGridlineThickness = 4,
     };
     plotModel1.Axes.Add(bottomAxis);
     return plotModel1;
 }
コード例 #16
0
ファイル: App.cs プロジェクト: Celderon/oxyplot
        public static Page GetMainPage()
        {
            var plotModel = new PlotModel
            {
                Title = "OxyPlot in Xamarin.Forms",
                Subtitle = string.Format("OS: {0}, Idiom: {1}", Device.OS, Device.Idiom),
                Background = OxyColors.LightYellow,
                PlotAreaBackground = OxyColors.LightGray
            };
            var categoryAxis = new CategoryAxis { Position = AxisPosition.Bottom };
            var valueAxis = new LinearAxis { Position = AxisPosition.Left, MinimumPadding = 0 };
            plotModel.Axes.Add(categoryAxis);
            plotModel.Axes.Add(valueAxis);
            var series = new ColumnSeries();
            series.Items.Add(new ColumnItem { Value = 3 });
            series.Items.Add(new ColumnItem { Value = 14 });
            series.Items.Add(new ColumnItem { Value = 11 });
            series.Items.Add(new ColumnItem { Value = 12 });
            series.Items.Add(new ColumnItem { Value = 7 });
            plotModel.Series.Add(series);

            return new ContentPage
            {
                Padding = new Thickness(0, 20, 0, 0),
                Content = new PlotView
                {
                    Model = plotModel,
                    VerticalOptions = LayoutOptions.Fill,
                    HorizontalOptions = LayoutOptions.Fill,
                },
            };
        }
コード例 #17
0
        private RadCartesianChartView createChart()
        {
            //Create the Chart View
            RadCartesianChartView chart = new RadCartesianChartView(this.Activity);

            //Create the bar series and attach axes and value bindings.
            BarSeries barSeries = new BarSeries();

            barSeries.ValueBinding  = new ValueBinding();
            barSeries.CategoryBinding = new CategoryBinding();

            LinearAxis verticalAxis = new LinearAxis();
            //The values in the linear axis will not have values after the decimal point.
            verticalAxis.LabelFormat = "%.0f";
            CategoricalAxis horizontalAxis = new CategoricalAxis();
            barSeries.VerticalAxis = verticalAxis;
            barSeries.HorizontalAxis = horizontalAxis;

            //Bind series to data
            barSeries.Data  = this.getData();

            //Add series to chart
            chart.Series.Add(barSeries);

            CartesianPlotBandAnnotation annotation = new CartesianPlotBandAnnotation(verticalAxis, 6, 8);
            chart.Annotations.Add(annotation);
            annotation.FillColor = Color.Argb(150, 0, 148, 255);
            annotation.StrokeColor = Color.Argb(150, 0, 74, 127);
            annotation.StrokeColor = 4;
            annotation.ZIndex = 1001;

            return chart;
        }
コード例 #18
0
        public PlotViewModel(LineMode mode, int dataPointsCount, Axis yAxis)
        {
            Mode = mode;
            DataPointsCount = dataPointsCount;
            _series = new Dictionary<string, LineSeries>();
            _lastPointOfSeries = new Dictionary<string, DataPoint>();

            LinearAxis xAxis = new LinearAxis();
            xAxis.Position = AxisPosition.Bottom;
            xAxis.Title = "Time";

            yAxis.Position = AxisPosition.Left;
            yAxis.Title = "Values";

            var plot = new PlotModel
            {
                Title = Title,
                TitleHorizontalAlignment = TitleHorizontalAlignment.CenteredWithinPlotArea,
                LegendOrientation = LegendOrientation.Horizontal,
                LegendPlacement = LegendPlacement.Outside,
                LegendPosition = LegendPosition.TopCenter
            };

            plot.Axes.Add(xAxis);
            plot.Axes.Add(yAxis);

            Plot = plot;
        }
コード例 #19
0
ファイル: XicViewModel.cs プロジェクト: msdna/MultiAlign
        public XicViewModel(IEnumerable<UMCLight> features, string name)
            : base(name)
        {
            var intensityAxis = new LinearAxis
            {
                Position = AxisPosition.Left,
                IsPanEnabled = false,
                IsZoomEnabled = false,
                AbsoluteMinimum = 0,
                UseSuperExponentialFormat = true,
                Title = "Intensity"
            };

            var scanAxis = new LinearAxis
            {
                Position = AxisPosition.Bottom,
                IsZoomEnabled = true,
                Title = "Scan"
            };
            Model.Axes.Add(scanAxis);
            Model.Axes.Add(intensityAxis);

            Model.MouseDown += Model_MouseDown;
            Model.MouseMove += Model_MouseMove;
            Model.MouseUp += Model_MouseUp;
            PlotFeatures(features);
        }
コード例 #20
0
 private PlotModel CreateModel(String title)
 {
     var plotModel1 = new PlotModel();
     plotModel1.Title = title;
     var linearAxis1 = new DateTimeAxis(AxisPosition.Bottom, _start, _start + TimeSpan.FromMinutes(1));
     linearAxis1.MajorGridlineStyle = LineStyle.Solid;
     linearAxis1.MinorGridlineStyle = LineStyle.Dot;
     plotModel1.Axes.Add(linearAxis1);
     var linearAxis2 = new LinearAxis(AxisPosition.Left, "Value");
     linearAxis2.MajorGridlineStyle = LineStyle.Solid;
     linearAxis2.MinorGridlineStyle = LineStyle.Dot;
     plotModel1.Axes.Add(linearAxis2);
     plotModel1.Series.Add(new LineSeries()
     {
         Title = "X",
         Points = new List<IDataPoint>()
     });
     plotModel1.Series.Add(new LineSeries()
     {
         Title = "Y",
         Points = new List<IDataPoint>()
     });
     plotModel1.Series.Add(new LineSeries()
     {
         Title = "Z",
         Points = new List<IDataPoint>()
     });
     return plotModel1;
 }
コード例 #21
0
		private RadCartesianChartView createChart(){
			//Create the Chart View
			RadCartesianChartView chart = new RadCartesianChartView(this.Activity);

			//Create the scatter bubble series and attach axes and value bindings.
			ScatterBubbleSeries scatterBubbleSeries = new ScatterBubbleSeries();
			scatterBubbleSeries.BubbleScale = 1000;


			scatterBubbleSeries.XValueBinding = new XValueBinding();
			scatterBubbleSeries.YValueBinding = new YValueBinding();
			scatterBubbleSeries.BubbleSizeBinding = new AreaValueBinding();

			LinearAxis verticalAxis = new LinearAxis();
			//The values in the linear axis will not have values after the decimal point.
			verticalAxis.LabelFormat = "%.2f";
			LinearAxis horizontalAxis = new LinearAxis();
			horizontalAxis.LabelFormat = "%.2f";
			scatterBubbleSeries.VerticalAxis = verticalAxis;
			scatterBubbleSeries.HorizontalAxis = horizontalAxis;

			//Bind series to data
			scatterBubbleSeries.Data = this.getData();

			//Add series to chart
			chart.Series.Add(scatterBubbleSeries);
			return chart;
		}
コード例 #22
0
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (Datos == null || Datos.Count() == 0)
            {
                return;
            }

            var plotModel1 = new PlotModel();
            plotModel1.Title = "Idiomas";

            var categoryAxis1 = new CategoryAxis();
            categoryAxis1.Position = AxisPosition.Left;
            plotModel1.Axes.Add(categoryAxis1);

            var linearAxis1 = new LinearAxis();
            linearAxis1.AxislineStyle = LineStyle.Solid;
            linearAxis1.Position = AxisPosition.Bottom;
            plotModel1.Axes.Add(linearAxis1);
            var barSeries1 = new BarSeries();

            foreach (var item in Datos)
            {
                categoryAxis1.ActualLabels.Add(item.Idioma);
                barSeries1.Items.Add(new BarItem(item.Certeza));
            }

            plotModel1.Series.Add(barSeries1);

            Grafica.Model = plotModel1;
        }
コード例 #23
0
		private RadCartesianChartView createChart(){
			//Create the Chart View
			RadCartesianChartView chart = new RadCartesianChartView(this.Activity);

			//Create the area series and attach axes and value bindings.
			AreaSeries areaSeries = new AreaSeries();

			areaSeries.ValueBinding  = new ValueBinding();
			areaSeries.CategoryBinding = new CategoryBinding();

			LinearAxis verticalAxis = new LinearAxis();
			//The values in the linear axis will not have values after the decimal point.
			verticalAxis.LabelFormat = "%.0f";
			CategoricalAxis horizontalAxis = new CategoricalAxis();
			horizontalAxis.LabelInterval = 10;
			horizontalAxis.LabelFitMode = AxisLabelFitMode.MultiLine;
			areaSeries.VerticalAxis = verticalAxis;
			areaSeries.HorizontalAxis = horizontalAxis;

			//Bind series to data
			areaSeries.Data = this.getData();

			//Add series to chart
			chart.Series.Add(areaSeries);

			ChartPanAndZoomBehavior pzBehavior = new ChartPanAndZoomBehavior();

			pzBehavior.PanMode = ChartPanZoomMode.Both;
			pzBehavior.ZoomMode = ChartPanZoomMode.Both;

			chart.Behaviors.Add(pzBehavior);

			return chart;
		}
コード例 #24
0
        public MsFeatureSpectraViewModel(MSFeatureLight feature, IEnumerable<XYData> spectrum, string name)
            : base(name)
        {
            MsmsDistanceLower = 1.5;
            MsmsDistanceUpper = 1.5;

            var mzAxis = new LinearAxis
            {
                Position = AxisPosition.Bottom,
                IsZoomEnabled = true,
                MinorStep = 1,
                AbsoluteMinimum = 0
            };

            var intensityAxis = new LinearAxis
            {
                IsPanEnabled = false,
                Position = AxisPosition.Left,
                IsZoomEnabled = true,
                Minimum = 0,
                AbsoluteMinimum = 0,
                UseSuperExponentialFormat = true
            };
            Model.Axes.Add(mzAxis);
            Model.Axes.Add(intensityAxis);

            m_mzAxis = mzAxis;
            PlotSpectra(feature, spectrum);
        }
コード例 #25
0
		private RadCartesianChartView createChart(){
			//Create the Chart View
			RadCartesianChartView chart = new RadCartesianChartView(this.Activity);

			//Create the bar series and attach axes and value bindings.
			BarSeries barSeries = new BarSeries();

			barSeries.ValueBinding  = new ValueBinding();
			barSeries.CategoryBinding = new CategoryBinding();

			LinearAxis verticalAxis = new LinearAxis();
			//The values in the linear axis will not have values after the decimal point.
			verticalAxis.LabelFormat = "%.0f";
			CategoricalAxis horizontalAxis = new CategoricalAxis();
			barSeries.VerticalAxis = verticalAxis;
			barSeries.HorizontalAxis = horizontalAxis;

			//Bind series to data
			barSeries.Data  = this.getData();

			//Add series to chart
			chart.Series.Add(barSeries);

			CartesianGridLineAnnotation annotation = new CartesianGridLineAnnotation(verticalAxis, 3);
			chart.Annotations.Add(annotation);
			annotation.LabelHorizontalAlignment = HorizontalAlignment.Left;
			annotation.StrokeColor = Color.Argb(255, 235, 100, 32);
			annotation.StrokeWidth = 4;
			annotation.ZIndex = 1001;
			annotation.Label = "This is Grid Line annotation";

			return chart;
		}
コード例 #26
0
        public static Example LargeDataSetNarrow()
        {
            var pm = new PlotModel { Title = "Large Data Set (narrow window)" };

            var timeSpanAxis1 = new DateTimeAxis { Position = AxisPosition.Bottom };
            pm.Axes.Add(timeSpanAxis1);
            var linearAxis1 = new LinearAxis { Position = AxisPosition.Left };
            pm.Axes.Add(linearAxis1);
            var n = 1000000;
            var items = HighLowItemGenerator.MRProcess(n).ToArray();
            var series = new CandleStickSeries
                             {
                                 Color = OxyColors.Black,
                                 IncreasingColor = OxyColors.DarkGreen,
                                 DecreasingColor = OxyColors.Red,
                                 TrackerFormatString =
                                     "High: {2:0.00}\nLow: {3:0.00}\nOpen: {4:0.00}\nClose: {5:0.00}",
                                 ItemsSource = items
                             };

            timeSpanAxis1.Minimum = items[0].X;
            timeSpanAxis1.Maximum = items[29].X;

            linearAxis1.Minimum = items.Take(30).Select(x => x.Low).Min();
            linearAxis1.Maximum = items.Take(30).Select(x => x.High).Max();

            pm.Series.Add(series);

            timeSpanAxis1.AxisChanged += (sender, e) => AdjustYExtent(series, timeSpanAxis1, linearAxis1);

            var controller = new PlotController();
            controller.UnbindAll();
            controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt);
            return new Example(pm, controller);
        }
コード例 #27
0
 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     DailySeriesViewModel dailyVM = (DailySeriesViewModel)value;
     LinearAxis axis = new LinearAxis();
     axis.HorizontalLocation = AxisHorizontalLocation.Right;
     BindingOperations.SetBinding(axis, LinearAxis.ElementBrushProperty, new Binding("DailyStroke") { Source = dailyVM });
     return axis;
 }
コード例 #28
0
 private static PlotModel CreatePlotModel(double min, double max)
 {
     var model = new PlotModel();
     var verticalAxis = new LinearAxis { Position = AxisPosition.Left, Minimum = min, Maximum = max };
     model.Axes.Add(verticalAxis);
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
     model.Series.Add(new FunctionSeries(x => Math.Sin(x * Math.PI * 4) * Math.Sin(x * Math.PI * 4) * Math.Sqrt(x) * max, 0, 1, 1000));
     return model;
 }
コード例 #29
0
 public static PlotModel MajorStepCategoryAxis()
 {
     var plotModel1 = new PlotModel { Title = "Major Step = 4, IsTickCentered = true" };
     var catAxis = new CategoryAxis { IsTickCentered = true, MajorStep = 4 };
     catAxis.Labels.AddRange(new[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" });
     plotModel1.Axes.Add(catAxis);
     var linearAxis = new LinearAxis { Position = AxisPosition.Left };
     plotModel1.Axes.Add(linearAxis);
     return plotModel1;
 }
コード例 #30
0
 public static PlotModel StandardCategoryAxis()
 {
     var plotModel1 = new PlotModel { Title = "Standard" };
     var catAxis = new CategoryAxis();
     catAxis.Labels.AddRange(new[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" });
     plotModel1.Axes.Add(catAxis);
     var linearAxis = new LinearAxis { Position = AxisPosition.Left };
     plotModel1.Axes.Add(linearAxis);
     return plotModel1;
 }
コード例 #31
0
        async Task OnLoadGraphCommand(int?Year)
        {
            try
            {
                IsBusy = true;

                Model.InvalidatePlot(true);

                var linearAxis1 = new LinearAxis();
                linearAxis1.AbsoluteMinimum = 0;
                linearAxis1.AbsoluteMaximum = 200;

                var barSeries = new ColumnSeries
                {
                    LabelPlacement    = LabelPlacement.Inside,
                    LabelFormatString = "{0}",
                };
                int?year = Year == 0 || Year == null ? 0 : Year;
                if (year == 0)
                {
                    year = 0;
                }

                var userId = Preferences.Get(AuthorizeConstants.UserIdKey, null);

                var data = await _reservationServices.GraphYearReservation(Convert.ToInt32(userId), (int)year, 1, 100);

                if (data == null)
                {
                    await Shell.Current.DisplayAlert("แจ้งเตือน!", "ไม่มีช้อมูลที่คุณเลือก", "ตกลง");

                    await Shell.Current.Navigation.PopAsync();

                    return;
                }
                int[] CountArrays = new int[13];

                foreach (var item in data)
                {
                    for (int i = 1; i <= 12; i++)
                    {
                        if (i == item.Months.Value)
                        {
                            CountArrays[item.Months.Value] = CountArrays[item.Months.Value] + 1;
                        }
                        else
                        {
                            CountArrays[item.Months.Value] = CountArrays[item.Months.Value] + 0;
                        }
                    }
                }

                String[] strNames = new String[] { "ม.ค", "ก.พ", "มี.ค", "เม.ย", "พ.ค", "มิ.ย",
                                                   "ก.ค", "ส.ค", "ก.ย", "ต.ค", "พ.ย", "ธ.ค" };

                for (int i = 2; i <= 13; i++)
                {
                    barSeries.Items.Add(new ColumnItem
                    {
                        Value = Convert.ToDouble(CountArrays[i - 1]),
                        Color = OxyColor.Parse("#f1c40f")
                    });
                }
                Model.Axes.Add(new CategoryAxis
                {
                    Position      = AxisPosition.Bottom,
                    Key           = "Sample Data",
                    ItemsSource   = strNames,
                    IsPanEnabled  = false,
                    IsZoomEnabled = false,
                    Selectable    = false,
                });
                Model.Axes.Add(linearAxis1);
                Model.Series.Add(barSeries);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                IsBusy = false;
                Model.InvalidatePlot(true);
            }
        }
コード例 #32
0
 private void bShowChart_Click(object sender, EventArgs e)
 {
     if (cDropDownMonth.Enabled == true)
     {
         radChartView1.Series.Clear();
         radChartView1.Axes.Clear();
         int              monthInteger   = Convert.ToInt32(cDropDownMonth.SelectedValue.ToString());
         int              year           = Convert.ToInt32(numericUpDown1.Value);
         OtherRepository  repo           = new OtherRepository();
         List <DayReport> list           = repo.getGroupByDay(year, monthInteger);
         CartesianSeries  series         = new LineSeries();
         CategoricalAxis  horizontalAxis = new CategoricalAxis();
         horizontalAxis.PlotMode = AxisPlotMode.OnTicksPadded;
         LinearAxis verticalAxis = new LinearAxis();
         verticalAxis.AxisType = AxisType.Second;
         series.PointSize      = new SizeF(5, 5);
         series.HorizontalAxis = horizontalAxis;
         series.VerticalAxis   = verticalAxis;
         series.BorderWidth    = 3;
         series.BorderColor    = Color.SkyBlue;
         series.CategoryMember = "Day";
         series.ValueMember    = "Income";
         series.DataSource     = list;
         series.ShowLabels     = true;
         this.radChartView1.Series.Add(series);
     }
     else if (comboBox1.SelectedIndex == 1)
     {
         radChartView1.Series.Clear();
         radChartView1.Axes.Clear();
         int                monthInteger   = Convert.ToInt32(cDropDownMonth.SelectedValue.ToString());
         int                year           = Convert.ToInt32(numericUpDown1.Value);
         OtherRepository    repo           = new OtherRepository();
         List <MonthReport> list           = repo.getGroupByMonth(year);
         CartesianSeries    series         = new LineSeries();
         CategoricalAxis    horizontalAxis = new CategoricalAxis();
         horizontalAxis.PlotMode = AxisPlotMode.OnTicksPadded;
         LinearAxis verticalAxis = new LinearAxis();
         verticalAxis.AxisType = AxisType.Second;
         series.PointSize      = new SizeF(5, 5);
         series.HorizontalAxis = horizontalAxis;
         series.VerticalAxis   = verticalAxis;
         series.BorderWidth    = 3;
         series.BorderColor    = Color.SkyBlue;
         series.CategoryMember = "Month";
         series.ValueMember    = "Income";
         series.DataSource     = list;
         series.ShowLabels     = true;
         this.radChartView1.Series.Add(series);
     }
     else
     {
         radChartView1.Series.Clear();
         radChartView1.Axes.Clear();
         int               monthInteger   = Convert.ToInt32(cDropDownMonth.SelectedValue.ToString());
         int               year           = Convert.ToInt32(numericUpDown1.Value);
         OtherRepository   repo           = new OtherRepository();
         List <YearReport> list           = repo.getGroupByYear();
         CartesianSeries   series         = new LineSeries();
         CategoricalAxis   horizontalAxis = new CategoricalAxis();
         horizontalAxis.PlotMode = AxisPlotMode.OnTicksPadded;
         LinearAxis verticalAxis = new LinearAxis();
         verticalAxis.AxisType = AxisType.Second;
         series.PointSize      = new SizeF(5, 5);
         series.HorizontalAxis = horizontalAxis;
         series.VerticalAxis   = verticalAxis;
         series.BorderWidth    = 3;
         series.BorderColor    = Color.SkyBlue;
         series.CategoryMember = "Year";
         series.ValueMember    = "Income";
         series.DataSource     = list;
         series.ShowLabels     = true;
         this.radChartView1.Series.Add(series);
     }
 }
コード例 #33
0
        public static void Plot3SeriaKolumnowy(string xTitle, string yTitle, OxyColor color1, OxyColor color2,
                                               OxyColor color3, int[,] histogramValues, string label1, string label2, string label3, PlotModel histogramModel,
                                               bool chkR, bool chkG, bool chkB)
        {
            histogramModel.Series.Clear();
            histogramModel.Axes.Clear();
            var l = histogramValues.Length / 3;
            var categoryAxisRGB = new CategoryAxis
            {
                GapWidth      = 0,
                IsAxisVisible = false,
                IsZoomEnabled = false,
                MinorStep     = 1
            };
            var s1 = new ColumnSeries
            {
                Title           = label1,
                StrokeColor     = color1,
                FillColor       = color1,
                StrokeThickness = 1
            };

            for (int i = 0; i < l; i++)
            {
                int y_val = histogramValues[i, 0];
                categoryAxisRGB.Labels.Add(i.ToString());
                s1.Items.Add(new ColumnItem {
                    Value = y_val, Color = color1
                });
            }

            var s2 = new ColumnSeries {
                Title = label2, StrokeColor = color2, FillColor = color2, StrokeThickness = 1
            };

            for (int i = 0; i < l; i++)
            {
                int y_val = histogramValues[i, 1];
                s2.Items.Add(new ColumnItem {
                    Value = y_val, Color = color2
                });
            }

            var s3 = new ColumnSeries {
                Title = label3, StrokeColor = color3, FillColor = color3, StrokeThickness = 1
            };

            for (int i = 0; i < l; i++)
            {
                int y_val = histogramValues[i, 2];
                s3.Items.Add(new ColumnItem {
                    Value = y_val, Color = color3
                });
            }

            var linearAxisRGB1 = new LinearAxis
            {
                Maximum       = l,
                Minimum       = 0,
                IsZoomEnabled = false,
                Position      = AxisPosition.Bottom,
                Title         = xTitle
            };

            var linearAxisRGB2 = new LinearAxis
            {
                AbsoluteMinimum = 0,
                MinimumPadding  = 0,
                IsZoomEnabled   = false,
                Title           = yTitle
            };

            histogramModel.Axes.Add(categoryAxisRGB);
            histogramModel.Axes.Add(linearAxisRGB1);
            histogramModel.Axes.Add(linearAxisRGB2);
            if (chkR)
            {
                histogramModel.Series.Add(s1);
            }
            if (chkG)
            {
                histogramModel.Series.Add(s2);
            }
            if (chkB)
            {
                histogramModel.Series.Add(s3);
            }
            histogramModel.InvalidatePlot(true);
        }
コード例 #34
0
        private PlotModel CreatePlotModelEnergyStack()
        {
            var model = new PlotModel();

            var axisX = new CategoryAxis
            {
                ItemsSource = EnergyStackModelList,
                LabelField  = "Category",
                Position    = AxisPosition.Bottom
            };

            model.Axes.Add(axisX);

            var axisY = new LinearAxis
            {
                Title    = "Energy",
                Unit     = "kWh",
                Position = AxisPosition.Left
            };

            model.Axes.Add(axisY);

            foreach (var propertyInfo in typeof(EnergyStackModel).GetRuntimeProperties())
            {
                if (propertyInfo.Name == "Category")
                {
                    continue;
                }

                var series = new ColumnSeries
                {
                    ItemsSource = EnergyStackModelList,
                    ValueField  = propertyInfo.Name,
                    IsStacked   = true
                };
                if (propertyInfo.Name.Contains("Blank"))
                {
                    series.FillColor = OxyColors.White;
                }
                else if (propertyInfo.Name.Contains("Defeat"))
                {
                    series.FillColor = OxyColors.Black;
                }
                else if (propertyInfo.Name.Contains("Air"))
                {
                    series.FillColor = OxyColors.Yellow;
                }
                else if (propertyInfo.Name.Contains("Rolling"))
                {
                    series.FillColor = OxyColors.Orange;
                }
                else if (propertyInfo.Name.Contains("Regene"))
                {
                    series.FillColor = OxyColors.DeepPink;
                }
                else if (propertyInfo.Name.Contains("ConvertLoss"))
                {
                    series.FillColor = OxyColors.Red;
                }
                model.Series.Add(series);
            }

            return(model);
        }
コード例 #35
0
        /// <summary>
        /// Render x/y line chart.
        /// </summary>
        /// <param name="selectedChart"></param>
        /// <returns>plot model</returns>
        protected PlotModel RenderSimple(string selectedChart)
        {
            //===== get plot data
            var chartData = PlotData[selectedChart];

            string xLabel = chartData
                            .First()      // first row is as good as any
                            .First().Key; // first column is x-axis

            object xValue = chartData
                            .First()        // first row is as good as any
                            .First().Value; // first column is x-axis

            //===== initialize plot model
            PlotModel plotModel = new PlotModel();

            plotModel.Title          = selectedChart;
            plotModel.LegendPosition = LegendPosition.LeftTop;
            plotModel.Axes.Clear();

            Axis xAxis = xValue.GetType() == typeof(DateTime)
                ? new DateTimeAxis()
                : new LinearAxis();

            xAxis.Title    = xLabel;
            xAxis.Position = AxisPosition.Bottom;
            xAxis.Key      = "x";

            var yAxis = new LinearAxis();

            yAxis.Position = AxisPosition.Right;
            yAxis.Key      = "y";

            plotModel.Axes.Add(xAxis);
            plotModel.Axes.Add(yAxis);

            //===== create series
            Dictionary <string, LineSeries> allSeries = new Dictionary <string, LineSeries>();

            foreach (var row in chartData)
            {
                xValue = row[xLabel];

                foreach (var col in row)
                {
                    if (col.Key == xLabel)
                    {
                        continue;
                    }

                    if (col.Value.GetType() != typeof(double) ||
                        double.IsInfinity((double)col.Value) || double.IsNaN((double)col.Value))
                    {
                        continue;
                    }

                    string yLabel = col.Key;
                    double yValue = (double)col.Value;

                    if (!allSeries.ContainsKey(yLabel))
                    {
                        var newSeries = new LineSeries();
                        newSeries.Title     = yLabel;
                        newSeries.IsVisible = true;
                        newSeries.XAxisKey  = "x";
                        newSeries.YAxisKey  = "y";
                        allSeries[yLabel]   = newSeries;
                    }

                    allSeries[yLabel].Points.Add(new DataPoint(
                                                     xValue.GetType() == typeof(DateTime) ? DateTimeAxis.ToDouble(xValue) : (double)xValue,
                                                     (double)yValue));
                }
            }

            //===== add series to plot model
            foreach (var series in allSeries)
            {
                plotModel.Series.Add(series.Value);
            }

            return(plotModel);
        }
コード例 #36
0
        private PlotModel CreateBarChart(bool stacked, string title)
        {
            var model = new PlotModel
            {
                Title                 = title,
                LegendPlacement       = LegendPlacement.Outside,
                LegendPosition        = LegendPosition.BottomCenter,
                LegendOrientation     = LegendOrientation.Horizontal,
                LegendBorderThickness = 0
            };

            var s1 = new BarSeries {
                Title = "Cold Drink", IsStacked = stacked,
            };

            s1.Items.Add(new BarItem {
                Value = 25
            });
            s1.Items.Add(new BarItem {
                Value = 60
            });
            s1.Items.Add(new BarItem {
                Value = 90
            });
            s1.Items.Add(new BarItem {
                Value = 50
            });

            var s2 = new BarSeries {
                Title = "Tea", IsStacked = stacked,
            };

            s2.Items.Add(new BarItem {
                Value = 75
            });
            s2.Items.Add(new BarItem {
                Value = 40
            });
            s2.Items.Add(new BarItem {
                Value = 10
            });
            s2.Items.Add(new BarItem {
                Value = 45
            });

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

            categoryAxis.Labels.Add("Winter");
            categoryAxis.Labels.Add("Spring");
            categoryAxis.Labels.Add("Summer");
            categoryAxis.Labels.Add("Autumn");
            var valueAxis = new LinearAxis {
                Position = AxisPosition.Bottom, MinimumPadding = 0, MaximumPadding = 0.06, AbsoluteMinimum = 0
            };

            model.Series.Add(s1);
            model.Series.Add(s2);
            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);
            return(model);
        }
コード例 #37
0
        public void init()
        {
            generador.CalcularBiorritmo(_livingDaysFirstDayMonth, BiorytmDays.biorritmo_fisico);
            //Tabla.ItemsSource = null;
            //Tabla.ItemsSource = generador.Puntos;
            PlotModel  model = new PlotModel();
            LinearAxis ejeX  = new LinearAxis();

            ejeX.Minimum  = double.Parse("1");
            ejeX.Maximum  = double.Parse("30");
            ejeX.Position = AxisPosition.Bottom;

            LinearAxis ejeY = new LinearAxis();

            ejeY.Minimum  = generador.Puntos.Min(p => p.Y);
            ejeY.Maximum  = generador.Puntos.Max(p => p.Y);
            ejeY.Position = AxisPosition.Left;

            model.Axes.Add(ejeX);
            model.Axes.Add(ejeY);
            model.Title = "Biorritmo";
            LineSeries Fisico = new LineSeries();

            foreach (var item in generador.Puntos)
            {
                Fisico.Points.Add(new DataPoint(item.X, item.Y));
            }
            Fisico.Title = "Fisico";
            Fisico.Color = OxyColor.FromRgb(byte.Parse(r.Next(0, 255).ToString()), byte.Parse(r.Next(0, 255).ToString()), byte.Parse(r.Next(0, 255).ToString()));

            generador.CalcularBiorritmo(_livingDaysFirstDayMonth, BiorytmDays.biorritmo_emocional);
            LineSeries Emocional = new LineSeries();

            foreach (var item in generador.Puntos)
            {
                Emocional.Points.Add(new DataPoint(item.X, item.Y));
            }
            Emocional.Title = "Emocional";
            Emocional.Color = OxyColor.FromRgb(byte.Parse(r.Next(0, 255).ToString()), byte.Parse(r.Next(0, 255).ToString()), byte.Parse(r.Next(0, 255).ToString()));

            generador.CalcularBiorritmo(_livingDaysFirstDayMonth, BiorytmDays.biorritmo_intelectual);
            LineSeries Intelectual = new LineSeries();

            foreach (var item in generador.Puntos)
            {
                Intelectual.Points.Add(new DataPoint(item.X, item.Y));
            }
            Intelectual.Title = "Intelectual";
            Intelectual.Color = OxyColor.FromRgb(byte.Parse(r.Next(0, 255).ToString()), byte.Parse(r.Next(0, 255).ToString()), byte.Parse(r.Next(0, 255).ToString()));

            generador.CalcularBiorritmo(_livingDaysFirstDayMonth, BiorytmDays.biorritmo_intuicional);
            LineSeries Intuicional = new LineSeries();

            foreach (var item in generador.Puntos)
            {
                Intuicional.Points.Add(new DataPoint(item.X, item.Y));
            }
            Intuicional.Title = "Intuicional";
            Intuicional.Color = OxyColor.FromRgb(byte.Parse(r.Next(0, 255).ToString()), byte.Parse(r.Next(0, 255).ToString()), byte.Parse(r.Next(0, 255).ToString()));

            LineSeries Cero = new LineSeries();

            Cero.Points.Add(new DataPoint(0, 0));
            Cero.Points.Add(new DataPoint(30, 0));
            Cero.Color = OxyColor.FromRgb(0, 0, 0);

            model.Series.Add(Fisico);
            model.Series.Add(Emocional);
            model.Series.Add(Intelectual);
            model.Series.Add(Intuicional);
            model.Series.Add(Cero);
            asd.Model = model;

            var fisic       = DataCalc.CalculateBiorritm(Convert.ToInt32(_livingDays), BiorytmDays.biorritmo_fisico);
            var emotional   = DataCalc.CalculateBiorritm(Convert.ToInt32(_livingDays), BiorytmDays.biorritmo_emocional);
            var intelectual = DataCalc.CalculateBiorritm(Convert.ToInt32(_livingDays), BiorytmDays.biorritmo_intelectual);
            var intuitional = DataCalc.CalculateBiorritm(Convert.ToInt32(_livingDays), BiorytmDays.biorritmo_intuicional);

            lblFisicBiorytm.Content       = "Fisico: " + fisic[1];
            lblEmotionalBiorytm.Content   = "Emocional: " + emotional[1];
            lblIntelectualBiorytm.Content = "Intelectual: " + intelectual[1];
            lblIntuitionalBiorytm.Content = "Intuicional: " + intuitional[1];

            if (AccidentAlgorytm.calculateCritics(fisic) == null)
            {
                lblFisicCritic.Content = "Fisico: OK...";
            }
            else
            {
                lblFisicCritic.Content    = "Fisico: CRITICO";
                lblFisicCritic.Foreground = new SolidColorBrush(Colors.Red);
            }
            if (AccidentAlgorytm.calculateCritics(emotional) == null)
            {
                lblEmotionalCritic.Content = "Emocional: OK...";
            }
            else
            {
                lblEmotionalCritic.Content    = "Emocional: CRITICO";
                lblEmotionalCritic.Foreground = new SolidColorBrush(Colors.Red);
            }
            if (AccidentAlgorytm.calculateCritics(intelectual) == null)
            {
                lblIntelectualCritic.Content = "Intelectual: OK...";
            }
            else
            {
                lblIntelectualCritic.Content    = "Intelectual: CRITICO";
                lblIntelectualCritic.Foreground = new SolidColorBrush(Colors.Red);
            }
            if (AccidentAlgorytm.calculateCritics(intuitional) == null)
            {
                lblIntuitionalCritic.Content = "Intuicional: OK...";
            }
            else
            {
                lblIntuitionalCritic.Content    = "Intuicional: CRITICO";
                lblIntuitionalCritic.Foreground = new SolidColorBrush(Colors.Red);
            }
        }
コード例 #38
0
        private void MakeBarCharts([JetBrains.Annotations.NotNull] ResultFileEntry rfe, [JetBrains.Annotations.NotNull] string plotName, [JetBrains.Annotations.NotNull] DirectoryInfo basisPath,
                                   [JetBrains.Annotations.NotNull] Dictionary <string, List <TagEntry> > consumption)
        {
            Profiler.StartPart(Utili.GetCurrentMethodAndClass());
            foreach (var pair in consumption)
            {
                var hasReferenceValue = pair.Value.Any(x => x.ReferenceValues.Count > 0);
                if (!hasReferenceValue)
                {
                    continue;
                }
                var plotModel1 = new PlotModel();
                pair.Value.Sort((x, y) => x.Value.CompareTo(y.Value));
                plotModel1.LegendBorderThickness = 0;
                plotModel1.LegendOrientation     = LegendOrientation.Horizontal;
                plotModel1.LegendPlacement       = LegendPlacement.Outside;
                plotModel1.LegendPosition        = LegendPosition.BottomCenter;
                var labelFontSize = 12;
                if (Config.MakePDFCharts)
                {
                    plotModel1.DefaultFontSize = Parameters.PDFFontSize;
                    plotModel1.LegendFontSize  = Parameters.PDFFontSize;
                    labelFontSize = 16;
                }
                plotModel1.LegendSymbolMargin = 20;
                if (Parameters.ShowTitle)
                {
                    plotModel1.Title = plotName;
                }

                var categoryAxis1 = new CategoryAxis
                {
                    MinorStep = 1,
                    Minimum   = -0.5
                };
                categoryAxis1.Labels.Add(ChartLocalizer.Get().GetTranslation("Simulated"));
                var firstEntry     = pair.Value[0];
                var referenceCount = firstEntry.ReferenceHeaders.Count;
                for (var i = 0; i < referenceCount; i++)
                {
                    categoryAxis1.Labels.Add(ChartLocalizer.Get().GetTranslation(firstEntry.ReferenceHeaders[i]));
                }
                categoryAxis1.GapWidth       = 1;
                categoryAxis1.MaximumPadding = 0.02;
                categoryAxis1.Position       = AxisPosition.Left;
                plotModel1.Axes.Add(categoryAxis1);

                var sum1 = pair.Value.Select(x => x.Value).Sum();
                var sums = new List <double>();
                foreach (var entry in pair.Value)
                {
                    for (var i = 0; i < entry.ReferenceValues.Count; i++)
                    {
                        if (sums.Count < i + 1)
                        {
                            sums.Add(0);
                        }
                        sums[i] += entry.ReferenceValues[i];
                    }
                }
                var    sum2        = sums.Max();
                var    totalSum    = Math.Max(sum1, sum2);
                string s2          = rfe.LoadTypeInformation?.Name ?? "";
                var    linearAxis1 = new LinearAxis
                {
                    AbsoluteMinimum = 0,
                    MaximumPadding  = 0.02,
                    MinimumPadding  = 0,
                    MajorStep       = totalSum / 5,
                    MinorTickSize   = 0,
                    Position        = AxisPosition.Bottom,
                    Title           = ChartLocalizer.Get().GetTranslation(s2) + " in " + rfe.LoadTypeInformation?.UnitOfSum +
                                      string.Empty
                };
                plotModel1.Axes.Add(linearAxis1);
                OxyPalette p;
                if (pair.Value.Count > 1)
                {
                    p = OxyPalettes.HueDistinct(pair.Value.Count);
                }
                else
                {
                    p = OxyPalettes.Hue64;
                }
                var colSums = new Dictionary <int, double>
                {
                    { 0, 0 },
                    { 1, 0 }
                };
                var count = 0;
                foreach (var tagentry in pair.Value)
                {
                    var columnSeries2 = new BarSeries
                    {
                        FillColor = p.Colors[count]
                    };
                    count++;
                    columnSeries2.IsStacked       = true;
                    columnSeries2.StackGroup      = "1";
                    columnSeries2.StrokeThickness = 1;
                    columnSeries2.StrokeColor     = OxyColor.FromArgb(255, 255, 255, 255);
                    columnSeries2.StrokeThickness = 0.1;
                    columnSeries2.Title           = ChartLocalizer.Get().GetTranslation(tagentry.TagName);
                    columnSeries2.LabelPlacement  = LabelPlacement.Middle;
                    var coli = new BarItem(tagentry.Value);
                    columnSeries2.Items.Add(coli);
                    foreach (var referenceValue in tagentry.ReferenceValues)
                    {
                        var coli2 = new BarItem(referenceValue);
                        columnSeries2.Items.Add(coli2);
                    }
                    var col = 0;
                    if (tagentry.Value / sum1 > 0.2)
                    {
                        var d         = tagentry.Value;
                        var valuetext = d.ToString("N0", CultureInfo.CurrentCulture) + " " + rfe.LoadTypeInformation?.UnitOfSum + " (" +
                                        (d / sum1 * 100).ToString("N1", CultureInfo.CurrentCulture) + " %)";
                        SetRectangelAnnotation(col, colSums, plotModel1, valuetext, d, 0.25, 0.35, labelFontSize);
                        var shortendName = ChartLocalizer.Get().GetTranslation(tagentry.TagName).Trim();
                        if (shortendName.Length > 20)
                        {
                            shortendName = shortendName.Substring(0, 17) + "...";
                        }
                        SetRectangelAnnotation(col, colSums, plotModel1, shortendName, d, 0.35, 0.45, labelFontSize);
                    }
                    col++;
                    double refValue = 0;
                    if (tagentry.ReferenceValues.Count > 0)
                    {
                        refValue = tagentry.ReferenceValues[0];
                    }
                    if (refValue / sum2 > 0.15)
                    {
                        var valueText = refValue.ToString("N0", CultureInfo.CurrentCulture) + " " + rfe.LoadTypeInformation?.UnitOfSum +
                                        " (" + (refValue / sum2 * 100).ToString("N1", CultureInfo.CurrentCulture) +
                                        " %)";
                        SetRectangelAnnotation(col, colSums, plotModel1, valueText, refValue, 0.25, 0.35,
                                               labelFontSize);
                        var labelText = ChartLocalizer.Get().GetTranslation(tagentry.TagName);
                        SetRectangelAnnotation(col, colSums, plotModel1, labelText, refValue, 0.35, 0.45,
                                               labelFontSize);
                    }
                    colSums[0] += tagentry.Value;
                    if (tagentry.ReferenceValues.Count > 0)
                    {
                        colSums[1] += tagentry.ReferenceValues[0];
                    }
                    plotModel1.Series.Add(columnSeries2);
                }
                var fi           = new FileInfo(rfe.FullFileName);
                var modifiedName = fi.Name.Substring(0, fi.Name.Length - 3) + AutomationUtili.CleanFileName(pair.Key) +
                                   ".bars";
                if (fi.DirectoryName == null)
                {
                    throw new LPGException("File was not assigned to a directory");
                }

                var cleanedfullname = Path.Combine(fi.DirectoryName, modifiedName);
                Save(plotModel1, plotName, cleanedfullname, basisPath, CalcOption.HouseholdContents);
            }
            Profiler.StopPart(Utili.GetCurrentMethodAndClass());
        }
コード例 #39
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XicPlotViewModel"/> class.
        /// </summary>
        /// <param name="dialogService">Dialog service </param>
        /// <param name="fragSeqVm">The view model for the fragmentation sequence (fragment ion generator)</param>
        /// <param name="lcms">LCMS run data set for this XIC plot. </param>
        /// <param name="title">Title of XIC plot </param>
        /// <param name="xaxis">XAxis for XIC plot. </param>
        /// <param name="showLegend">Should a legend be shown on the plot by default? </param>
        /// <param name="vertAxes">Y axis position</param>
        public XicPlotViewModel(IDialogService dialogService, IFragmentationSequenceViewModel fragSeqVm, ILcMsRun lcms, string title, LinearAxis xaxis, bool showLegend = true, AxisPosition vertAxes = AxisPosition.Left)
        {
            this.dialogService             = dialogService;
            FragmentationSequenceViewModel = fragSeqVm;
            this.lcms       = lcms;
            this.showLegend = showLegend;
            this.xaxis      = xaxis;
            pointsToSmooth  = IcParameters.Instance.PointsToSmooth;
            PlotTitle       = title;
            PlotModel       = new SelectablePlotModel(xaxis, 1.05)
            {
                YAxis =
                {
                    Title        = "Intensity",
                    StringFormat = "0e0",
                    Position     = vertAxes
                }
            };

            ions = new LabeledIonViewModel[0];

            RetentionTimeSelectedCommand = ReactiveCommand.Create(() =>
            {
                if (PlotModel.SelectedDataPoint is XicDataPoint dp)
                {
                    SelectedScan = dp.ScanNum;
                }
            });

            SaveAsImageCommand = ReactiveCommand.Create(SaveAsImage);

            // When ShowLegend is updated, IsLegendVisible on the plot should be updated
            this.WhenAnyValue(x => x.ShowLegend).Subscribe(v =>
            {
                PlotModel.IsLegendVisible = v;
                PlotModel.InvalidatePlot(true);
            });

            // When area updates, plot title should update
            this.WhenAnyValue(x => x.Area).Subscribe(area =>
            {
                var areaStr = string.Format(CultureInfo.InvariantCulture, "{0:0.##E0}", area);
                PlotTitle   = string.Format("{0} (Area: {1})", title, areaStr);
            });

            // Update area when x Axis is zoomed/panned
            this.xaxis.AxisChanged += async(o, e) =>
            {
                Area = await GetCurrentAreaAsync();
            };

            // Update point marker when selected scan changes
            this.WhenAnyValue(x => x.SelectedScan, x => x.IsPlotUpdating)
            .Where(x => x.Item2)
            .Throttle(TimeSpan.FromMilliseconds(50), RxApp.TaskpoolScheduler)
            .Subscribe(x => PlotModel.SetPrimaryPointMarker(this.lcms.GetElutionTime(x.Item1)));

            // When point markers are toggled, change the marker type on each series
            this.WhenAnyValue(x => x.ShowPointMarkers)
            .Select(showPointMarkers => showPointMarkers ? MarkerType.Circle : MarkerType.None)
            .Subscribe(
                markerType =>
            {
                foreach (var lineSeries in PlotModel.Series.OfType <LineSeries>())
                {
                    lineSeries.MarkerType = markerType;
                }

                PlotModel.InvalidatePlot(true);
            });

            this.WhenAnyValue(
                x => x.FragmentationSequenceViewModel.LabeledIonViewModels,
                x => x.PointsToSmooth,
                x => x.IsPlotUpdating)
            .Where(x => x.Item3 && x.Item1 != null)
            .SelectMany(async x => await GetXicDataPointsAsync(x.Item1, PointsToSmooth))
            .Subscribe(xicPoints =>
            {
                ions = FragmentationSequenceViewModel.LabeledIonViewModels;
                UpdatePlotModel(xicPoints);
            });

            // Update ions when relative intensity threshold changes.
            IcParameters.Instance.WhenAnyValue(x => x.PrecursorRelativeIntensityThreshold).Subscribe(precRelInt =>
            {
                if (FragmentationSequenceViewModel is PrecursorSequenceIonViewModel precFragVm)
                {
                    precFragVm.RelativeIntensityThreshold = precRelInt;
                }
            });

            // Update plot when settings change
            IcParameters.Instance.WhenAnyValue(x => x.ProductIonTolerancePpm)
            .Where(_ => ions != null)
            .Throttle(TimeSpan.FromMilliseconds(250), RxApp.TaskpoolScheduler)
            .SelectMany(async x => await GetXicDataPointsAsync(ions, PointsToSmooth, false))
            .Subscribe(UpdatePlotModel);
        }
コード例 #40
0
ファイル: ArchiveWindow.xaml.cs プロジェクト: byGriS/Spark
        private void btnDrawGraph_Click(object sender, RoutedEventArgs e)
        {
            timerEmul.Stop();
            if (IsEmul)
            {
                switch (cbSpeed.SelectedIndex)
                {
                case 0:
                    timerEmul.Interval = 1000 / 1.0;
                    break;

                case 1:
                    timerEmul.Interval = 1000 / 2.0;
                    break;

                case 2:
                    timerEmul.Interval = 1000 / 4.0;
                    break;

                case 3:
                    timerEmul.Interval = 1000 / 8.0;
                    break;

                case 4:
                    timerEmul.Interval = 1000 / 25.0;
                    break;
                }
            }
            model = new PlotModel();
            DateTimeAxis axisX = new DateTimeAxis()
            {
                Title        = "Время",
                Position     = AxisPosition.Bottom,
                StringFormat = "HH:mm:ss\ndd/MM/yy",
            };
            DateTime start  = dtpStart.Value.Value;
            DateTime finish = dtpFinish.Value.Value;

            if (!IsEmul)
            {
                axisX.Minimum = start.ToOADate();
                axisX.Maximum = finish.ToOADate();
            }
            axisX.MajorGridlineStyle     = LineStyle.Solid;
            axisX.MajorGridlineThickness = 1;
            model.Axes.Add(axisX);

            for (int i = 0; i < selectedParam.Count; i++)
            {
                LinearAxis axeY = new LinearAxis()
                {
                    Title        = selectedParam[i].Title + ", " + selectedParam[i].Unit,
                    Key          = selectedParam[i].Title,
                    Position     = AxisPosition.Left,
                    PositionTier = i,
                };

                if (i == 0)
                {
                    axeY.AxisChanged           += AxeY_AxisChanged;
                    axeY.MajorGridlineStyle     = LineStyle.Solid;
                    axeY.MajorGridlineThickness = 1;
                }

                model.Axes.Add(axeY);
                LineSeries series = new LineSeries()
                {
                    Title    = selectedParam[i].Title,
                    YAxisKey = selectedParam[i].Title
                };
                model.Series.Add(series);
                int sample = Convert.ToInt32(cbSample.SelectionBoxItem);
                if (!IsEmul)
                {
                    for (int point = 0; point < selectedParam[i].Points.Count; point += sample)
                    {
                        if ((selectedParam[i].Points[point].X > start) && (selectedParam[i].Points[point].X < finish))
                        {
                            series.Points.Add(new DataPoint(DateTimeAxis.ToDouble(selectedParam[i].Points[point].X), selectedParam[i].Points[point].Y));
                        }
                    }
                }
            }
            plotter.Model = model;
            for (int i = 1; i < model.Axes.Count; i++)
            {
                if (model.Axes[i].ActualMaximum > Math.Abs(model.Axes[i].ActualMinimum))
                {
                    model.Axes[i].Minimum     = -1 * model.Axes[i].ActualMaximum;
                    selectedParam[i - 1].MinY = model.Axes[i].Minimum;
                    selectedParam[i - 1].MaxY = model.Axes[i].ActualMaximum;
                }
                else
                {
                    model.Axes[i].Maximum     = -1 * model.Axes[i].ActualMinimum;
                    selectedParam[i - 1].MinY = model.Axes[i].ActualMinimum;
                    selectedParam[i - 1].MaxY = model.Axes[i].Maximum;
                }
            }

            if (IsEmul)
            {
                timerEmul.Start();
            }
            ContextMenu cm    = new ContextMenu();
            MenuItem    reset = new MenuItem()
            {
                Header = "Масштаб по умолчанию"
            };

            reset.Click += Reset_Click;
            cm.Items.Add(reset);
            MenuItem setting = new MenuItem()
            {
                Header = "Настройки"
            };

            setting.Click += Setting_Click;
            cm.Items.Add(setting);
            MenuItem saveAsPic = new MenuItem()
            {
                Header = "Сохранить как картинку"
            };

            saveAsPic.Click += SaveAsPic_Click;
            cm.Items.Add(saveAsPic);
            MenuItem exportManyPic = new MenuItem()
            {
                Header = "Выгрузить несколько картинок"
            };

            exportManyPic.Click += ExportManyPic_Click;
            cm.Items.Add(exportManyPic);
            plotter.ContextMenu = cm;
            InitGraphSetting();
        }
コード例 #41
0
        public static PlotModel LineSeriesAndAreaSeries()
        {
            var plotModel1 = new PlotModel {
                Title = "LineSeries and AreaSeries"
            };
            var linearAxis1 = new LinearAxis {
                Position = AxisPosition.Bottom
            };

            plotModel1.Axes.Add(linearAxis1);
            var linearAxis2 = new LinearAxis();

            plotModel1.Axes.Add(linearAxis2);
            var areaSeries1 = new AreaSeries
            {
                Fill            = OxyColors.LightBlue,
                DataFieldX2     = "Time",
                DataFieldY2     = "Minimum",
                Color           = OxyColors.Red,
                StrokeThickness = 0,
                MarkerFill      = OxyColors.Transparent,
                DataFieldX      = "Time",
                DataFieldY      = "Maximum"
            };

            areaSeries1.Points2.Add(new DataPoint(0, -5.04135905692417));
            areaSeries1.Points2.Add(new DataPoint(2.5, -4.91731850813018));
            areaSeries1.Points2.Add(new DataPoint(5, -4.45266314658926));
            areaSeries1.Points2.Add(new DataPoint(7.5, -3.87303874542613));
            areaSeries1.Points2.Add(new DataPoint(10, -3.00101110255393));
            areaSeries1.Points2.Add(new DataPoint(12.5, -2.17980725503518));
            areaSeries1.Points2.Add(new DataPoint(15, -1.67332229254456));
            areaSeries1.Points2.Add(new DataPoint(17.5, -1.10537158549082));
            areaSeries1.Points2.Add(new DataPoint(20, -0.6145459544447));
            areaSeries1.Points2.Add(new DataPoint(22.5, 0.120028106039404));
            areaSeries1.Points2.Add(new DataPoint(25, 1.06357270435597));
            areaSeries1.Points2.Add(new DataPoint(27.5, 1.87301405606466));
            areaSeries1.Points2.Add(new DataPoint(30, 2.57569854952195));
            areaSeries1.Points2.Add(new DataPoint(32.5, 3.59165537664278));
            areaSeries1.Points2.Add(new DataPoint(35, 4.87991958133872));
            areaSeries1.Points2.Add(new DataPoint(37.5, 6.36214537958714));
            areaSeries1.Points2.Add(new DataPoint(40, 7.62564585126268));
            areaSeries1.Points2.Add(new DataPoint(42.5, 8.69606320261772));
            areaSeries1.Points2.Add(new DataPoint(45, 10.0118704438265));
            areaSeries1.Points2.Add(new DataPoint(47.5, 11.0434480519236));
            areaSeries1.Points2.Add(new DataPoint(50, 11.9794171576758));
            areaSeries1.Points2.Add(new DataPoint(52.5, 12.9591851832621));
            areaSeries1.Points2.Add(new DataPoint(55, 14.172107889304));
            areaSeries1.Points2.Add(new DataPoint(57.5, 15.5520057698488));
            areaSeries1.Points2.Add(new DataPoint(60, 17.2274942386092));
            areaSeries1.Points2.Add(new DataPoint(62.5, 18.6983982186757));
            areaSeries1.Points2.Add(new DataPoint(65, 20.4560332001448));
            areaSeries1.Points2.Add(new DataPoint(67.5, 22.4867327382261));
            areaSeries1.Points2.Add(new DataPoint(70, 24.5319674302041));
            areaSeries1.Points2.Add(new DataPoint(72.5, 26.600547815813));
            areaSeries1.Points2.Add(new DataPoint(75, 28.5210891459701));
            areaSeries1.Points2.Add(new DataPoint(77.5, 30.6793080755413));
            areaSeries1.Points2.Add(new DataPoint(80, 33.0546651200646));
            areaSeries1.Points2.Add(new DataPoint(82.5, 35.3256065179713));
            areaSeries1.Points2.Add(new DataPoint(85, 37.6336074839968));
            areaSeries1.Points2.Add(new DataPoint(87.5, 40.2012266359763));
            areaSeries1.Points2.Add(new DataPoint(90, 42.8923555399256));
            areaSeries1.Points2.Add(new DataPoint(92.5, 45.8665211907432));
            areaSeries1.Points2.Add(new DataPoint(95, 48.8200195945427));
            areaSeries1.Points2.Add(new DataPoint(97.5, 51.8304284402311));
            areaSeries1.Points2.Add(new DataPoint(100, 54.6969868542147));
            areaSeries1.Points2.Add(new DataPoint(102.5, 57.7047292990632));
            areaSeries1.Points2.Add(new DataPoint(105, 60.4216644602929));
            areaSeries1.Points2.Add(new DataPoint(107.5, 62.926258762519));
            areaSeries1.Points2.Add(new DataPoint(110, 65.1829734629407));
            areaSeries1.Points2.Add(new DataPoint(112.5, 67.2365592083133));
            areaSeries1.Points2.Add(new DataPoint(115, 69.5713628691022));
            areaSeries1.Points2.Add(new DataPoint(117.5, 71.7267046705944));
            areaSeries1.Points2.Add(new DataPoint(120, 73.633463102781));
            areaSeries1.Points2.Add(new DataPoint(122.5, 75.4660150158061));
            areaSeries1.Points2.Add(new DataPoint(125, 77.5669292504745));
            areaSeries1.Points2.Add(new DataPoint(127.5, 79.564218544664));
            areaSeries1.Points2.Add(new DataPoint(130, 81.8631309028078));
            areaSeries1.Points2.Add(new DataPoint(132.5, 83.9698189969034));
            areaSeries1.Points2.Add(new DataPoint(135, 86.3847886532009));
            areaSeries1.Points2.Add(new DataPoint(137.5, 88.5559348267764));
            areaSeries1.Points2.Add(new DataPoint(140, 91.0455050418365));
            areaSeries1.Points2.Add(new DataPoint(142.5, 93.6964157585504));
            areaSeries1.Points2.Add(new DataPoint(145, 96.284336864941));
            areaSeries1.Points2.Add(new DataPoint(147.5, 98.7508602689723));
            areaSeries1.Points2.Add(new DataPoint(150, 100.904510594255));
            areaSeries1.Points2.Add(new DataPoint(152.5, 103.266136681506));
            areaSeries1.Points2.Add(new DataPoint(155, 105.780951269521));
            areaSeries1.Points2.Add(new DataPoint(157.5, 108.032859257065));
            areaSeries1.Points2.Add(new DataPoint(160, 110.035478448093));
            areaSeries1.Points2.Add(new DataPoint(162.5, 112.10655731615));
            areaSeries1.Points2.Add(new DataPoint(165, 114.37480786097));
            areaSeries1.Points2.Add(new DataPoint(167.5, 116.403992550869));
            areaSeries1.Points2.Add(new DataPoint(170, 118.61663988727));
            areaSeries1.Points2.Add(new DataPoint(172.5, 120.538730287384));
            areaSeries1.Points2.Add(new DataPoint(175, 122.515721057177));
            areaSeries1.Points2.Add(new DataPoint(177.5, 124.474386629124));
            areaSeries1.Points2.Add(new DataPoint(180, 126.448283293214));
            areaSeries1.Points2.Add(new DataPoint(182.5, 128.373811322299));
            areaSeries1.Points2.Add(new DataPoint(185, 130.33627914667));
            areaSeries1.Points2.Add(new DataPoint(187.5, 132.487933658477));
            areaSeries1.Points2.Add(new DataPoint(190, 134.716989778456));
            areaSeries1.Points2.Add(new DataPoint(192.5, 136.817287595392));
            areaSeries1.Points2.Add(new DataPoint(195, 139.216488664698));
            areaSeries1.Points2.Add(new DataPoint(197.5, 141.50803227574));
            areaSeries1.Points2.Add(new DataPoint(200, 143.539586683614));
            areaSeries1.Points2.Add(new DataPoint(202.5, 145.535911545221));
            areaSeries1.Points2.Add(new DataPoint(205, 147.516964978686));
            areaSeries1.Points2.Add(new DataPoint(207.5, 149.592416731684));
            areaSeries1.Points2.Add(new DataPoint(210, 151.600983566512));
            areaSeries1.Points2.Add(new DataPoint(212.5, 153.498210993362));
            areaSeries1.Points2.Add(new DataPoint(215, 155.512606828247));
            areaSeries1.Points2.Add(new DataPoint(217.5, 157.426564302774));
            areaSeries1.Points2.Add(new DataPoint(220, 159.364474964172));
            areaSeries1.Points2.Add(new DataPoint(222.5, 161.152806492128));
            areaSeries1.Points2.Add(new DataPoint(225, 162.679069434562));
            areaSeries1.Points2.Add(new DataPoint(227.5, 163.893622036741));
            areaSeries1.Points2.Add(new DataPoint(230, 165.475827621238));
            areaSeries1.Points2.Add(new DataPoint(232.5, 167.303960444734));
            areaSeries1.Points2.Add(new DataPoint(235, 169.259393394952));
            areaSeries1.Points2.Add(new DataPoint(237.5, 171.265193646758));
            areaSeries1.Points2.Add(new DataPoint(240, 173.074304345192));
            areaSeries1.Points2.Add(new DataPoint(242.5, 174.975492766814));
            areaSeries1.Points2.Add(new DataPoint(245, 176.684088218484));
            areaSeries1.Points2.Add(new DataPoint(247.5, 178.406887247603));
            areaSeries1.Points.Add(new DataPoint(0, 5.0184649433561));
            areaSeries1.Points.Add(new DataPoint(2.5, 5.27685959268215));
            areaSeries1.Points.Add(new DataPoint(5, 5.81437064628786));
            areaSeries1.Points.Add(new DataPoint(7.5, 6.51022475040994));
            areaSeries1.Points.Add(new DataPoint(10, 7.49921246878766));
            areaSeries1.Points.Add(new DataPoint(12.5, 8.41941631823751));
            areaSeries1.Points.Add(new DataPoint(15, 9.09826907222079));
            areaSeries1.Points.Add(new DataPoint(17.5, 9.89500750098145));
            areaSeries1.Points.Add(new DataPoint(20, 10.6633345249404));
            areaSeries1.Points.Add(new DataPoint(22.5, 11.6249613445368));
            areaSeries1.Points.Add(new DataPoint(25, 12.8816391467497));
            areaSeries1.Points.Add(new DataPoint(27.5, 13.9665185705603));
            areaSeries1.Points.Add(new DataPoint(30, 14.8501816818724));
            areaSeries1.Points.Add(new DataPoint(32.5, 16.0683128022441));
            areaSeries1.Points.Add(new DataPoint(35, 17.5378799723172));
            areaSeries1.Points.Add(new DataPoint(37.5, 19.1262752954039));
            areaSeries1.Points.Add(new DataPoint(40, 20.4103953650735));
            areaSeries1.Points.Add(new DataPoint(42.5, 21.5430627723891));
            areaSeries1.Points.Add(new DataPoint(45, 22.9105459463366));
            areaSeries1.Points.Add(new DataPoint(47.5, 23.9802361888719));
            areaSeries1.Points.Add(new DataPoint(50, 24.8659461235003));
            areaSeries1.Points.Add(new DataPoint(52.5, 25.7303194442439));
            areaSeries1.Points.Add(new DataPoint(55, 26.7688545912359));
            areaSeries1.Points.Add(new DataPoint(57.5, 28.0545112571933));
            areaSeries1.Points.Add(new DataPoint(60, 29.7036634266394));
            areaSeries1.Points.Add(new DataPoint(62.5, 31.2273634344467));
            areaSeries1.Points.Add(new DataPoint(65, 33.1038196356519));
            areaSeries1.Points.Add(new DataPoint(67.5, 35.2639893610328));
            areaSeries1.Points.Add(new DataPoint(70, 37.434293559489));
            areaSeries1.Points.Add(new DataPoint(72.5, 39.7109359368267));
            areaSeries1.Points.Add(new DataPoint(75, 41.7573881676222));
            areaSeries1.Points.Add(new DataPoint(77.5, 44.0460374479862));
            areaSeries1.Points.Add(new DataPoint(80, 46.5098714746581));
            areaSeries1.Points.Add(new DataPoint(82.5, 48.7754012129155));
            areaSeries1.Points.Add(new DataPoint(85, 51.1619816926597));
            areaSeries1.Points.Add(new DataPoint(87.5, 53.9036778414639));
            areaSeries1.Points.Add(new DataPoint(90, 56.7448825012636));
            areaSeries1.Points.Add(new DataPoint(92.5, 59.9294987878434));
            areaSeries1.Points.Add(new DataPoint(95, 63.0148831289797));
            areaSeries1.Points.Add(new DataPoint(97.5, 66.0721745989622));
            areaSeries1.Points.Add(new DataPoint(100, 68.8980036274521));
            areaSeries1.Points.Add(new DataPoint(102.5, 71.7719322611447));
            areaSeries1.Points.Add(new DataPoint(105, 74.4206055336728));
            areaSeries1.Points.Add(new DataPoint(107.5, 76.816198386632));
            areaSeries1.Points.Add(new DataPoint(110, 79.0040432726983));
            areaSeries1.Points.Add(new DataPoint(112.5, 80.9617606926066));
            areaSeries1.Points.Add(new DataPoint(115, 83.1345574620341));
            areaSeries1.Points.Add(new DataPoint(117.5, 85.0701022046479));
            areaSeries1.Points.Add(new DataPoint(120, 86.8557530286516));
            areaSeries1.Points.Add(new DataPoint(122.5, 88.5673387745243));
            areaSeries1.Points.Add(new DataPoint(125, 90.6003321543338));
            areaSeries1.Points.Add(new DataPoint(127.5, 92.439864576254));
            areaSeries1.Points.Add(new DataPoint(130, 94.5383744861178));
            areaSeries1.Points.Add(new DataPoint(132.5, 96.4600166864507));
            areaSeries1.Points.Add(new DataPoint(135, 98.6091052949006));
            areaSeries1.Points.Add(new DataPoint(137.5, 100.496459351478));
            areaSeries1.Points.Add(new DataPoint(140, 102.705767030085));
            areaSeries1.Points.Add(new DataPoint(142.5, 105.009994476992));
            areaSeries1.Points.Add(new DataPoint(145, 107.31287026052));
            areaSeries1.Points.Add(new DataPoint(147.5, 109.584842542272));
            areaSeries1.Points.Add(new DataPoint(150, 111.641435600837));
            areaSeries1.Points.Add(new DataPoint(152.5, 113.988459973544));
            areaSeries1.Points.Add(new DataPoint(155, 116.50349048027));
            areaSeries1.Points.Add(new DataPoint(157.5, 118.753612704274));
            areaSeries1.Points.Add(new DataPoint(160, 120.801728924085));
            areaSeries1.Points.Add(new DataPoint(162.5, 122.902486914165));
            areaSeries1.Points.Add(new DataPoint(165, 125.104391935796));
            areaSeries1.Points.Add(new DataPoint(167.5, 127.06056966547));
            areaSeries1.Points.Add(new DataPoint(170, 129.217086578495));
            areaSeries1.Points.Add(new DataPoint(172.5, 131.151968896274));
            areaSeries1.Points.Add(new DataPoint(175, 133.159906275133));
            areaSeries1.Points.Add(new DataPoint(177.5, 135.065263957561));
            areaSeries1.Points.Add(new DataPoint(180, 137.041870026822));
            areaSeries1.Points.Add(new DataPoint(182.5, 138.937477489811));
            areaSeries1.Points.Add(new DataPoint(185, 140.776914926282));
            areaSeries1.Points.Add(new DataPoint(187.5, 142.786975776398));
            areaSeries1.Points.Add(new DataPoint(190, 144.862762377347));
            areaSeries1.Points.Add(new DataPoint(192.5, 146.89654967049));
            areaSeries1.Points.Add(new DataPoint(195, 149.204343821204));
            areaSeries1.Points.Add(new DataPoint(197.5, 151.369748673527));
            areaSeries1.Points.Add(new DataPoint(200, 153.324438580137));
            areaSeries1.Points.Add(new DataPoint(202.5, 155.173148715344));
            areaSeries1.Points.Add(new DataPoint(205, 157.0501827528));
            areaSeries1.Points.Add(new DataPoint(207.5, 159.109122278359));
            areaSeries1.Points.Add(new DataPoint(210, 161.044446932778));
            areaSeries1.Points.Add(new DataPoint(212.5, 162.942364031841));
            areaSeries1.Points.Add(new DataPoint(215, 164.966769883021));
            areaSeries1.Points.Add(new DataPoint(217.5, 166.89711806788));
            areaSeries1.Points.Add(new DataPoint(220, 168.906874949069));
            areaSeries1.Points.Add(new DataPoint(222.5, 170.85692034995));
            areaSeries1.Points.Add(new DataPoint(225, 172.602125010408));
            areaSeries1.Points.Add(new DataPoint(227.5, 173.964258466598));
            areaSeries1.Points.Add(new DataPoint(230, 175.629908385654));
            areaSeries1.Points.Add(new DataPoint(232.5, 177.495778359378));
            areaSeries1.Points.Add(new DataPoint(235, 179.432933300749));
            areaSeries1.Points.Add(new DataPoint(237.5, 181.400180771342));
            areaSeries1.Points.Add(new DataPoint(240, 183.232300309899));
            areaSeries1.Points.Add(new DataPoint(242.5, 185.225502661441));
            areaSeries1.Points.Add(new DataPoint(245, 186.979590140413));
            areaSeries1.Points.Add(new DataPoint(247.5, 188.816640077725));
            areaSeries1.Title = "Maximum/Minimum";
            plotModel1.Series.Add(areaSeries1);

            var lineSeries1 = new LineSeries
            {
                Color      = OxyColors.Blue,
                MarkerFill = OxyColors.Transparent,
                DataFieldX = "Time",
                DataFieldY = "Value"
            };

            lineSeries1.Points.Add(new DataPoint(0, -0.011447056784037));
            lineSeries1.Points.Add(new DataPoint(2.5, 0.179770542275985));
            lineSeries1.Points.Add(new DataPoint(5, 0.6808537498493));
            lineSeries1.Points.Add(new DataPoint(7.5, 1.31859300249191));
            lineSeries1.Points.Add(new DataPoint(10, 2.24910068311687));
            lineSeries1.Points.Add(new DataPoint(12.5, 3.11980453160117));
            lineSeries1.Points.Add(new DataPoint(15, 3.71247338983811));
            lineSeries1.Points.Add(new DataPoint(17.5, 4.39481795774531));
            lineSeries1.Points.Add(new DataPoint(20, 5.02439428524784));
            lineSeries1.Points.Add(new DataPoint(22.5, 5.87249472528812));
            lineSeries1.Points.Add(new DataPoint(25, 6.97260592555283));
            lineSeries1.Points.Add(new DataPoint(27.5, 7.91976631331247));
            lineSeries1.Points.Add(new DataPoint(30, 8.71294011569719));
            lineSeries1.Points.Add(new DataPoint(32.5, 9.82998408944345));
            lineSeries1.Points.Add(new DataPoint(35, 11.208899776828));
            lineSeries1.Points.Add(new DataPoint(37.5, 12.7442103374955));
            lineSeries1.Points.Add(new DataPoint(40, 14.0180206081681));
            lineSeries1.Points.Add(new DataPoint(42.5, 15.1195629875034));
            lineSeries1.Points.Add(new DataPoint(45, 16.4612081950815));
            lineSeries1.Points.Add(new DataPoint(47.5, 17.5118421203978));
            lineSeries1.Points.Add(new DataPoint(50, 18.4226816405881));
            lineSeries1.Points.Add(new DataPoint(52.5, 19.344752313753));
            lineSeries1.Points.Add(new DataPoint(55, 20.47048124027));
            lineSeries1.Points.Add(new DataPoint(57.5, 21.8032585135211));
            lineSeries1.Points.Add(new DataPoint(60, 23.4655788326243));
            lineSeries1.Points.Add(new DataPoint(62.5, 24.9628808265612));
            lineSeries1.Points.Add(new DataPoint(65, 26.7799264178984));
            lineSeries1.Points.Add(new DataPoint(67.5, 28.8753610496295));
            lineSeries1.Points.Add(new DataPoint(70, 30.9831304948466));
            lineSeries1.Points.Add(new DataPoint(72.5, 33.1557418763199));
            lineSeries1.Points.Add(new DataPoint(75, 35.1392386567962));
            lineSeries1.Points.Add(new DataPoint(77.5, 37.3626727617638));
            lineSeries1.Points.Add(new DataPoint(80, 39.7822682973613));
            lineSeries1.Points.Add(new DataPoint(82.5, 42.0505038654434));
            lineSeries1.Points.Add(new DataPoint(85, 44.3977945883283));
            lineSeries1.Points.Add(new DataPoint(87.5, 47.0524522387201));
            lineSeries1.Points.Add(new DataPoint(90, 49.8186190205946));
            lineSeries1.Points.Add(new DataPoint(92.5, 52.8980099892933));
            lineSeries1.Points.Add(new DataPoint(95, 55.9174513617612));
            lineSeries1.Points.Add(new DataPoint(97.5, 58.9513015195966));
            lineSeries1.Points.Add(new DataPoint(100, 61.7974952408334));
            lineSeries1.Points.Add(new DataPoint(102.5, 64.738330780104));
            lineSeries1.Points.Add(new DataPoint(105, 67.4211349969828));
            lineSeries1.Points.Add(new DataPoint(107.5, 69.8712285745755));
            lineSeries1.Points.Add(new DataPoint(110, 72.0935083678195));
            lineSeries1.Points.Add(new DataPoint(112.5, 74.0991599504599));
            lineSeries1.Points.Add(new DataPoint(115, 76.3529601655682));
            lineSeries1.Points.Add(new DataPoint(117.5, 78.3984034376212));
            lineSeries1.Points.Add(new DataPoint(120, 80.2446080657163));
            lineSeries1.Points.Add(new DataPoint(122.5, 82.0166768951652));
            lineSeries1.Points.Add(new DataPoint(125, 84.0836307024042));
            lineSeries1.Points.Add(new DataPoint(127.5, 86.002041560459));
            lineSeries1.Points.Add(new DataPoint(130, 88.2007526944628));
            lineSeries1.Points.Add(new DataPoint(132.5, 90.2149178416771));
            lineSeries1.Points.Add(new DataPoint(135, 92.4969469740507));
            lineSeries1.Points.Add(new DataPoint(137.5, 94.5261970891274));
            lineSeries1.Points.Add(new DataPoint(140, 96.875636035961));
            lineSeries1.Points.Add(new DataPoint(142.5, 99.3532051177711));
            lineSeries1.Points.Add(new DataPoint(145, 101.798603562731));
            lineSeries1.Points.Add(new DataPoint(147.5, 104.167851405622));
            lineSeries1.Points.Add(new DataPoint(150, 106.272973097546));
            lineSeries1.Points.Add(new DataPoint(152.5, 108.627298327525));
            lineSeries1.Points.Add(new DataPoint(155, 111.142220874895));
            lineSeries1.Points.Add(new DataPoint(157.5, 113.39323598067));
            lineSeries1.Points.Add(new DataPoint(160, 115.418603686089));
            lineSeries1.Points.Add(new DataPoint(162.5, 117.504522115157));
            lineSeries1.Points.Add(new DataPoint(165, 119.739599898383));
            lineSeries1.Points.Add(new DataPoint(167.5, 121.732281108169));
            lineSeries1.Points.Add(new DataPoint(170, 123.916863232882));
            lineSeries1.Points.Add(new DataPoint(172.5, 125.845349591829));
            lineSeries1.Points.Add(new DataPoint(175, 127.837813666155));
            lineSeries1.Points.Add(new DataPoint(177.5, 129.769825293343));
            lineSeries1.Points.Add(new DataPoint(180, 131.745076660018));
            lineSeries1.Points.Add(new DataPoint(182.5, 133.655644406055));
            lineSeries1.Points.Add(new DataPoint(185, 135.556597036476));
            lineSeries1.Points.Add(new DataPoint(187.5, 137.637454717438));
            lineSeries1.Points.Add(new DataPoint(190, 139.789876077902));
            lineSeries1.Points.Add(new DataPoint(192.5, 141.856918632941));
            lineSeries1.Points.Add(new DataPoint(195, 144.210416242951));
            lineSeries1.Points.Add(new DataPoint(197.5, 146.438890474634));
            lineSeries1.Points.Add(new DataPoint(200, 148.432012631876));
            lineSeries1.Points.Add(new DataPoint(202.5, 150.354530130282));
            lineSeries1.Points.Add(new DataPoint(205, 152.283573865743));
            lineSeries1.Points.Add(new DataPoint(207.5, 154.350769505022));
            lineSeries1.Points.Add(new DataPoint(210, 156.322715249645));
            lineSeries1.Points.Add(new DataPoint(212.5, 158.220287512602));
            lineSeries1.Points.Add(new DataPoint(215, 160.239688355634));
            lineSeries1.Points.Add(new DataPoint(217.5, 162.161841185327));
            lineSeries1.Points.Add(new DataPoint(220, 164.135674956621));
            lineSeries1.Points.Add(new DataPoint(222.5, 166.004863421039));
            lineSeries1.Points.Add(new DataPoint(225, 167.640597222485));
            lineSeries1.Points.Add(new DataPoint(227.5, 168.928940251669));
            lineSeries1.Points.Add(new DataPoint(230, 170.552868003446));
            lineSeries1.Points.Add(new DataPoint(232.5, 172.399869402056));
            lineSeries1.Points.Add(new DataPoint(235, 174.346163347851));
            lineSeries1.Points.Add(new DataPoint(237.5, 176.33268720905));
            lineSeries1.Points.Add(new DataPoint(240, 178.153302327545));
            lineSeries1.Points.Add(new DataPoint(242.5, 180.100497714128));
            lineSeries1.Points.Add(new DataPoint(245, 181.831839179449));
            lineSeries1.Points.Add(new DataPoint(247.5, 183.611763662664));
            lineSeries1.Title = "Average";
            plotModel1.Series.Add(lineSeries1);
            return(plotModel1);
        }
コード例 #42
0
        private static PlotModel CreateSimpleModel(bool stacked, string title)
        {
            var model = new PlotModel
            {
                Title                 = title,
                LegendPlacement       = LegendPlacement.Outside,
                LegendPosition        = LegendPosition.BottomCenter,
                LegendOrientation     = LegendOrientation.Horizontal,
                LegendBorderThickness = 0
            };

            var s1 = new TSeries {
                Title = "Series 1", IsStacked = stacked, StrokeColor = OxyColors.Black, StrokeThickness = 1
            };

            s1.Items.Add(new TItem {
                Value = 25
            });
            s1.Items.Add(new TItem {
                Value = 137
            });
            s1.Items.Add(new TItem {
                Value = 18
            });
            s1.Items.Add(new TItem {
                Value = 40
            });

            var s2 = new TSeries {
                Title = "Series 2", IsStacked = stacked, StrokeColor = OxyColors.Black, StrokeThickness = 1
            };

            s2.Items.Add(new TItem {
                Value = 12
            });
            s2.Items.Add(new TItem {
                Value = 14
            });
            s2.Items.Add(new TItem {
                Value = 120
            });
            s2.Items.Add(new TItem {
                Value = 26
            });

            var categoryAxis = new CategoryAxis {
                Position = CategoryAxisPosition()
            };

            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 = ValueAxisPosition(), MinimumPadding = 0, MaximumPadding = 0.06, AbsoluteMinimum = 0
            };

            model.Series.Add(s1);
            model.Series.Add(s2);
            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);
            return(model);
        }
コード例 #43
0
        private void PrepareDiagram(out ColumnSeries accuracySeries, out ColumnSeries areaUnderCurveSeries, out ColumnSeries f1ScoreSeries, out ColumnSeries positiveRecallSeries)
        {
            var foreground = OxyColors.SteelBlue;
            var plotModel  = new PlotModel
            {
                Subtitle = "Model Comparison",
                PlotAreaBorderThickness = new OxyThickness(1, 0, 0, 1),
                PlotAreaBorderColor     = foreground,
                TextColor         = foreground,
                TitleColor        = foreground,
                SubtitleColor     = foreground,
                LegendPlacement   = LegendPlacement.Outside,
                LegendPosition    = LegendPosition.TopCenter,
                LegendOrientation = LegendOrientation.Horizontal
            };

            plotModel.Axes.Add(new CategoryAxis
            {
                Position    = AxisPosition.Bottom,
                Key         = "ModelAxis",
                ItemsSource = new[]
                {
                    "Perceptron",
                    "Linear SVM",
                    "Logistic Regression",
                    "SDCA"
                },
                TextColor     = foreground,
                TicklineColor = foreground,
                TitleColor    = foreground
            });

            var linearAxis = new LinearAxis
            {
                Position      = AxisPosition.Left,
                TextColor     = foreground,
                TicklineColor = foreground,
                TitleColor    = foreground
            };

            plotModel.Axes.Add(linearAxis);

            accuracySeries = new ColumnSeries
            {
                Title             = "Accuracy",
                LabelPlacement    = LabelPlacement.Inside,
                LabelFormatString = "{0:.00}",
                FillColor         = OxyColors.DarkOrange,
                TextColor         = OxyColors.Wheat
            };
            plotModel.Series.Add(accuracySeries);

            areaUnderCurveSeries = new ColumnSeries
            {
                Title             = "Area under ROC curve",
                LabelPlacement    = LabelPlacement.Inside,
                LabelFormatString = "{0:.00}",
                FillColor         = OxyColors.Firebrick,
                TextColor         = OxyColors.Wheat
            };
            plotModel.Series.Add(areaUnderCurveSeries);

            f1ScoreSeries = new ColumnSeries
            {
                Title             = "F1 Score",
                LabelPlacement    = LabelPlacement.Inside,
                LabelFormatString = "{0:.00}",
                FillColor         = OxyColors.MidnightBlue,
                TextColor         = OxyColors.Wheat
            };
            plotModel.Series.Add(f1ScoreSeries);

            positiveRecallSeries = new ColumnSeries
            {
                Title             = "Positive Recall",
                LabelPlacement    = LabelPlacement.Inside,
                LabelFormatString = "{0:.00}",
                FillColor         = OxyColors.MediumSeaGreen,
                TextColor         = OxyColors.Wheat
            };
            plotModel.Series.Add(positiveRecallSeries);

            Diagram.Model = plotModel;
        }
コード例 #44
0
ファイル: MainViewModel3.cs プロジェクト: w1r2p1/TRx
        /// <summary>
        /// Creates the candle stick and volume series example.
        /// </summary>
        /// <returns>The candle stick and volume series example.</returns>
        /// <param name="title">Title.</param>
        /// <param name="style">Style.</param>
        /// <param name="n">N.</param>
        /// <param name="naturalY">If set to <c>true</c> natural y.</param>
        /// <param name="naturalV">If set to <c>true</c> natural v.</param>
        private static Example CreateCandleStickAndVolumeSeriesExample(
            string title,
            VolumeStyle style,
            int n         = 10000,
            bool naturalY = false,
            bool naturalV = false)
        {
            var pm = new PlotModel {
                Title = title
            };

            var series = new CandleStickAndVolumeSeries
            {
                PositiveColor      = OxyColors.DarkGreen,
                NegativeColor      = OxyColors.Red,
                PositiveHollow     = false,
                NegativeHollow     = false,
                SeparatorColor     = OxyColors.Gray,
                SeparatorLineStyle = LineStyle.Dash,
                VolumeStyle        = style
            };

            // create bars
            foreach (var bar in OhlcvItemGenerator.MRProcess(n))
            {
                series.Append(bar);
            }

            // create visible window
            var Istart = n - 200;
            var Iend   = n - 120;
            var Ymin   = series.Items.Skip(Istart).Take(Iend - Istart + 1).Select(x => x.Low).Min();
            var Ymax   = series.Items.Skip(Istart).Take(Iend - Istart + 1).Select(x => x.High).Max();
            var Xmin   = series.Items[Istart].X;
            var Xmax   = series.Items[Iend].X;

            // setup axes
            var timeAxis = new DateTimeAxis
            {
                Position = AxisPosition.Bottom,
                Minimum  = Xmin,
                Maximum  = Xmax
            };
            var barAxis = new LinearAxis
            {
                Position      = AxisPosition.Left,
                Key           = series.BarAxisKey,
                StartPosition = 0.25,
                EndPosition   = 1.0,
                Minimum       = naturalY ? double.NaN : Ymin,
                Maximum       = naturalY ? double.NaN : Ymax
            };
            var volAxis = new LinearAxis
            {
                Position      = AxisPosition.Left,
                Key           = series.VolumeAxisKey,
                StartPosition = 0.0,
                EndPosition   = 0.22,
                Minimum       = naturalV ? double.NaN : 0,
                Maximum       = naturalV ? double.NaN : 5000
            };

            switch (style)
            {
            case VolumeStyle.None:
                barAxis.Key           = null;
                barAxis.StartPosition = 0.0;
                pm.Axes.Add(timeAxis);
                pm.Axes.Add(barAxis);
                break;

            case VolumeStyle.Combined:
            case VolumeStyle.Stacked:
                pm.Axes.Add(timeAxis);
                pm.Axes.Add(barAxis);
                pm.Axes.Add(volAxis);
                break;

            case VolumeStyle.PositiveNegative:
                volAxis.Minimum = naturalV ? double.NaN : -5000;
                pm.Axes.Add(timeAxis);
                pm.Axes.Add(barAxis);
                pm.Axes.Add(volAxis);
                break;
            }

            pm.Series.Add(series);

            if (naturalY == false)
            {
                timeAxis.AxisChanged += (sender, e) => AdjustYExtent(series, timeAxis, barAxis);
            }

            var controller = new PlotController();

            controller.UnbindAll();
            controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt);
            return(new Example(pm, controller));
        }
コード例 #45
0
ファイル: LblData.cs プロジェクト: ptownsin/LFS_Stats_CSV
        public void Draw()
        {
            this.plot.Clear();

            Grid testGrid = new Grid();

            testGrid.VerticalGridType   = Grid.GridType.Coarse;
            testGrid.HorizontalGridType = Grid.GridType.Coarse;
            testGrid.MajorGridPen       = new Pen(Color.LightGray, 1f);
            this.plot.Add(testGrid);

            xmax = ((long[])splits[winner]).Length / nsplits;
            int tickstep = 1;

            if (xmax <= 30)
            {
                tickstep = 1;
            }
            else
            if (xmax > 30 && xmax <= 60)
            {
                tickstep = 2;
            }
            else
            if (xmax > 60)
            {
                tickstep = 3;
            }

            LinearAxis lx1 = new LinearAxis();

            /*			if (tickstep > 1)
             *                              lx1.NumberOfSmallTicks = 0;
             *                      else
             *                              lx1.NumberOfSmallTicks = nsplits -1;
             */
            lx1.NumberOfSmallTicks = 0;
            lx1.LargeTickStep      = tickstep;
            lx1.HideTickText       = true;
            lx1.WorldMin           = 0;
            lx1.WorldMax           = xmax;
            lx1.TicksCrossAxis     = true;
            this.plot.XAxis1       = lx1;

            LinearAxis lx2 = new LinearAxis(this.plot.XAxis1);

            lx2.Label = Settings.LapByLapGraphXAxisLabel;
            lx2.NumberOfSmallTicks         = 0;
            lx2.LargeTickStep              = tickstep;
            lx2.WorldMin                   = 0;
            lx2.WorldMax                   = xmax;
            lx2.HideTickText               = false;
            lx2.LabelFont                  = Settings.commonFont;
            this.plot.XAxis2               = lx2;
            this.plot.XAxis1.LargeTickSize = 0;

            LinearAxis ly1 = new LinearAxis();

            ly1.Label = Settings.LapByLapGraphYAxisLabel;
            ly1.NumberOfSmallTicks = 0;
            ly1.Reversed           = true;
            ly1.LargeTickStep      = 1;
            ly1.WorldMin           = 0.5f;
            ly1.WorldMax           = players.Count + 0.5f;
            ly1.LabelFont          = Settings.commonFont;
            ly1.TicksCrossAxis     = true;
            this.plot.YAxis1       = ly1;

            LinearAxis ly2 = new LinearAxis();

            ly2.NumberOfSmallTicks = 0;
            ly2.Reversed           = true;
            ly2.LargeTickStep      = 1;
            ly2.WorldMin           = 0.5f;
            ly2.WorldMax           = players.Count + 0.5f;
            ly2.LabelFont          = Settings.commonFont;
            ly2.TickTextNextToAxis = false;
            ly2.Label          = "";
            ly2.TicksCrossAxis = true;
            this.plot.YAxis2   = ly2;

            this.plot.Title     = Settings.LapByLapGraphTitle;
            this.plot.TitleFont = Settings.titleFont;

            Legend lg = new Legend();

            lg.Font          = Settings.commonFont;
            lg.XOffset       = 30;
            lg.BorderStyle   = Settings.legendBorderType;
            this.plot.Legend = lg;

            this.plot.PlotBackColor = Color.White;
            this.plot.BackColor     = Color.White;

            //			double minx = 0;

            for (int i = 0; i < players.Count; ++i)
            //			for (int i=winner; i<= winner; ++i)
            {
                int[]    positions = new int[((long[])splits[i]).Length];
                double[] laps      = new double[((long[])splits[i]).Length];
                int      splitN    = 0;
                int      l         = 0;

                for (int split = 0; split < ((long[])splits[winner]).Length; ++split)
                {
                    if (split < positions.Length)
                    {
                        double prop = 0;
                        for (int pr = 0; pr < splitN; ++pr)
                        {
                            prop += winner_avgsplitsproportions[pr + 1];
                        }
                        laps[split] = (double)l + prop;
                    }

                    int pos = 1;

                    for (int p = 0; p < players.Count; ++p)
                    {
                        if (p != i && ((long[])(splits[i])).Length > split && ((long[])(splits[p])).Length > split && ((long[])(splits[p]))[split] < ((long[])(splits[i]))[split])
                        {
                            ++pos;
                        }
                    }

                    if (split < positions.Length)
                    {
                        positions[split] = pos;
                    }

                    ++splitN;
                    if (splitN == nsplits)
                    {
                        splitN = 0;
                        ++l;
                    }
                }


                LinePlot lp = new LinePlot();
                //				lp.DataSource = positions;
                lp.AbscissaData = laps;
                lp.OrdinateData = positions;

                lp.Pen = new Pen(Colors.GetColor(i), 2.0f);
                int start = i + 1;
                int end   = start;
                if (positions.Length - 1 >= 0)
                {
                    end = positions[positions.Length - 1];
                }

                if (Settings.LapByLapGraphDisplayPositions)
                {
                    lp.Label = String.Format("{0:00}-{1:00} {2:g}", start, end, players[i].ToString());
                }
                else
                {
                    lp.Label = String.Format("{0:g}", players[i].ToString());
                }

                this.plot.Add(lp);
                this.plot.YAxis1.WorldMin = 0;
                this.plot.YAxis2.WorldMin = 0;

                /*
                 *                              Marker mk = new Marker();
                 *                              mk.Color = System.Drawing.Color.Red;
                 * //                mk.Type = Marker.MarkerType.FlagUp;
                 *                              mk.Type = Marker.MarkerType.FlagUp;
                 *                              mk.Size = 15;
                 *                              int[] abs = {1,2,3,4,5,6,7,8,9,10};
                 *                              int[] ord = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
                 *                              abs.Add
                 *                              PointPlot pp = new PointPlot(mk);
                 *                              pp.ShowInLegend = false;
                 *                              pp.AbscissaData = abs;
                 *                              pp.OrdinateData = ord;
                 *                              this.plot.Add(pp);
                 */

                this.plot.XAxis1.WorldMax = xmax;
                this.plot.XAxis2.WorldMax = xmax;
            }

            this.plot.YAxis1.WorldMax = players.Count + 0.5f;

            lx1.WorldMin = 0;
            lx1.WorldMax = xmax;
            lx2.WorldMin = 0;
            lx2.WorldMax = xmax;

            this.plot.Refresh();
        }
コード例 #46
0
ファイル: MainViewModel3.cs プロジェクト: w1r2p1/TRx
        /// <summary>
        /// Adjusts the Y extent.
        /// </summary>
        /// <param name="series">Series.</param>
        /// <param name="xaxis">Xaxis.</param>
        /// <param name="yaxis">Yaxis.</param>
        private static void AdjustYExtent(CandleStickAndVolumeSeries series, DateTimeAxis xaxis, LinearAxis yaxis)
        {
            var xmin = xaxis.ActualMinimum;
            var xmax = xaxis.ActualMaximum;

            var istart = series.FindByX(xmin);
            var iend   = series.FindByX(xmax, istart);

            var ymin = double.MaxValue;
            var ymax = double.MinValue;

            for (int i = istart; i <= iend; i++)
            {
                var bar = series.Items[i];
                ymin = Math.Min(ymin, bar.Low);
                ymax = Math.Max(ymax, bar.High);
            }

            var extent = ymax - ymin;
            var margin = extent * 0.10;

            yaxis.Zoom(ymin - margin, ymax + margin);
        }
コード例 #47
0
        async Task OnLoadGraphCommand(int?Month)
        {
            try
            {
                IsBusy = true;

                Model.InvalidatePlot(true);

                var linearAxis1 = new LinearAxis();
                linearAxis1.AbsoluteMinimum = 0;
                linearAxis1.AbsoluteMaximum = 50;


                var barSeries = new ColumnSeries
                {
                    LabelPlacement    = LabelPlacement.Inside,
                    LabelFormatString = "{0}",
                };
                int?month = Month == 0 || Month == null ? 0 : Month;
                if (month == 0)
                {
                    month = 0;
                }


                var userId = Preferences.Get(AuthorizeConstants.UserIdKey, null);

                var data = await _reservationServices.GraphMonthReservation(Convert.ToInt32(userId), (int)month, 1, 100);

                if (data == null)
                {
                    await Shell.Current.DisplayAlert("แจ้งเตือน!", "ไม่มีช้อมูลที่คุณเลือก", "ตกลง");

                    await Shell.Current.Navigation.PopAsync();

                    return;
                }
                int[] CountArrays = new int[32];

                foreach (var item in data)
                {
                    for (int i = 1; i <= 31; i++)
                    {
                        if (i == item.Days.Value)
                        {
                            CountArrays[item.Days.Value] = CountArrays[item.Days.Value] + 1;
                        }
                        else
                        {
                            CountArrays[item.Days.Value] = CountArrays[item.Days.Value] + 0;
                        }
                    }
                }
                var strings = Enumerable.Range(1, 31)
                              .Select(i => i.ToString()).ToArray();
                for (int i = 2; i <= 32; i++)
                {
                    barSeries.Items.Add(new ColumnItem
                    {
                        Value = Convert.ToDouble(CountArrays[i - 1]),
                        Color = OxyColor.FromRgb((byte)rnd.Next(256), (byte)rnd.Next(256), (byte)rnd.Next(256))
                    });
                }
                Model.Axes.Add(new CategoryAxis
                {
                    Position       = AxisPosition.Bottom,
                    Key            = "Sample Data",
                    ItemsSource    = strings,
                    IsPanEnabled   = false,
                    IsZoomEnabled  = false,
                    Selectable     = false,
                    IntervalLength = 300,
                });
                Model.Axes.Add(linearAxis1);
                Model.Series.Add(barSeries);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
                Model.InvalidatePlot(true);
            }
        }
コード例 #48
0
        /// <summary>
        /// Initializes a new instance of the ErrorMapViewModel class.
        /// </summary>
        /// <param name="dialogService">
        /// The dialog Service.
        /// </param>
        public ErrorMapViewModel(IDialogService dialogService)
        {
            this.dialogService = dialogService;
            plotModel          = new ViewResolvingPlotModel {
                Title = "Error Map", PlotAreaBackground = OxyColors.DimGray
            };
            selectedPeakDataPoints      = new IList <PeakDataPoint> [0];
            minimumIonIntensity         = 0;
            ShouldCombineChargeStates   = true;
            TableShouldIncludeUnmatched = false;

            // Init x axis
            xAxis = new LinearAxis
            {
                Title           = "Amino Acid",
                Position        = AxisPosition.Top,
                AbsoluteMinimum = 0,
                Minimum         = 0,
                MajorTickSize   = 0,
                MinorStep       = 2,
                Angle           = -90,
                MinorTickSize   = 10,
                MaximumPadding  = 0,
                FontSize        = 10
            };
            plotModel.Axes.Add(xAxis);

            // Init Y axis
            yAxis = new LinearAxis
            {
                Title           = "Ion Type",
                Position        = AxisPosition.Left,
                AbsoluteMinimum = 0,
                Minimum         = 0,
                MajorStep       = 1.0,
                MajorTickSize   = 0,
                MinorStep       = 0.5,
                MinorTickSize   = 20,
                MaximumPadding  = 0,
                FontSize        = 10
            };
            plotModel.Axes.Add(yAxis);

            // Init Color axis
            var minColor = OxyColors.Navy;
            var medColor = OxyColors.White;
            var maxColor = OxyColors.DarkRed;

            colorAxis = new LinearColorAxis
            {
                Title           = "Error",
                Position        = AxisPosition.Right,
                AxisDistance    = -0.5,
                AbsoluteMinimum = 0,
                Palette         = OxyPalette.Interpolate(1000, minColor, medColor, maxColor),
                Minimum         = -1 * IcParameters.Instance.ProductIonTolerancePpm.GetValue(),
                Maximum         = IcParameters.Instance.ProductIonTolerancePpm.GetValue(),
                AbsoluteMaximum = IcParameters.Instance.ProductIonTolerancePpm.GetValue(),
                LowColor        = OxyColors.DimGray,
            };
            plotModel.Axes.Add(colorAxis);

            this.WhenAnyValue(x => x.ShouldCombineChargeStates).Subscribe(_ => UpdateNow());

            this.WhenAnyValue(x => x.TableShouldIncludeUnmatched).Subscribe(_ => UpdateNow());

            // Save As Image Command requests a file path from the user and then saves the error map as an image
            SaveAsImageCommand = ReactiveCommand.Create(SaveAsImageImpl);

            SaveDataTableCommand = ReactiveCommand.Create(SaveDataTableImpl);

            UpdateNowCommand = ReactiveCommand.Create(UpdateNow);

            ZoomOutCommand = ReactiveCommand.Create(ZoomOutPlot);
        }
コード例 #49
0
        public AnalysisViewModel()
        {
            this.plotModelGood = new PlotModel {
                Title = "A"
            };                                                  //良かったこと

            var xaxis = new CategoryAxis();

            xaxis.Position           = AxisPosition.Bottom;
            xaxis.MajorGridlineStyle = LineStyle.Solid;
            xaxis.MinorGridlineStyle = LineStyle.Dot;
            xaxis.Labels.Add("10/06");
            xaxis.Labels.Add("10/07");
            xaxis.Labels.Add("10/08");
            xaxis.Labels.Add("10/09");
            xaxis.Labels.Add("10/10");
            xaxis.Labels.Add("10/11");
            xaxis.Labels.Add("10/12");
            xaxis.FontSize = 8.0;

            var yaxis = new LinearAxis();

            yaxis.Position           = AxisPosition.Left;
            yaxis.MajorGridlineStyle = LineStyle.Dot;
            yaxis.MinorGridlineStyle = LineStyle.Dot;
            yaxis.FontSize           = 8.0;

            var columnSeriesGood = new ColumnSeries();

            columnSeriesGood.Items.Add(new ColumnItem(5));
            columnSeriesGood.Items.Add(new ColumnItem(8));
            columnSeriesGood.Items.Add(new ColumnItem(2));
            columnSeriesGood.Items.Add(new ColumnItem(12));
            columnSeriesGood.Items.Add(new ColumnItem(4));
            columnSeriesGood.Items.Add(new ColumnItem(1));
            columnSeriesGood.Items.Add(new ColumnItem(9));

            plotModelGood.Axes.Add(xaxis);
            plotModelGood.Axes.Add(yaxis);
            plotModelGood.Series.Add(columnSeriesGood);

            plotModel = new PlotModel {
                Title = "B"
            };                                         //気分

            var xaxisLine = new CategoryAxis();

            xaxisLine.Position           = AxisPosition.Bottom;
            xaxisLine.MajorGridlineStyle = LineStyle.Solid;
            xaxisLine.MinorGridlineStyle = LineStyle.Dot;
            xaxisLine.Labels.Add("10/06");
            xaxisLine.Labels.Add("10/07");
            xaxisLine.Labels.Add("10/08");
            xaxisLine.Labels.Add("10/09");
            xaxisLine.Labels.Add("10/10");
            xaxisLine.Labels.Add("10/11");
            xaxisLine.Labels.Add("10/12");
            xaxisLine.FontSize = 8.0;

            var yaxisLine = new LinearAxis();

            yaxisLine.Position           = AxisPosition.Left;
            yaxisLine.MajorGridlineStyle = LineStyle.Dot;
            yaxisLine.MinorGridlineStyle = LineStyle.Dot;
            yaxisLine.FontSize           = 8.0;

            plotModel.Axes.Add(xaxisLine);
            plotModel.Axes.Add(yaxisLine);
            plotModel.Series.Add(new LineSeries
            {
                Points =
                {
                    new DataPoint(0, 2.5),
                    new DataPoint(1, 3.0),
                    new DataPoint(2, 4.8),
                    new DataPoint(3, 2.2),
                    new DataPoint(4, 3.4),
                    new DataPoint(5, 5.0),
                    new DataPoint(6, 1.2),
                }
            });

            plotModelComposite = new PlotModel {
                Title = "C"
            };                                                  // 複合

            var xaxisComposite = new CategoryAxis();

            xaxisComposite.Position           = AxisPosition.Bottom;
            xaxisComposite.MajorGridlineStyle = LineStyle.Solid;
            xaxisComposite.MinorGridlineStyle = LineStyle.Dot;
            xaxisComposite.Labels.Add("10/06");
            xaxisComposite.Labels.Add("10/07");
            xaxisComposite.Labels.Add("10/08");
            xaxisComposite.Labels.Add("10/09");
            xaxisComposite.Labels.Add("10/10");
            xaxisComposite.Labels.Add("10/11");
            xaxisComposite.Labels.Add("10/12");
            xaxisComposite.FontSize = 8.0;

            var yaxisComposite1 = new LinearAxis();

            yaxisComposite1.Position           = AxisPosition.Left;
            yaxisComposite1.MajorGridlineStyle = LineStyle.None;
            yaxisComposite1.MinorGridlineStyle = LineStyle.None;
            yaxisComposite1.Key      = "1";
            yaxisComposite1.FontSize = 8.0;

            var yaxisComposite2 = new LinearAxis();

            yaxisComposite2.Position           = AxisPosition.Right;
            yaxisComposite2.Maximum            = 5;
            yaxisComposite2.Minimum            = 0;
            yaxisComposite2.MajorGridlineStyle = LineStyle.None;
            yaxisComposite2.MinorGridlineStyle = LineStyle.None;
            yaxisComposite2.Key      = "2";
            yaxisComposite2.FontSize = 8.0;

            var columnSeriesComposite = new ColumnSeries();

            columnSeriesComposite.Items.Add(new ColumnItem(5));
            columnSeriesComposite.Items.Add(new ColumnItem(8));
            columnSeriesComposite.Items.Add(new ColumnItem(2));
            columnSeriesComposite.Items.Add(new ColumnItem(12));
            columnSeriesComposite.Items.Add(new ColumnItem(4));
            columnSeriesComposite.Items.Add(new ColumnItem(1));
            columnSeriesComposite.Items.Add(new ColumnItem(9));

            plotModelComposite.Axes.Add(xaxisComposite);
            plotModelComposite.Axes.Add(yaxisComposite1);
            plotModelComposite.Axes.Add(yaxisComposite2);
            columnSeriesComposite.YAxisKey = "1";
            plotModelComposite.Series.Add(columnSeriesComposite);
            plotModelComposite.Series.Add(new LineSeries
            {
                Points =
                {
                    new DataPoint(0, 2.5),
                    new DataPoint(1, 3.0),
                    new DataPoint(2, 4.8),
                    new DataPoint(3, 2.2),
                    new DataPoint(4, 3.4),
                    new DataPoint(5, 5.0),
                    new DataPoint(6, 1.2),
                },
                YAxisKey = "2"
            });
        }
コード例 #50
0
        public void Show(IBlockTimestampInterpolator blockTimestampInterpolator, string[] names, BlockGraphItem <int>[][] array)
        {
            Contract.Requires(names.Length == array.Length);

            lock (_plotModel.SyncRoot)
            {
                ConfigureAxes(blockTimestampInterpolator, array);

                _plotModel.Series.Clear();

                const double GapSize   = 0.05;
                int          AxisCount = names.Length;
                double       size      = (1 - GapSize * (AxisCount - 1)) / AxisCount;
                double       start     = 0;

                for (int axisCounter = 0; axisCounter < names.Length; axisCounter++)
                {
                    var data = array[axisCounter];

                    var yAxisKey = Guid.NewGuid().ToString();
                    var yAxis    = new LinearAxis()
                    {
                        Position      = AxisPosition.Left,
                        Key           = yAxisKey,
                        StartPosition = start,
                        EndPosition   = start + size,
                        Title         = names[axisCounter]
                    };
                    start += size + GapSize;

                    _plotModel.Axes.Add(yAxis);
                    var series = new LineSeries()
                    {
                        CanTrackerInterpolatePoints = false,
                        YAxisKey = yAxisKey
                    };

                    _plotModel.Series.Add(series);

                    ref var lastPoint = ref data[0];
                    series.Points.Add(new DataPoint(
                                          TimeSpanAxis.ToDouble(blockTimestampInterpolator.GetBlockTimestamp(lastPoint.BlockNumber)),
                                          lastPoint.Data));

                    int maxVotes = lastPoint.Data;
                    for (int i = 1; i < data.Length; i++)
                    {
                        ref var currentPoint = ref data[i];
                        for (int point = lastPoint.BlockNumber + 1; point < currentPoint.BlockNumber; point++)
                        {
                            var xPoint = TimeSpanAxis.ToDouble(blockTimestampInterpolator.GetBlockTimestamp(point));
                            series.Points.Add(new DataPoint(xPoint, 0));
                        }
                        if (currentPoint.Data > maxVotes)
                        {
                            maxVotes = currentPoint.Data;
                        }
                        series.Points.Add(new DataPoint(TimeSpanAxis.ToDouble(blockTimestampInterpolator.GetBlockTimestamp(currentPoint.BlockNumber)), currentPoint.Data));
                        lastPoint = currentPoint;
                    }
                    yAxis.SetAxisMin(0);
                    yAxis.SetAxisMax(maxVotes);
                }
コード例 #51
0
        public StrokeNumberSection(PlotStyle plotStyle, int strokeNumber, IDictionary <string, List <Models.Rally> > sets, Models.Match match, object p)
        {
            NumberPlots = new List <PlotModel>();

            foreach (var set in sets.Keys)
            {
                if (sets[set].Count > 0)
                {
                    var statistics = new TechniqueStatistics(match, p, sets[set], strokeNumber);

                    PlotModel plot = plotStyle.CreatePlot();
                    plot.Title                   = GetSetTitleString(set);
                    plot.TitleFontSize           = 16;
                    plot.LegendOrientation       = LegendOrientation.Horizontal;
                    plot.LegendPlacement         = LegendPlacement.Outside;
                    plot.LegendPosition          = LegendPosition.BottomCenter;
                    plot.PlotAreaBorderThickness = new OxyThickness(1, 0, 0, 1);

                    var categoryAxis = new CategoryAxis();
                    categoryAxis.Position  = AxisPosition.Bottom;
                    categoryAxis.MinorStep = 1;

                    var linearAxis = new LinearAxis();
                    linearAxis.Position        = AxisPosition.Left;
                    linearAxis.MinorStep       = 1;
                    linearAxis.MajorStep       = 4;
                    linearAxis.AbsoluteMinimum = 0;
                    linearAxis.MaximumPadding  = 0.06;
                    linearAxis.MinimumPadding  = 0;

                    var techniqueToSeries = new Dictionary <string, ColumnSeries>();

                    int index = 0;
                    foreach (var number in statistics.NumberToTechniqueCountDict.Keys)
                    {
                        var numberCount = 0;
                        foreach (var count in statistics.NumberToTechniqueCountDict[number].Values)
                        {
                            numberCount += count;
                        }

                        if (numberCount > 0)
                        {
                            categoryAxis.Labels.Add(string.Format("{0} ({1})", number, numberCount));

                            foreach (var technique in statistics.NumberToTechniqueCountDict[number].Keys)
                            {
                                var techniqueCount = statistics.NumberToTechniqueCountDict[number][technique];
                                if (techniqueCount > 0)
                                {
                                    ColumnSeries series;
                                    if (techniqueToSeries.ContainsKey(technique))
                                    {
                                        series = techniqueToSeries[technique];
                                    }
                                    else
                                    {
                                        series = GetNewSeries(technique);
                                        techniqueToSeries[technique] = series;
                                    }
                                    series.Items.Add(new ColumnItem(techniqueCount, categoryIndex: index));
                                }
                            }
                            index++;
                        }
                    }

                    foreach (var series in techniqueToSeries.Values)
                    {
                        plot.Series.Add(series);
                    }

                    plot.Axes.Add(categoryAxis);
                    plot.Axes.Add(linearAxis);

                    NumberPlots.Add(plot);

                    Debug.WriteLine("{2} for stroke {0} of set {1} ready.", GetStrokeNumberString(strokeNumber), set, SectionName);
                }
            }
        }
コード例 #52
0
        // [ref] ${OxyPlot_HOME}/NET45/Examples/ExampleBrowser/ExampleBrowser.exe.
        static void runMarketTypes()
        {
            var plotModel = new PlotModel();

            plotModel.Title = "Marker types";

            var linearAxis1 = new LinearAxis();

            linearAxis1.Position = AxisPosition.Bottom;
            plotModel.Axes.Add(linearAxis1);

            var linearAxis2 = new LinearAxis();

            plotModel.Axes.Add(linearAxis2);

            var lineSeries1 = new LineSeries();

            lineSeries1.MarkerStroke = OxyColors.Black;
            lineSeries1.MarkerType   = MarkerType.Circle;
            lineSeries1.Title        = "Circle";
            lineSeries1.Points.Add(new DataPoint(11.8621869598805, 1.4144100893356));
            lineSeries1.Points.Add(new DataPoint(18.1636718735861, 3.34725344383496));
            lineSeries1.Points.Add(new DataPoint(26.1161091961507, 5.10126935043431));
            lineSeries1.Points.Add(new DataPoint(29.99451482482, 6.99704349646207));
            lineSeries1.Points.Add(new DataPoint(41.9055463103138, 8.21414295500803));
            lineSeries1.Points.Add(new DataPoint(48.6674896314123, 9.55912132400978));
            lineSeries1.Points.Add(new DataPoint(56.0143694207139, 10.8773872386093));
            lineSeries1.Points.Add(new DataPoint(67.4011132397694, 12.2735980540857));
            lineSeries1.Points.Add(new DataPoint(74.2207925069243, 13.5990719658318));
            lineSeries1.Points.Add(new DataPoint(78.4307891402537, 14.9570749639334));
            plotModel.Series.Add(lineSeries1);

            var lineSeries2 = new LineSeries();

            lineSeries2.MarkerStroke = OxyColors.Black;
            lineSeries2.MarkerType   = MarkerType.Cross;
            lineSeries2.Title        = "Cross";
            lineSeries2.Points.Add(new DataPoint(10.2551460425626, 1.12034707615168));
            lineSeries2.Points.Add(new DataPoint(17.2749783542356, 2.66979351810636));
            lineSeries2.Points.Add(new DataPoint(21.436097549012, 4.12809186853845));
            lineSeries2.Points.Add(new DataPoint(30.78668166268, 5.20108992848596));
            lineSeries2.Points.Add(new DataPoint(33.2050538869598, 6.637421580794));
            lineSeries2.Points.Add(new DataPoint(45.0304378052384, 7.66540479830718));
            lineSeries2.Points.Add(new DataPoint(56.7345610422709, 9.54063240976102));
            lineSeries2.Points.Add(new DataPoint(66.1928816270981, 10.7854569441571));
            lineSeries2.Points.Add(new DataPoint(74.2900140398601, 12.665478166037));
            lineSeries2.Points.Add(new DataPoint(79.0780252865879, 13.7934278663217));
            plotModel.Series.Add(lineSeries2);

            var lineSeries3 = new LineSeries();

            lineSeries3.MarkerStroke = OxyColors.Black;
            lineSeries3.MarkerType   = MarkerType.Diamond;
            lineSeries3.Title        = "Diamond";
            lineSeries3.Points.Add(new DataPoint(8.23705901030314, 1.04818704773122));
            lineSeries3.Points.Add(new DataPoint(15.3159614062477, 2.61679908755086));
            lineSeries3.Points.Add(new DataPoint(26.0893045543178, 3.88729132986036));
            lineSeries3.Points.Add(new DataPoint(30.3871664714008, 5.60047892089955));
            lineSeries3.Points.Add(new DataPoint(42.2880761336014, 6.83121995620021));
            lineSeries3.Points.Add(new DataPoint(45.5782417531955, 8.70534298555243));
            lineSeries3.Points.Add(new DataPoint(53.6039859063942, 9.76094881480604));
            lineSeries3.Points.Add(new DataPoint(63.170427156226, 11.6268204346424));
            lineSeries3.Points.Add(new DataPoint(74.2946957379089, 13.5075224840583));
            lineSeries3.Points.Add(new DataPoint(83.4620100881262, 14.6444678658827));
            plotModel.Series.Add(lineSeries3);

            var lineSeries4 = new LineSeries();

            lineSeries4.MarkerStroke = OxyColors.Black;
            lineSeries4.MarkerType   = MarkerType.Plus;
            lineSeries4.Title        = "Plus";
            lineSeries4.Points.Add(new DataPoint(2.18957495232559, 1.11484250291942));
            lineSeries4.Points.Add(new DataPoint(12.7289441883233, 2.66961399916076));
            lineSeries4.Points.Add(new DataPoint(17.0745548555043, 4.11782511375743));
            lineSeries4.Points.Add(new DataPoint(22.8202153084894, 5.77728548123375));
            lineSeries4.Points.Add(new DataPoint(30.5445538696575, 7.4711353287432));
            lineSeries4.Points.Add(new DataPoint(40.409529611659, 9.07308203357881));
            lineSeries4.Points.Add(new DataPoint(42.8762574823928, 10.166131996627));
            lineSeries4.Points.Add(new DataPoint(52.219228453105, 11.9434595531521));
            lineSeries4.Points.Add(new DataPoint(60.3437968186772, 13.8768307444997));
            lineSeries4.Points.Add(new DataPoint(69.0649180901539, 15.8224504216679));
            plotModel.Series.Add(lineSeries4);

            var lineSeries5 = new LineSeries();

            lineSeries5.MarkerStroke = OxyColors.Black;
            lineSeries5.MarkerType   = MarkerType.Square;
            lineSeries5.Title        = "Square";
            lineSeries5.Points.Add(new DataPoint(4.28512158723787, 1.0218708203276));
            lineSeries5.Points.Add(new DataPoint(7.11419252451239, 2.83296700745493));
            lineSeries5.Points.Add(new DataPoint(12.1873434279986, 3.94138236993057));
            lineSeries5.Points.Add(new DataPoint(18.4414314499318, 5.85618886438021));
            lineSeries5.Points.Add(new DataPoint(21.6272663146384, 7.73614930302657));
            lineSeries5.Points.Add(new DataPoint(26.9512430769164, 9.46516049488688));
            lineSeries5.Points.Add(new DataPoint(30.584140945498, 10.6070162377353));
            lineSeries5.Points.Add(new DataPoint(33.6740629960196, 12.1158796358462));
            lineSeries5.Points.Add(new DataPoint(37.6165642373341, 14.0689983791993));
            lineSeries5.Points.Add(new DataPoint(42.9570739683495, 15.4981215794096));
            plotModel.Series.Add(lineSeries5);

            var lineSeries6 = new LineSeries();

            lineSeries6.MarkerStroke = OxyColors.Black;
            lineSeries6.MarkerType   = MarkerType.Star;
            lineSeries6.Title        = "Star";
            lineSeries6.Points.Add(new DataPoint(10.9592619701099, 1.57032582423199));
            lineSeries6.Points.Add(new DataPoint(14.3667993193338, 2.86656694294259));
            lineSeries6.Points.Add(new DataPoint(20.8092339303387, 4.3936368000664));
            lineSeries6.Points.Add(new DataPoint(31.0837363531272, 5.90316125233805));
            lineSeries6.Points.Add(new DataPoint(36.2968236749511, 7.88247782079618));
            lineSeries6.Points.Add(new DataPoint(40.8309715077425, 9.86153348761682));
            lineSeries6.Points.Add(new DataPoint(44.9168707304247, 11.6326452454704));
            lineSeries6.Points.Add(new DataPoint(56.0012029614305, 13.6297319203754));
            lineSeries6.Points.Add(new DataPoint(58.3205570533502, 14.6725726568478));
            lineSeries6.Points.Add(new DataPoint(62.7951211122773, 15.7987183610903));
            plotModel.Series.Add(lineSeries6);

            var lineSeries7 = new LineSeries();

            lineSeries7.MarkerStroke = OxyColors.Black;
            lineSeries7.MarkerType   = MarkerType.Triangle;
            lineSeries7.Title        = "Triangle";
            lineSeries7.Points.Add(new DataPoint(2.2280231240336, 1.45975955084886));
            lineSeries7.Points.Add(new DataPoint(9.6367919340901, 3.15223296831932));
            lineSeries7.Points.Add(new DataPoint(15.2513136469067, 4.20971935065916));
            lineSeries7.Points.Add(new DataPoint(21.6378828266812, 6.11453639488413));
            lineSeries7.Points.Add(new DataPoint(33.4784604066417, 7.33997009384445));
            lineSeries7.Points.Add(new DataPoint(41.3092347305777, 8.99930818704856));
            lineSeries7.Points.Add(new DataPoint(49.3024369130388, 10.2422971139859));
            lineSeries7.Points.Add(new DataPoint(51.7993717146103, 11.9004834484777));
            lineSeries7.Points.Add(new DataPoint(62.6105425686625, 13.6871494234945));
            lineSeries7.Points.Add(new DataPoint(68.2790698289308, 15.4673946567194));
            plotModel.Series.Add(lineSeries7);

            //
#if false
            String output_filename = "../data/visualization/oxyplot/lineseries_marker_type.png";
            using (var stream = File.Create(output_filename))
            {
                System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    new Action(
                        delegate
                {
                    OxyPlot.Wpf.PngExporter.Export(plotModel, stream, 600, 400, OxyColors.White);          // run-time error.
                }
                        )
                    );
            }
#elif true
            String output_filename = "../data/visualization/oxyplot/lineseries_marker_type.pdf";
            using (var stream = File.Create(output_filename))
            {
                PdfExporter.Export(plotModel, stream, 600, 400);
            }
#elif true
            // Copy to clipboard.
            using (var stream = new MemoryStream())
            {
                OxyPlot.Wpf.PngExporter.Export(plotModel, stream, 600, 400, OxyColors.White);  // run-time error.
            }
#endif
        }
コード例 #53
0
        private PlotModel CreatePlotModelChorale()
        {
            var plotModel = new PlotModel
            {
                Subtitle = $"Semanantic Link: {SemanticLinkCurrent.SemanticLinkId}, Direction: {Direction}"
            };

            var colorAxis = new LinearColorAxis
            {
                HighColor = OxyColors.Gray,
                LowColor  = OxyColors.Black,
                Position  = AxisPosition.Right
            };

            plotModel.Axes.Add(colorAxis);

            var xAxis = new LinearAxis
            {
                Title    = "Transit Time",
                Unit     = "s",
                Position = AxisPosition.Bottom
            };

            plotModel.Axes.Add(xAxis);

            var yAxis = new LinearAxis
            {
                Title = "Lost Energy",
                Unit  = "kWh"
            };

            plotModel.Axes.Add(yAxis);

            var heatMapSeries = new HeatMapSeries
            {
                LabelFormatString = "0",
                X0            = ChoraleModel.MinTransitTime,
                X1            = ChoraleModel.MaxTransitTime,
                Y0            = ChoraleModel.MinLostEnegry,
                Y1            = ChoraleModel.MaxLostEnergy,
                LabelFontSize = 0.2,
                Data          = ChoraleModel.Data
            };

            plotModel.Series.Add(heatMapSeries);

            var scatterSeries = new ScatterSeries
            {
                MarkerFill = OxyColors.Black,
                MarkerType = MarkerType.Circle,
                MarkerSize = 30
            };
            var lostEnergy  = Calculator.LostEnergyList.Sum();
            var transitTime = (int)(Calculator.PositionCollection.Last().Timestamp -
                                    Calculator.PositionCollection.First().Timestamp).TotalSeconds;

            scatterSeries.Points.Add(new ScatterPoint(transitTime, lostEnergy)
            {
                Value = 0
            });
            plotModel.Series.Add(scatterSeries);

            return(plotModel);
        }
コード例 #54
0
        /// <summary>
        /// Background process for performing coherence analysis
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BW_CoherenceAnalysisEDF(object sender, DoWorkEventArgs e)
        {
            #region Plot Series 1 in Time Domain

            // Get Series 1
            float      sample_period_1;
            LineSeries series_1 = GetSeriesFromSignalName(out sample_period_1,
                                                          CoherenceEDFSelectedSignal1,
                                                          Utils.EpochtoDateTime(CoherenceEDFStartRecord ?? 1, LoadedEDFFile),
                                                          Utils.EpochtoDateTime(CoherenceEDFStartRecord ?? 1, LoadedEDFFile) + Utils.EpochPeriodtoTimeSpan(CoherenceEDFDuration ?? 1)
                                                          );

            // Plot Series 1
            {
                PlotModel temp_SignalPlot = new PlotModel();

                DateTimeAxis xAxis = new DateTimeAxis();
                xAxis.Key     = "DateTime";
                xAxis.Minimum = DateTimeAxis.ToDouble(Utils.EpochtoDateTime(CoherenceEDFStartRecord ?? 1, LoadedEDFFile));
                xAxis.Maximum = DateTimeAxis.ToDouble(Utils.EpochtoDateTime(CoherenceEDFStartRecord ?? 1, LoadedEDFFile) + Utils.EpochPeriodtoTimeSpan(CoherenceEDFDuration ?? 1));
                temp_SignalPlot.Axes.Add(xAxis);

                LinearAxis yAxis = new LinearAxis();
                yAxis.MajorGridlineStyle = LineStyle.Solid;
                yAxis.MinorGridlineStyle = LineStyle.Dot;
                yAxis.Title = CoherenceEDFSelectedSignal1 + " (Time)";
                yAxis.Key   = CoherenceEDFSelectedSignal1 + " (Time)";

                if (CoherenceUseConstantAxis)
                {
                    yAxis.Maximum = Utils.GetMaxSignalValue(CoherenceEDFSelectedSignal1, false, LoadedEDFFile, sm);
                    yAxis.Minimum = Utils.GetMinSignalValue(CoherenceEDFSelectedSignal1, false, LoadedEDFFile, sm);
                }

                temp_SignalPlot.Axes.Add(yAxis);

                series_1.YAxisKey = CoherenceEDFSelectedSignal1 + " (Time)";
                series_1.XAxisKey = "DateTime";
                temp_SignalPlot.Series.Add(series_1);

                CoherenceSignalPlot1 = temp_SignalPlot;
            }

            #endregion

            #region Plot Series 2 in Time Domain

            // Get Series 2
            float      sample_period_2;
            LineSeries series_2 = GetSeriesFromSignalName(out sample_period_2,
                                                          CoherenceEDFSelectedSignal2,
                                                          Utils.EpochtoDateTime(CoherenceEDFStartRecord ?? 1, LoadedEDFFile),
                                                          Utils.EpochtoDateTime(CoherenceEDFStartRecord ?? 1, LoadedEDFFile) + Utils.EpochPeriodtoTimeSpan(CoherenceEDFDuration ?? 1)
                                                          );

            // Plot Series 2
            {
                PlotModel temp_SignalPlot = new PlotModel();

                DateTimeAxis xAxis = new DateTimeAxis();
                xAxis.Key     = "DateTime";
                xAxis.Minimum = DateTimeAxis.ToDouble(Utils.EpochtoDateTime(CoherenceEDFStartRecord ?? 1, LoadedEDFFile));
                xAxis.Maximum = DateTimeAxis.ToDouble(Utils.EpochtoDateTime(CoherenceEDFStartRecord ?? 1, LoadedEDFFile) + Utils.EpochPeriodtoTimeSpan(CoherenceEDFDuration ?? 1));
                temp_SignalPlot.Axes.Add(xAxis);

                LinearAxis yAxis = new LinearAxis();
                yAxis.MajorGridlineStyle = LineStyle.Solid;
                yAxis.MinorGridlineStyle = LineStyle.Dot;
                yAxis.Title = CoherenceEDFSelectedSignal2 + " (Time)";
                yAxis.Key   = CoherenceEDFSelectedSignal2 + " (Time)";

                if (CoherenceUseConstantAxis)
                {
                    yAxis.Maximum = Utils.GetMaxSignalValue(CoherenceEDFSelectedSignal2, false, LoadedEDFFile, sm);
                    yAxis.Minimum = Utils.GetMinSignalValue(CoherenceEDFSelectedSignal2, false, LoadedEDFFile, sm);
                }
                temp_SignalPlot.Axes.Add(yAxis);

                series_2.YAxisKey = CoherenceEDFSelectedSignal2 + " (Time)";
                series_2.XAxisKey = "DateTime";
                temp_SignalPlot.Series.Add(series_2);

                CoherenceSignalPlot2 = temp_SignalPlot;
            }

            #endregion

            #region Plot Coherence

            // Calculate Coherence
            LineSeries coh = new LineSeries();
            {
                List <float> values1;
                List <float> values2;

                if (sample_period_1 == sample_period_2)
                {
                    values1 = series_1.Points.Select(temp => (float)temp.Y).ToList();
                    values2 = series_2.Points.Select(temp => (float)temp.Y).ToList();
                }
                else
                {
                    if (sample_period_1 < sample_period_2) // Upsample signal 2
                    {
                        values1 = series_1.Points.Select(temp => (float)temp.Y).ToList();
                        values2 = series_2.Points.Select(temp => (float)temp.Y).ToList();
                        values2 = Utils.MATLAB_Resample(values2.ToArray(), sample_period_2 / sample_period_1);
                    }
                    else // Upsample signal 1
                    {
                        values1 = series_1.Points.Select(temp => (float)temp.Y).ToList();
                        values2 = series_2.Points.Select(temp => (float)temp.Y).ToList();
                        values1 = Utils.MATLAB_Resample(values1.ToArray(), sample_period_1 / sample_period_2);
                    }
                }

                coh          = Utils.MATLAB_Coherence(values1.ToArray(), values2.ToArray());
                coh.YAxisKey = "Coherence";
                coh.XAxisKey = "Normalized Frequency";
            }

            // Plot Coherence
            {
                PlotModel temp_plot = new PlotModel();
                temp_plot.Series.Add(coh);

                LinearAxis yAxis = new LinearAxis();
                yAxis.MajorGridlineStyle = LineStyle.Solid;
                yAxis.MinorGridlineStyle = LineStyle.Dot;
                yAxis.Title   = "Coherence";
                yAxis.Key     = "Coherence";
                yAxis.Maximum = 1.25;
                yAxis.Minimum = 0;
                temp_plot.Axes.Add(yAxis);

                LinearAxis xAxis = new LinearAxis();
                xAxis.Position = AxisPosition.Bottom;
                xAxis.Title    = "Normalized Frequency";
                xAxis.Key      = "Normalized Frequency";
                temp_plot.Axes.Add(xAxis);

                CoherencePlot = temp_plot;
            }

            #endregion
        }
コード例 #55
0
        private static PlotModel CreateModelWithNegativeValues(bool stacked, string title)
        {
            var model = new PlotModel
            {
                Title                 = title,
                LegendPlacement       = LegendPlacement.Outside,
                LegendPosition        = LegendPosition.BottomCenter,
                LegendOrientation     = LegendOrientation.Horizontal,
                LegendBorderThickness = 0
            };

            var s1 = new TSeries {
                Title = "Series 1", IsStacked = stacked, StrokeColor = OxyColors.Black, StrokeThickness = 1
            };

            s1.Items.Add(new TItem {
                Value = 25
            });
            s1.Items.Add(new TItem {
                Value = 137
            });
            s1.Items.Add(new TItem {
                Value = 18
            });
            s1.Items.Add(new TItem {
                Value = 40
            });

            var s2 = new TSeries {
                Title = "Series 2", IsStacked = stacked, StrokeColor = OxyColors.Black, StrokeThickness = 1
            };

            s2.Items.Add(new TItem {
                Value = -12
            });
            s2.Items.Add(new TItem {
                Value = -14
            });
            s2.Items.Add(new TItem {
                Value = -120
            });
            s2.Items.Add(new TItem {
                Value = -26
            });

            var s3 = new TSeries {
                Title = "Series 3", IsStacked = stacked, StrokeColor = OxyColors.Black, StrokeThickness = 1
            };

            s3.Items.Add(new TItem {
                Value = 21
            });
            s3.Items.Add(new TItem {
                Value = 8
            });
            s3.Items.Add(new TItem {
                Value = 48
            });
            s3.Items.Add(new TItem {
                Value = 3
            });

            var s4 = new TSeries {
                Title = "Series 4", IsStacked = stacked, StrokeColor = OxyColors.Black, StrokeThickness = 1
            };

            s4.Items.Add(new TItem {
                Value = -8
            });
            s4.Items.Add(new TItem {
                Value = -21
            });
            s4.Items.Add(new TItem {
                Value = -3
            });
            s4.Items.Add(new TItem {
                Value = -48
            });

            var categoryAxis = new CategoryAxis {
                Position = CategoryAxisPosition()
            };

            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               = ValueAxisPosition(),
                MinimumPadding         = 0.06,
                MaximumPadding         = 0.06,
                ExtraGridlines         = new[] { 0.0 },
                ExtraGridlineStyle     = LineStyle.Solid,
                ExtraGridlineColor     = OxyColors.Black,
                ExtraGridlineThickness = 1
            };

            model.Series.Add(s1);
            model.Series.Add(s2);
            model.Series.Add(s3);
            model.Series.Add(s4);
            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);
            return(model);
        }
コード例 #56
0
        private PlotModel CreatePlotModel()
        {
            timeAxis.Position               = AxisPosition.Bottom;
            timeAxis.MajorGridlineStyle     = LineStyle.Solid;
            timeAxis.MajorGridlineThickness = 1;
            timeAxis.MajorGridlineColor     = OxyColor.FromRgb(192, 192, 192);
            timeAxis.MinorGridlineStyle     = LineStyle.Solid;
            timeAxis.MinorGridlineThickness = 1;
            timeAxis.MinorGridlineColor     = OxyColor.FromRgb(232, 232, 232);
            timeAxis.StartPosition          = 1;
            timeAxis.EndPosition            = 0;
            timeAxis.MinimumPadding         = 0;
            timeAxis.MaximumPadding         = 0;
            timeAxis.AbsoluteMinimum        = 0;
            timeAxis.Minimum         = 0;
            timeAxis.AbsoluteMaximum = 24 * 60 * 60;
            timeAxis.Zoom(
                settings.GetValue("plotPanel.MinTimeSpan", 0.0f),
                settings.GetValue("plotPanel.MaxTimeSpan", 10.0f * 60));
            timeAxis.StringFormat = "h:mm";

            var units = new Dictionary <SensorType, string>();

            units.Add(SensorType.Voltage, "V");
            units.Add(SensorType.Clock, "MHz");
            units.Add(SensorType.Temperature, "°C");
            units.Add(SensorType.Load, "%");
            units.Add(SensorType.Fan, "RPM");
            units.Add(SensorType.Flow, "L/h");
            units.Add(SensorType.Control, "%");
            units.Add(SensorType.Level, "%");
            units.Add(SensorType.Factor, "1");
            units.Add(SensorType.Power, "W");
            units.Add(SensorType.Data, "GB");

            foreach (SensorType type in Enum.GetValues(typeof(SensorType)))
            {
                var axis = new LinearAxis();
                axis.Position               = AxisPosition.Left;
                axis.MajorGridlineStyle     = LineStyle.Solid;
                axis.MajorGridlineThickness = 1;
                axis.MajorGridlineColor     = timeAxis.MajorGridlineColor;
                axis.MinorGridlineStyle     = LineStyle.Solid;
                axis.MinorGridlineThickness = 1;
                axis.MinorGridlineColor     = timeAxis.MinorGridlineColor;
                axis.AxislineStyle          = LineStyle.Solid;
                axis.Title = type.ToString();
                axis.Key   = type.ToString();

                axis.Zoom(
                    settings.GetValue("plotPanel.Min" + axis.Key, float.NaN),
                    settings.GetValue("plotPanel.Max" + axis.Key, float.NaN));

                if (units.ContainsKey(type))
                {
                    axis.Unit = units[type];
                }
                axes.Add(type, axis);
            }

            var model = new PlotModel();

            model.Axes.Add(timeAxis);
            foreach (var axis in axes.Values)
            {
                model.Axes.Add(axis);
            }
            model.PlotMargins     = new OxyThickness(0);
            model.IsLegendVisible = false;

            return(model);
        }
コード例 #57
0
ファイル: CurrViewModel.cs プロジェクト: icedaigua/cubesatGCS
        private void InitCurrModel()
        {
            JsonData item = JsonMapper.ToObject(System.IO.File.ReadAllText("param_curr.json"));

            DateTimeAxis xAxisCurr14 = new DateTimeAxis()
            {
                Position           = AxisPosition.Bottom,
                Title              = Convert.ToString(item[0][0]["Title"]),
                TitlePosition      = Double.Parse(Convert.ToString(item[0][0]["TitlePosition"])),
                StringFormat       = Convert.ToString(item[0][0]["StringFormat"]),
                IsZoomEnabled      = Boolean.Parse(Convert.ToString(item[0][0]["IsZoomEnabled"])), //坐标轴缩放关闭
                IsPanEnabled       = Boolean.Parse(Convert.ToString(item[0][0]["IsPanEnabled"])),  //图表缩放功能关闭
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                Minimum            = DateTimeAxis.ToDouble(DateTime.Now),
                Maximum            = DateTimeAxis.ToDouble(DateTime.Now.AddMinutes(60)),
                //IntervalLength = 60
            };
            LinearAxis yAxisCurr14 = new LinearAxis()
            {
                Position           = AxisPosition.Left,
                Title              = Convert.ToString(item[0][1]["Title"]),
                TitlePosition      = Double.Parse(Convert.ToString(item[0][1]["TitlePosition"])),
                IsZoomEnabled      = Boolean.Parse(Convert.ToString(item[0][1]["IsZoomEnabled"])), //坐标轴缩放关闭
                IsPanEnabled       = Boolean.Parse(Convert.ToString(item[0][1]["IsPanEnabled"])),  //图表缩放功能关闭
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                MajorStep          = Double.Parse(Convert.ToString(item[0][1]["MajorStep"])),
                Minimum            = Double.Parse(Convert.ToString(item[0][1]["Minimum"])),
                Maximum            = Double.Parse(Convert.ToString(item[0][1]["Maximum"]))
            };

            curr14Model = new PlotModel()
            {
                Title = "+14V母线电流(mA)"
            };                                                         //线条
            curr14Model.Axes.Add(xAxisCurr14);
            curr14Model.Axes.Add(yAxisCurr14);
            curr14Points = new List <DataPoint>();

            DateTimeAxis xAxisCurr12P = new DateTimeAxis()
            {
                Position           = AxisPosition.Bottom,
                Title              = Convert.ToString(item[0][2]["Title"]),
                TitlePosition      = Double.Parse(Convert.ToString(item[0][2]["TitlePosition"])),
                StringFormat       = Convert.ToString(item[0][2]["StringFormat"]),
                IsZoomEnabled      = Boolean.Parse(Convert.ToString(item[0][2]["IsZoomEnabled"])), //坐标轴缩放关闭
                IsPanEnabled       = Boolean.Parse(Convert.ToString(item[0][2]["IsPanEnabled"])),  //图表缩放功能关闭
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                Minimum            = DateTimeAxis.ToDouble(DateTime.Now),
                Maximum            = DateTimeAxis.ToDouble(DateTime.Now.AddMinutes(60)),
                //IntervalLength = 60
            };
            LinearAxis yAxisCurr12P = new LinearAxis()
            {
                Position           = AxisPosition.Left,
                Title              = Convert.ToString(item[0][3]["Title"]),
                TitlePosition      = Double.Parse(Convert.ToString(item[0][3]["TitlePosition"])),
                IsZoomEnabled      = Boolean.Parse(Convert.ToString(item[0][3]["IsZoomEnabled"])), //坐标轴缩放关闭
                IsPanEnabled       = Boolean.Parse(Convert.ToString(item[0][3]["IsPanEnabled"])),  //图表缩放功能关闭
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                MajorStep          = Double.Parse(Convert.ToString(item[0][3]["MajorStep"])),
                Minimum            = Double.Parse(Convert.ToString(item[0][3]["Minimum"])),
                Maximum            = Double.Parse(Convert.ToString(item[0][3]["Maximum"]))
            };

            curr12PModel = new PlotModel()
            {
                Title = "+12V供电电流(mA)"
            };                                                          //线条
            curr12PModel.Axes.Add(xAxisCurr12P);
            curr12PModel.Axes.Add(yAxisCurr12P);
            curr12PPoints = new List <DataPoint>();

            DateTimeAxis xAxisCurr12N = new DateTimeAxis()
            {
                Position           = AxisPosition.Bottom,
                Title              = Convert.ToString(item[0][4]["Title"]),
                TitlePosition      = Double.Parse(Convert.ToString(item[0][4]["TitlePosition"])),
                StringFormat       = Convert.ToString(item[0][4]["StringFormat"]),
                IsZoomEnabled      = Boolean.Parse(Convert.ToString(item[0][4]["IsZoomEnabled"])), //坐标轴缩放关闭
                IsPanEnabled       = Boolean.Parse(Convert.ToString(item[0][4]["IsPanEnabled"])),  //图表缩放功能关闭
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                Minimum            = DateTimeAxis.ToDouble(DateTime.Now),
                Maximum            = DateTimeAxis.ToDouble(DateTime.Now.AddMinutes(60)),
                //IntervalLength = 60
            };
            LinearAxis yAxisCurr12N = new LinearAxis()
            {
                Position           = AxisPosition.Left,
                Title              = Convert.ToString(item[0][5]["Title"]),
                TitlePosition      = Double.Parse(Convert.ToString(item[0][5]["TitlePosition"])),
                IsZoomEnabled      = Boolean.Parse(Convert.ToString(item[0][5]["IsZoomEnabled"])), //坐标轴缩放关闭
                IsPanEnabled       = Boolean.Parse(Convert.ToString(item[0][5]["IsPanEnabled"])),  //图表缩放功能关闭
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                MajorStep          = Double.Parse(Convert.ToString(item[0][5]["MajorStep"])),
                Minimum            = Double.Parse(Convert.ToString(item[0][5]["Minimum"])),
                Maximum            = Double.Parse(Convert.ToString(item[0][5]["Maximum"]))
            };

            curr12NModel = new PlotModel()
            {
                Title = "-12V供电电流(mA)"
            };                                                          //线条
            curr12NModel.Axes.Add(xAxisCurr12N);
            curr12NModel.Axes.Add(yAxisCurr12N);
            curr12NPoints = new List <DataPoint>();

            DateTimeAxis xAxisCurr5 = new DateTimeAxis()
            {
                Position           = AxisPosition.Bottom,
                Title              = Convert.ToString(item[0][6]["Title"]),
                TitlePosition      = Double.Parse(Convert.ToString(item[0][6]["TitlePosition"])),
                StringFormat       = Convert.ToString(item[0][6]["StringFormat"]),
                IsZoomEnabled      = Boolean.Parse(Convert.ToString(item[0][6]["IsZoomEnabled"])), //坐标轴缩放关闭
                IsPanEnabled       = Boolean.Parse(Convert.ToString(item[0][6]["IsPanEnabled"])),  //图表缩放功能关闭
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                Minimum            = DateTimeAxis.ToDouble(DateTime.Now),
                Maximum            = DateTimeAxis.ToDouble(DateTime.Now.AddMinutes(60)),
                //IntervalLength = 60
            };
            LinearAxis yAxisCurr5 = new LinearAxis()
            {
                Position           = AxisPosition.Left,
                Title              = Convert.ToString(item[0][7]["Title"]),
                TitlePosition      = Double.Parse(Convert.ToString(item[0][7]["TitlePosition"])),
                IsZoomEnabled      = Boolean.Parse(Convert.ToString(item[0][7]["IsZoomEnabled"])), //坐标轴缩放关闭
                IsPanEnabled       = Boolean.Parse(Convert.ToString(item[0][7]["IsPanEnabled"])),  //图表缩放功能关闭
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                MajorStep          = Double.Parse(Convert.ToString(item[0][7]["MajorStep"])),
                Minimum            = Double.Parse(Convert.ToString(item[0][7]["Minimum"])),
                Maximum            = Double.Parse(Convert.ToString(item[0][7]["Maximum"]))
            };

            curr5Model = new PlotModel()
            {
                Title = "+5V供电电流(mA)"
            };                                                       //线条
            curr5Model.Axes.Add(xAxisCurr5);
            curr5Model.Axes.Add(yAxisCurr5);
            curr5Points = new List <DataPoint>();
        }
コード例 #58
0
        private void Load()
        {
            #region TreningData

            Model.Series.Add(new LineSeries()
            {
                Title = "Trening", MarkerSize = 11, MarkerType = MarkerType.Circle, LineStyle = LineStyle.None, MarkerFill = OxyColors.Red, ItemsSource = Controled
            });

            #endregion

            var axisx = new LinearAxis()
            {
                Minimum = ax.X,
                Maximum = ax.Y,
                PositionAtZeroCrossing = true,
                AxislineStyle          = LineStyle.Solid,
            };

            var axisy = new LinearAxis()
            {
                Minimum = ay.X,
                Maximum = ay.Y,
                PositionAtZeroCrossing = true,
                AxislineStyle          = LineStyle.Solid,
                Position = AxisPosition.Top
            };

            Model.Axes.Add(axisx);
            Model.Axes.Add(axisy);


            #region TestingData

            List <DataPoint> Tested = new List <DataPoint>();
            foreach (var item in TestingData)
            {
                Tested.Add(new DataPoint(item.X, item.Y));
            }
            Model.Series.Add(new LineSeries()
            {
                Title = "Tested", MarkerSize = 11, MarkerType = MarkerType.Square, LineStyle = LineStyle.None, MarkerFill = OxyColors.Blue, ItemsSource = Tested
            });
            #endregion

            LineSeries Pos = new LineSeries()
            {
                Title = "1", MarkerSize = 8, MarkerType = MarkerType.Triangle, LineStyle = LineStyle.None, MarkerFill = OxyColors.GreenYellow, ItemsSource = Positive
            };
            LineSeries Neg = new LineSeries()
            {
                Title = "0", MarkerSize = 8, MarkerType = MarkerType.Diamond, LineStyle = LineStyle.None, MarkerFill = OxyColors.BlueViolet, ItemsSource = Negative
            };


            Model.Series.Add(Pos);
            Model.Series.Add(Neg);

            Model.Series.Add(new LineSeries());
            model.InvalidatePlot(true);

            Perceptron.Generate(TreningData, w);
            UpdateLine();

            Weight.Clear();
            Weight.AddRange(Perceptron.GetWeight());
            UpdateLine();
        }
コード例 #59
0
        // [Example("All in one")]
        public static PlotModel AllInOne()
        {
            var model = new PlotModel
            {
                Title                 = "All in one",
                LegendPlacement       = LegendPlacement.Outside,
                LegendPosition        = LegendPosition.BottomCenter,
                LegendOrientation     = LegendOrientation.Horizontal,
                LegendBorderThickness = 0
            };

            var categoryAxis = new CategoryAxis {
                Position = CategoryAxisPosition(), GapWidth = 0.01
            };

            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               = ValueAxisPosition(),
                MinimumPadding         = 0.06,
                MaximumPadding         = 0.06,
                ExtraGridlines         = new[] { 0.0 },
                ExtraGridlineStyle     = LineStyle.Solid,
                ExtraGridlineColor     = OxyColors.Black,
                ExtraGridlineThickness = 1
            };

            var categoryA = 0;
            var categoryB = 1;
            var categoryC = 2;
            var categoryD = 3;

            var s1 = new TSeries {
                Title = "Series 1", IsStacked = true, StrokeColor = OxyColors.Black, StrokeThickness = 1, StackGroup = "3"
            };

            s1.Items.Add(new TItem {
                Value = 25
            });
            s1.Items.Add(new TItem {
                Value = 137
            });
            s1.Items.Add(new TItem {
                Value = 18
            });
            s1.Items.Add(new TItem {
                Value = 40
            });
            var s2 = new TSeries {
                Title = "Series 2", IsStacked = true, StrokeColor = OxyColors.Black, StrokeThickness = 1, StackGroup = "3"
            };

            s2.Items.Add(new TItem {
                Value = -12
            });
            s2.Items.Add(new TItem {
                Value = -14
            });
            s2.Items.Add(new TItem {
                Value = -120
            });
            s2.Items.Add(new TItem {
                Value = -26
            });

            var s3 = new TSeries {
                Title = "Series 3", IsStacked = true, StrokeColor = OxyColors.Black, StrokeThickness = 1, StackGroup = "5"
            };

            s3.Items.Add(new TItem {
                Value = 21
            });
            s3.Items.Add(new TItem {
                Value = 8
            });
            s3.Items.Add(new TItem {
                Value = 48
            });
            s3.Items.Add(new TItem {
                Value = 3
            });
            var s4 = new TSeries {
                Title = "Series 4", IsStacked = true, StrokeColor = OxyColors.Black, StrokeThickness = 1, StackGroup = "5", LabelFormatString = "{0:0}", LabelPlacement = LabelPlacement.Middle
            };

            s4.Items.Add(new TItem {
                Value = -8, CategoryIndex = categoryA
            });
            s4.Items.Add(new TItem {
                Value = -8, CategoryIndex = categoryA
            });
            s4.Items.Add(new TItem {
                Value = -8, CategoryIndex = categoryA
            });
            s4.Items.Add(new TItem {
                Value = -21, CategoryIndex = categoryB
            });
            s4.Items.Add(new TItem {
                Value = -3, CategoryIndex = categoryC
            });
            s4.Items.Add(new TItem {
                Value = -48, CategoryIndex = categoryD
            });
            s4.Items.Add(new TItem {
                Value = 8, CategoryIndex = categoryA
            });
            s4.Items.Add(new TItem {
                Value = 21, CategoryIndex = categoryB
            });
            s4.Items.Add(new TItem {
                Value = 3, CategoryIndex = categoryC
            });
            s4.Items.Add(new TItem {
                Value = 48, CategoryIndex = categoryD
            });

            var s5 = new TSeries {
                Title = "Series 5", IsStacked = false, StrokeColor = OxyColors.Black, StrokeThickness = 1
            };

            s5.Items.Add(new TItem {
                Value = 17, CategoryIndex = categoryA
            });
            s5.Items.Add(new TItem {
                Value = 179, CategoryIndex = categoryB
            });
            s5.Items.Add(new TItem {
                Value = 45, CategoryIndex = categoryC
            });
            s5.Items.Add(new TItem {
                Value = 65, CategoryIndex = categoryD
            });
            s5.Items.Add(new TItem {
                Value = 97, CategoryIndex = categoryA
            });
            s5.Items.Add(new TItem {
                Value = 21, CategoryIndex = categoryD
            });

            var s6 = new TSeries {
                Title = "Series 6", IsStacked = false, StrokeColor = OxyColors.Black, StrokeThickness = 1, LabelFormatString = "{0:0}", LabelPlacement = LabelPlacement.Base
            };

            s6.Items.Add(new TItem {
                Value = 7
            });
            s6.Items.Add(new TItem {
                Value = 54
            });
            s6.Items.Add(new TItem {
                Value = 68
            });
            s6.Items.Add(new TItem {
                Value = 12
            });

            model.Series.Add(s1);
            model.Series.Add(s2);
            model.Series.Add(s3);
            model.Series.Add(s4);
            model.Series.Add(s5);
            model.Series.Add(s6);
            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);
            return(model);
        }
コード例 #60
0
        private void SetupGraphs()
        {
            double[] x = { 0, 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6 };
            try
            {
                pAboveGround.Model.Axes.Clear();
                pAboveGround.Model.Series.Clear();
                pBelowGround.Model.Axes.Clear();
                pBelowGround.Model.Series.Clear();
                pAboveGround.Model.Title = "Above Ground";
                pAboveGround.Model.PlotAreaBorderColor = OxyColors.White;
                pAboveGround.Model.LegendBorder        = OxyColors.Transparent;
                LinearAxis agxAxis = new LinearAxis();
                agxAxis.Title         = "Multiple of Tree Height";
                agxAxis.AxislineStyle = LineStyle.Solid;
                agxAxis.AxisDistance  = 2;
                agxAxis.Position      = AxisPosition.Top;

                LinearAxis agyAxis = new LinearAxis();
                agyAxis.Title         = "%";
                agyAxis.AxislineStyle = LineStyle.Solid;
                agyAxis.AxisDistance  = 2;
                Utility.LineSeriesWithTracker seriesShade = new Utility.LineSeriesWithTracker();
                List <DataPoint> pointsShade = new List <DataPoint>();
                DataRow          rowShade    = table.Rows[0];
                DataColumn       col         = table.Columns[0];
                double[]         yShade      = new double[table.Columns.Count - 1];

                pAboveGround.Model.Axes.Add(agxAxis);
                pAboveGround.Model.Axes.Add(agyAxis);

                for (int i = 1; i < table.Columns.Count; i++)
                {
                    if (rowShade[i].ToString() == "")
                    {
                        return;
                    }
                    yShade[i - 1] = Convert.ToDouble(rowShade[i]);
                }

                for (int i = 0; i < x.Length; i++)
                {
                    pointsShade.Add(new DataPoint(x[i], yShade[i]));
                }
                seriesShade.Title       = "Shade";
                seriesShade.ItemsSource = pointsShade;
                pAboveGround.Model.Series.Add(seriesShade);
            }
            //don't draw the series if the format is wrong
            catch (FormatException)
            {
                pBelowGround.Model.Series.Clear();
            }

            /////////////// Below Ground
            try
            {
                pBelowGround.Model.Title = "Below Ground";
                pBelowGround.Model.PlotAreaBorderColor = OxyColors.White;
                pBelowGround.Model.LegendBorder        = OxyColors.Transparent;
                LinearAxis bgxAxis = new LinearAxis();
                LinearAxis bgyAxis = new LinearAxis();
                List <Utility.LineSeriesWithTracker> seriesList = new List <Utility.LineSeriesWithTracker>();

                bgyAxis.Position = AxisPosition.Left;
                bgxAxis.Position = AxisPosition.Top;
                bgyAxis.Title    = "Depth (mm)";

                bgxAxis.Title         = "Root Length Density (cm/cm3)";
                bgxAxis.Minimum       = 0;
                bgxAxis.MinorTickSize = 0;
                bgxAxis.AxislineStyle = LineStyle.Solid;
                bgxAxis.AxisDistance  = 2;
                pBelowGround.Model.Axes.Add(bgxAxis);

                bgyAxis.StartPosition = 1;
                bgyAxis.EndPosition   = 0;
                bgyAxis.MinorTickSize = 0;
                bgyAxis.AxislineStyle = LineStyle.Solid;
                pBelowGround.Model.Axes.Add(bgyAxis);

                for (int i = 1; i < table.Columns.Count; i++)
                {
                    Utility.LineSeriesWithTracker series = new Utility.LineSeriesWithTracker();
                    series.Title = table.Columns[i].ColumnName;
                    double[] data = new double[table.Rows.Count - 4];
                    for (int j = 4; j < table.Rows.Count; j++)
                    {
                        data[j - 4] = Convert.ToDouble(table.Rows[j].Field <string>(i));
                    }

                    List <DataPoint> points = new List <DataPoint>();

                    for (int j = 0; j < data.Length; j++)
                    {
                        points.Add(new DataPoint(data[j], SoilMidpoints[j]));
                    }
                    series.ItemsSource = points;
                    pBelowGround.Model.Series.Add(series);
                }
            }
            //don't draw the series if the format is wrong
            catch (FormatException)
            {
                pBelowGround.Model.Series.Clear();
            }
            finally
            {
                pAboveGround.InvalidatePlot(true);
                pBelowGround.InvalidatePlot(true);
            }
        }