コード例 #1
0
        private PlotModel GetModel()
        {
            var monthlyExpenses = monthlyExpensesDataProvider.GetValues(StartDate, EndDate);

            var model = new PlotModel
            {
                Background = OxyColors.Black,
                TextColor = OxyColors.White
            };

            var columnSeries = new ColumnSeries();
            var axe = new CategoryAxis
            {
                AxislineColor = OxyColors.White,
                TextColor = OxyColors.White,
                IsPanEnabled = false,
                IsZoomEnabled = false,
                Angle = 45
            };

            foreach (var statisticItem in monthlyExpenses)
            {
                columnSeries.Items.Add(new ColumnItem(statisticItem.Value) {Color = graphColor});
                axe.Labels.Add(statisticItem.Label);
            }

            model.Axes.Add(axe);
            model.Series.Add(columnSeries);
            return model;
        }
コード例 #2
0
 public static PlotModel Graph1()
 {
     var pm = new PlotModel { Title = "Q1 2003 Calls by Region", PlotAreaBorderThickness = new OxyThickness(0) };
     var categoryAxis = new CategoryAxis
             {
                 AxislineStyle = LineStyle.Solid,
                 TickStyle = TickStyle.None
             };
     categoryAxis.Labels.AddRange(new[] { "North", "East", "South", "West" });
     pm.Axes.Add(categoryAxis);
     pm.Axes.Add(
         new LinearAxis
         {
             Position = AxisPosition.Left,
             Minimum = 0,
             Maximum = 6000,
             MajorStep = 1000,
             MinorStep = 1000,
             AxislineStyle = LineStyle.Solid,
             TickStyle = TickStyle.Outside,
             StringFormat = "#,0"
         });
     var series = new ColumnSeries { FillColor = OxyColors.Black };
     series.Items.Add(new ColumnItem { Value = 3000 });
     series.Items.Add(new ColumnItem { Value = 4500 });
     series.Items.Add(new ColumnItem { Value = 2100 });
     series.Items.Add(new ColumnItem { Value = 4800 });
     pm.Series.Add(series);
     return pm;
 }
コード例 #3
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;
        }
コード例 #4
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,
                },
            };
        }
コード例 #5
0
        /// <summary>
        ///     Set a custom CashFlowModel with the set Start and Enddate
        /// </summary>
        public PlotModel GetCashFlowModel()
        {
            var cashFlow = cashFlowDataProvider.GetValues(StartDate, EndDate);

            var model = new PlotModel
            {
                Background = OxyColors.Black,
                TextColor = OxyColors.White
            };

            var columnSeries = new ColumnSeries();
            var axe = new CategoryAxis
            {
                AxislineColor = OxyColors.White,
                TextColor = OxyColors.White,
                IsPanEnabled = false,
                IsZoomEnabled = false,
                Angle = 45
            };

            columnSeries.Items.Add(new ColumnItem(cashFlow.Income.Value) {Color = OxyColors.LightGreen});
            axe.Labels.Add(cashFlow.Income.Label);
            columnSeries.Items.Add(new ColumnItem(cashFlow.Spending.Value) {Color = OxyColor.FromRgb(196, 54, 51)});
            axe.Labels.Add(cashFlow.Spending.Label);
            columnSeries.Items.Add(new ColumnItem(cashFlow.Revenue.Value) {Color = OxyColors.Cyan});
            axe.Labels.Add(cashFlow.Revenue.Label);

            model.Axes.Add(axe);
            model.Series.Add(columnSeries);
            return model;
        }
コード例 #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
        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;
        }
コード例 #8
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;
        }
コード例 #9
0
        public static PlotModel GetPlotModel(this IRandomNumberGenerator generator, int columnCount,
            int experimentsCount)
        {
            var plotModel = new PlotModel();
            var values = new List<double>();
            for (var i = 0; i < experimentsCount; i++)
            {
                values.Add(generator.Next());
            }
            var minValue = values.Min()*0.999;
            var maxValue = values.Max()*1.001;
            var delta = (maxValue - minValue)/columnCount;
            var axis = new CategoryAxis {Position = AxisPosition.Bottom};
            for (var i = 0; i < columnCount; i++)
            {
                axis.Labels.Add($"{Math.Round(minValue + delta*i, 2)}-{Math.Round(minValue + delta*(i + 1), 2)}");
            }
            plotModel.Axes.Clear();
            plotModel.Axes.Add(axis);
            plotModel.Axes.Add(new LinearAxis());

            var columnSeries = new ColumnSeries();
            for (var i = 0; i < columnCount; i++)
            {
                var itemsCount = values.Count(x => x > (minValue + i*delta) && x < (minValue + (i + 1)*delta));
                columnSeries.Items.Add(new ColumnItem(((double) itemsCount/values.Count)));
            }
            plotModel.Series.Add(columnSeries);
            return plotModel;
        }
コード例 #10
0
ファイル: Chart.xaml.cs プロジェクト: Amichai/MySimulations
 public void AddSeries(ColumnSeries b, List<double> xAxis)
 {
     var ca = new CategoryAxis() { LabelField = "label",
         Labels = (IList<string>)xAxis.Select(i => i.ToString()).ToList() };
     plot.Axes.Add(ca);
     plot.Series.Add(b);
     this.Root.Model = plot;
 }
コード例 #11
0
ファイル: testChart.cs プロジェクト: kabsila/HomezigXaml
		public testChart ()
		{
			//Initializing chart
			SfChart chart = new SfChart();
			chart.Title = new ChartTitle() 
			{ 
				Text = "Weather Analysis",
				Font = Font.SystemFontOfSize(NamedSize.Large)
			};

			//Initializing Primary Axis
			CategoryAxis primaryAxis = new CategoryAxis();
			primaryAxis.Title = new ChartAxisTitle() { Text = "Month" };

			chart.PrimaryAxis = primaryAxis;

			//Initializing Secondary Axis
			NumericalAxis secondaryAxis = new NumericalAxis();
			secondaryAxis.Title = new ChartAxisTitle() { Text = "Temperature" };

			chart.SecondaryAxis = secondaryAxis;


			DataModel dataModel = new DataModel();

			//Adding ColumnSeries to the chart for percipitation
			chart.Series.Add(new ColumnSeries()
				{
					ItemsSource = dataModel.Precipitation,
					Label = "Precipitation",
					YAxis = new NumericalAxis()
					{
						OpposedPosition = true,
						ShowMajorGridLines = false
					}
				});

			//Adding the SplineSeries to the chart for high temperature
			chart.Series.Add(new SplineSeries()
				{
					ItemsSource = dataModel.HighTemperature,
					Label = "High"
				});

			//Adding the SplineSeries to the chart for low temperature
			chart.Series.Add(new SplineSeries()
				{
					ItemsSource = dataModel.LowTemperature,
					Label = "Low"
				});

			//Adding Chart Legend for the Chart
			chart.Legend = new ChartLegend() { IsVisible = true };

			this.Content = chart;
		}
コード例 #12
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;
 }
コード例 #13
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;
 }
コード例 #14
0
        public static PlotModel EmptyCategoryAxis()
        {
            var model = new PlotModel("Empty category axis");

            var s1 = new TSeries {
                Title = "Series 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"
            };

            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()
            };
            var valueAxis = new LinearAxis(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.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);
            return(model);
        }
コード例 #15
0
        public ChargeHistogramPlot(Dictionary <int, int> histogram, string name) :
            base(name)
        {
            var axis = new CategoryAxis
            {
                Position        = AxisPosition.Bottom,
                MinorStep       = 1,
                LabelField      = "Charge States",
                AbsoluteMinimum = 0,
                GapWidth        = 0
            };

            // Count axis
            var linearAxis = new LinearAxis
            {
                Position        = AxisPosition.Left,
                MaximumPadding  = .15,
                AbsoluteMinimum = 1,
                Minimum         = 0,
                MinimumPadding  = 1
            };

            Model.IsLegendVisible = true;
            Model.Axes.Add(axis);
            Model.Axes.Add(linearAxis);
            //Model.Title = name;

            // Add the data to the view model
            var data = new ColumnSeries
            {
                ValueField        = "Value",
                StrokeThickness   = 1,
                LabelFormatString = "{0}",
            };

            var colors = new ColorTypeIterator();

            foreach (var key in histogram.Keys)
            {
                axis.Labels.Add(key.ToString());
                int number = histogram[key];

                var column = new ColumnItem(number)
                {
                    Color = colors.GetColor(key)
                };
                data.Items.Add(column);
            }

            m_xAxis = axis;
            Model.Series.Add(data);

            Model.Axes[0].MajorGridlineStyle = LineStyle.Solid;
            Model.Axes[1].MajorGridlineStyle = LineStyle.Solid;
        }
コード例 #16
0
        public static PlotModel MichelsonMorleyExperiment()
        {
            //// http://www.gutenberg.org/files/11753/11753-h/11753-h.htm
            //// http://en.wikipedia.org/wiki/Michelson%E2%80%93Morley_experiment
            //// http://stat.ethz.ch/R-manual/R-devel/library/datasets/html/morley.html

            var model = new PlotModel();

            var boxPlotSeries = new BoxPlotSeries
            {
                Title           = "Results",
                Stroke          = OxyColors.Black,
                StrokeThickness = 1,
                OutlierSize     = 2,
                BoxWidth        = 0.4
            };

            // note: approximated data values (not the original values)
            boxPlotSeries.Items.Add(new BoxPlotItem(0, 740, 850, 945, 980, 1070)
            {
                Outliers = new[] { 650.0 }
            });
            boxPlotSeries.Items.Add(new BoxPlotItem(1, 750, 805, 845, 890, 970)
            {
                Outliers = new double[] { }
            });
            boxPlotSeries.Items.Add(new BoxPlotItem(2, 845, 847, 855, 880, 910)
            {
                Outliers = new[] { 640.0, 950, 970 }
            });
            boxPlotSeries.Items.Add(new BoxPlotItem(3, 720, 760, 820, 870, 910)
            {
                Outliers = new double[] { }
            });
            boxPlotSeries.Items.Add(new BoxPlotItem(4, 730, 805, 807, 870, 950)
            {
                Outliers = new double[] { }
            });
            model.Series.Add(boxPlotSeries);
            model.Annotations.Add(new LineAnnotation {
                Type = LineAnnotationType.Horizontal, LineStyle = LineStyle.Solid, Y = 792.458, Text = "true speed"
            });
            var categoryAxis = new CategoryAxis
            {
                Title = "Experiment No.",
            };

            categoryAxis.Labels.AddRange(new[] { "1", "2", "3", "4", "5" });
            model.Axes.Add(categoryAxis);
            model.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, Title = "Speed of light (km/s minus 299,000)", MajorStep = 100, MinorStep = 100
            });
            return(model);
        }
コード例 #17
0
        /// <summary>
        /// Create a mutiple series Column Chart - Data are grouped by independent value
        /// This function is not used in this widget
        /// </summary>
        private void CreateGroupColumnChart(FeatureSet fset, string[] outFields, string[] outLabels, string title, string independentField, string independentAxisTitle, string dependentAxisTitle)
        {
            int    index      = 0;
            int    limit      = Math.Min(MAXIMUM_RETURN, fset.Features.Count);
            double chartValue = 0.0;
            string chartKey   = "";

            Chart chart = new Chart()
            {
                Title = title, MinWidth = 500, MinHeight = 300, MaxWidth = 600, MaxHeight = 500
            };

            chart.BorderBrush = new SolidColorBrush(Colors.Transparent);

            RangeAxis dependentAxis = new LinearAxis()
            {
                Orientation = AxisOrientation.Y, Location = AxisLocation.Left, ShowGridLines = true, Title = dependentAxisTitle
            };
            CategoryAxis independentAxis = new CategoryAxis()
            {
                Orientation = AxisOrientation.X, Location = AxisLocation.Bottom, Title = independentAxisTitle, Margin = new Thickness(0, 0, 2, 0)
            };

            independentAxis.AxisLabelStyle = this.Resources["ChartXAxisLabelStyle"] as Style;

            foreach (string field in outFields)
            {
                Collection <KeyValuePair <string, double> > chartData = new Collection <KeyValuePair <string, double> >();

                for (int i = 0; i < limit; i++)
                {
                    Graphic graphic = fset.Features[i];
                    chartKey = (string)graphic.Attributes[independentField];
                    // The purpose of this line is to make labels shorter, you have to remove it if you use other data
                    //chartKey = (chartKey == null) ? "Unknown" : chartKey.Remove(chartKey.Length - "County".Length - 1);

                    chartValue = (graphic.Attributes[field] == null) ? 0.0 : double.Parse(graphic.Attributes[field].ToString());
                    KeyValuePair <string, double> kv = new KeyValuePair <string, double>(chartKey, chartValue);
                    chartData.Add(kv);
                }

                ColumnSeries colSeries = new ColumnSeries();
                colSeries.Title                = outLabels[index];
                colSeries.ItemsSource          = chartData;
                colSeries.IndependentValuePath = "Key";
                colSeries.DependentValuePath   = "Value";
                colSeries.IndependentAxis      = independentAxis;
                colSeries.DependentRangeAxis   = dependentAxis;
                chart.Series.Add(colSeries);
                index++;
            }

            RightChartStack.Children.Add(chart);
        }
コード例 #18
0
        public static PlotModel Graph4()
        {
            var pm = new PlotModel {
                Title = "Regional % of Total Expenses", PlotAreaBorderThickness = new OxyThickness(0)
            };
            var categoryAxis = new CategoryAxis
            {
                TickStyle = TickStyle.None,
                GapWidth  = 0,
                Key       = "y"
            };

            categoryAxis.Labels.AddRange(new[] { "West\n34%", "East\n30%", "North\n20%", "South\n16%" });
            pm.Axes.Add(categoryAxis);

            pm.Axes.Add(
                new LinearAxis
            {
                Position      = AxisPosition.Left,
                Minimum       = 0,
                Maximum       = 0.35 + double.Epsilon,
                MajorStep     = 0.05,
                MinorStep     = 0.05,
                AxislineStyle = LineStyle.Solid,
                TickStyle     = TickStyle.Outside,
                StringFormat  = "P0",
                Key           = "x"
            });

            var series = new BarSeries
            {
                BarWidth        = 1.0,
                StrokeColor     = OxyColors.DarkGray,
                StrokeThickness = 1.0,
                FillColor       = OxyColors.Black,
                XAxisKey        = "x",
                YAxisKey        = "y"
            };

            series.Items.Add(new BarItem {
                Value = 0.34
            });
            series.Items.Add(new BarItem {
                Value = 0.3
            });
            series.Items.Add(new BarItem {
                Value = 0.2
            });
            series.Items.Add(new BarItem {
                Value = 0.16
            });
            pm.Series.Add(series);
            return(pm);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProbabilityDensityFunctionChartViewModel"/> class.
        /// </summary>
        public ProbabilityDensityFunctionChartViewModel()
        {
            Items = new List <ValueProbabilityPair>();

            horizontalAxis = new CategoryAxis
            {
                Position        = AxisPosition.Bottom,
                ItemsSource     = Items,
                LabelField      = nameof(ValueProbabilityPair.Value),
                AbsoluteMinimum = -1,
                IsZoomEnabled   = false,
                IsPanEnabled    = false,
                GapWidth        = 0,
            };

            verticalAxis = new LinearAxis
            {
                Title           = "Probability",
                Position        = AxisPosition.Left,
                Minimum         = 0.0,
                AbsoluteMinimum = 0.0,
                Maximum         = 1.0,
                AbsoluteMaximum = 1.0,
                IsZoomEnabled   = false,
                IsPanEnabled    = false,
                StringFormat    = "p",
            };

            valueSerie = new ColumnSeries
            {
                ItemsSource         = Items,
                ValueField          = nameof(ValueProbabilityPair.Probability),
                FillColor           = OxyColors.DarkCyan,
                TrackerFormatString = "{0}\n{1}: {2:p}",
            };

            PlotModel = new PlotModel
            {
                IsLegendVisible = false,
                Axes            =
                {
                    horizontalAxis,
                    verticalAxis,
                },
                Series =
                {
                    valueSerie,
                },
            };

            Title        = "Value Probabilities (pdf)";
            ValueName    = "Value";
            Distribution = null;
        }
        private CategoryAxis GetCategoryAxis()
        {
            CategoryAxis categoryAxis = new CategoryAxis()
            {
                ShowMajorGridLines = false,
                LabelPlacement     = LabelPlacement.BetweenTicks
            };

            categoryAxis.LabelStyle.TextColor = Android.Graphics.Color.Black;
            return(categoryAxis);
        }
コード例 #21
0
        public void GivenChartControlWithData_WhenDataNotified_ThenChartControlUpdated()
        {
            // Given
            using (var chart = new StackChartControl())
            {
                var data = new StackChartData();
                data.AddColumn("Column 1");
                data.AddColumn("Column 2");
                data.AddRow("Row 1", new[]
                {
                    0.4,
                    0.2
                });
                data.AddRow("Row 2", new[]
                {
                    0.6,
                    0.8
                });

                chart.Data = data;

                CategoryPlotView plotView = chart.Controls.OfType <CategoryPlotView>().Single();
                AssertColumns(data.Columns.ToList(), plotView);
                AssertSeries(data.Rows.Select(r => r.Name).ToList(), plotView);

                // When
                data.Clear();
                data.AddColumn("New column 1");
                data.AddColumn("New column 2");
                data.AddRow("New row 1", new[]
                {
                    0.3,
                    0.8
                });
                data.AddRow("New row 2", new[]
                {
                    0.8,
                    0.2
                });
                data.NotifyObservers();

                // Then
                ElementCollection <Series> series = plotView.Model.Series;
                Assert.AreEqual(2, series.Count);
                Assert.AreEqual("New row 1", series[0].Title);
                Assert.AreEqual("New row 2", series[1].Title);

                CategoryAxis axis = plotView.Model.Axes.OfType <CategoryAxis>().Single();

                Assert.AreEqual(2, axis.Labels.Count);
                Assert.AreEqual("New column 1", axis.Labels[0]);
                Assert.AreEqual("New column 2", axis.Labels[1]);
            }
        }
コード例 #22
0
        protected override void OnCacheLoaded()
        {
            var BikeTheftList = new List <Tuple <int, int, int> >();

            foreach (var item in Cache)
            {
                BikeTheftList.Add(new Tuple <int, int, int>(item.StolenBikes, item.Month, item.Year));
            }
            var graphData = new GraphData <int>("Hoeveelheid fietsdiefstallen per maand",
                                                "Trommels", "maand", new List <int>());
            GraphFactory <int> graphFactory = new GraphFactory <int>();
            PlotModel          plotModel    = graphFactory.createGraph(GraphType.Line, new GraphEffect(), graphData);
            var points = new LineSeries
            {
                Title        = "Fietsdiefstallen per maand",
                MarkerType   = MarkerType.Circle,
                MarkerSize   = 4,
                MarkerStroke = OxyColors.White
            };
            var categoryAxis = new CategoryAxis
            {
                Position        = AxisPosition.Bottom,
                TickStyle       = TickStyle.Outside,
                AbsoluteMinimum = 2011,
                AbsoluteMaximum = 2014
            };
            var valueAxis = new LinearAxis
            {
                Position        = AxisPosition.Left,
                TickStyle       = TickStyle.Outside,
                Minimum         = 0,
                Maximum         = 400,
                AbsoluteMinimum = 0,
                AbsoluteMaximum = 550
            };

            BikeTheftList.Sort(new TupleCompareClass().Compare);
            foreach (var item in BikeTheftList)
            {
                points.Points.Add(new DataPoint((item.Item3 + (1.0 / 12.0 * item.Item2)), item.Item1));
            }
            for (int i = 1; i < 2026; i++)
            {
                categoryAxis.Labels.Add(i.ToString());
            }
            plotModel.Series.Add(points);
            plotModel.Axes.Add(valueAxis);
            plotModel.Axes.Add(categoryAxis);
            this.Content = new PlotView
            {
                BackgroundColor = Device.OnPlatform <Color>(Color.Default, Color.White, Color.Default),
                Model           = plotModel
            };
        }
コード例 #23
0
        private static void AssertColumns(IEnumerable <string> expectedColumnTitles, CategoryPlotView plotView)
        {
            CategoryAxis axis = plotView.Model.Axes.OfType <CategoryAxis>().First();
            int          expectedColumnTitlesCount = expectedColumnTitles.Count();

            Assert.AreEqual(expectedColumnTitlesCount, axis.Labels.Count);

            for (var i = 0; i < expectedColumnTitlesCount; i++)
            {
                Assert.AreEqual(expectedColumnTitles.ElementAt(i), axis.Labels[i]);
            }
        }
コード例 #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BarSeriesManager"/> class.
        /// </summary>
        /// <param name="categoryAxis">The category axis the <paramref name="series"/> belong to.</param>
        /// <param name="valueAxis">The value axis the <paramref name="series"/> belong to.</param>
        /// <param name="series">The bar series this instance should manage.</param>
        public BarSeriesManager(CategoryAxis categoryAxis, Axis valueAxis, IEnumerable <IBarSeries> series)
        {
            this.PlotModel     = categoryAxis.PlotModel ?? throw new InvalidOperationException("The category axis must be part of a plot model.");
            this.CategoryAxis  = categoryAxis;
            this.ValueAxis     = valueAxis;
            this.ManagedSeries = series.ToList();

            foreach (var s in this.ManagedSeries)
            {
                s.Manager = this;
            }
        }
コード例 #25
0
        public ChargeHistogramPlot(Dictionary<int, int> histogram, string name)
            : base(name)
        {
            var axis = new CategoryAxis
            {
                Position = AxisPosition.Bottom,
                MinorStep = 1,
                LabelField = "Charge States",
                AbsoluteMinimum = 0,
                GapWidth = 0
            };

            // Count axis
            var linearAxis = new LinearAxis
            {
                Position = AxisPosition.Left,
                MaximumPadding = .15,
                AbsoluteMinimum = 1,
                Minimum = 0,
                MinimumPadding = 1
            };

            Model.IsLegendVisible = true;
            Model.Axes.Add(axis);
            Model.Axes.Add(linearAxis);

            // Add the data to the view model
            var data = new ColumnSeries
            {
                ValueField = "Value",
                StrokeThickness = 1,
                LabelFormatString = "{0}",
            };

            var colors = new ColorTypeIterator();
            foreach (var key in histogram.Keys)
            {
                axis.Labels.Add(key.ToString());
                int number = histogram[key];

                var column = new ColumnItem(number)
                {
                    Color = colors.GetColor(key)
                };
                data.Items.Add(column);
            }

            m_xAxis = axis;
            Model.Series.Add(data);

            Model.Axes[0].MajorGridlineStyle = LineStyle.Solid;
            Model.Axes[1].MajorGridlineStyle = LineStyle.Solid;
        }
コード例 #26
0
 public static PlotModel StandardCategoryAxis()
 {
     var plotModel1 = new PlotModel();
     plotModel1.Title = "Standard";
     var catAxis = new CategoryAxis();
     catAxis.Labels = new List<string>() { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" };
     plotModel1.Axes.Add(catAxis);
     var linearAxis = new LinearAxis();
     linearAxis.Position = AxisPosition.Left;
     plotModel1.Axes.Add(linearAxis);
     return plotModel1;
 }
コード例 #27
0
        public Forecast(string filter, DateTime start_date, DateTime end_date)
        {
            InitializeComponent();
            SfChart chart = new SfChart();

            chart.Title.Text = "Cumulative savings";

            //Initializing primary axis
            CategoryAxis primaryAxis = new CategoryAxis();

            primaryAxis.Title.Text = "Date";
            chart.PrimaryAxis      = primaryAxis;

            //Initializing secondary Axis
            NumericalAxis secondaryAxis = new NumericalAxis();

            secondaryAxis.Title.Text = "Savings";
            chart.SecondaryAxis      = secondaryAxis;

            ViewDates view = new ViewDates(filter, start_date, end_date);



            //Initializing column series
            ColumnSeries series = new ColumnSeries();

            series.ItemsSource  = view.Data;
            series.XBindingPath = "Date";
            series.YBindingPath = "value";
            series.Label        = "Dollars";

            series.DataMarker    = new ChartDataMarker();
            series.EnableTooltip = true;
            chart.Legend         = new ChartLegend();

            chart.Series.Add(series);
            double Y1 = App.Database.GetStashTarget(filter);

            if (Y1 != 0)
            {
                HorizontalLineAnnotation horizontal = new HorizontalLineAnnotation()
                {
                    Y1 = Y1
                };

                chart.SecondaryAxis = new NumericalAxis()
                {
                    Minimum = 10, Maximum = Y1 + 10
                };
                chart.ChartAnnotations.Add(horizontal);
            }
            this.Content = chart;
        }
コード例 #28
0
ファイル: Plot.cs プロジェクト: zrolfs/mzLib
        /// <summary>
        /// Adds a bar plot. The data X value is the height of the bar, and the data label is the X-axis label under the bar.
        /// </summary>
        public void AddBarPlot(IEnumerable <Datum> data, OxyColor?borderColor = null, OxyColor?fillColor = null,
                               double borderThickness = 1, string xAxisLabel   = null, string yAxisLabel  = null, string chartTitle           = null,
                               string chartSubtitle   = null, bool addToLegend = true, string seriesTitle = null, bool refreshAfterAddingData = true)
        {
            SetCommonChartProperties(chartTitle, chartSubtitle);

            if (!data.Any())
            {
                return;
            }

            var barSeries = new ColumnSeries
            {
                Title          = seriesTitle,
                RenderInLegend = addToLegend
            };

            if (borderColor != null)
            {
                barSeries.StrokeColor = borderColor.Value;
            }

            barSeries.StrokeThickness = borderThickness;

            if (fillColor != null)
            {
                barSeries.FillColor = fillColor.Value;
            }

            var xAxis = new CategoryAxis {
                Title = xAxisLabel, Position = AxisPosition.Bottom
            };

            xAxis.Labels.AddRange(data.Select(p => p.Label));

            foreach (Datum datum in data)
            {
                barSeries.Items.Add(new ColumnItem(datum.X));
            }

            if (!Model.Axes.Any())
            {
                Model.Axes.Add(xAxis);
                AddLinearAxis(yAxisLabel, AxisPosition.Left);
            }

            Model.Series.Add(barSeries);

            if (refreshAfterAddingData)
            {
                RefreshChart();
            }
        }
コード例 #29
0
        private void InitializeEcoPlot() // Erste ökologische Grafik -> finanzrelevantes Balkendiagramm
        {
            m_Plot = new PlotModel
            {
                LegendTitle = TranslationProvider.Translate(Assembly.GetExecutingAssembly(), "TitleMeasureManagementViewModel"),
            };

            m_Plot.Axes.Clear();
            m_Plot.Series.Clear();
            var cgName = SelectedConsumerGroup == null
        ? TranslationProvider.Translate("AllMeasures")
        : SelectedConsumerGroup.GroupName;

            var textForegroundColor = (Color)Application.Current.Resources["BlackColor"];
            var lightControlColor   = (Color)Application.Current.Resources["WhiteColor"];

            m_Plot.Title                   = cgName;
            m_Plot.LegendOrientation       = LegendOrientation.Horizontal;
            m_Plot.LegendPlacement         = LegendPlacement.Outside;
            m_Plot.TextColor               = OxyColor.Parse(textForegroundColor.ToString());
            m_Plot.PlotAreaBorderColor     = OxyColor.Parse(textForegroundColor.ToString());
            m_Plot.PlotAreaBorderThickness = new OxyThickness(1);

            var measureIdArray = Measures.Select(measure => measure.Id.ToString())
                                 .ToArray();

            var categoryAxis = new CategoryAxis(TranslationProvider.Translate("Measure IDs"), new[]
            {
                "1", "2"
            })
            {
                TicklineColor = OxyColor.Parse(textForegroundColor.ToString()),
                IsZoomEnabled = false,
                IsPanEnabled  = false,
            };

            m_Plot.Axes.Add(categoryAxis);

            var valueAxis = new LinearAxis(AxisPosition.Left, 0)
            {
                ShowMinorTicks     = true,
                MinorGridlineStyle = LineStyle.Dot,
                MajorGridlineStyle = LineStyle.Dot,
                MajorGridlineColor = OxyColor.Parse(lightControlColor.ToString()),
                MinorGridlineColor = OxyColor.Parse(lightControlColor.ToString()),
                TicklineColor      = OxyColor.Parse(textForegroundColor.ToString()),
                Title         = "Euro",
                IsZoomEnabled = false,
                IsPanEnabled  = false
            };

            m_Plot.Axes.Add(valueAxis);
        }
コード例 #30
0
        public static PlotModel Graph2()
        {
            var pm = new PlotModel
            {
                Title = "2003 Sales",
                PlotAreaBorderThickness = new OxyThickness(0),
                IsLegendVisible         = false
            };
            var sales1       = new[] { 1000, 1010, 1020, 1010, 1020, 1030, 1000, 500, 1000, 900, 900, 1000 };
            var sales2       = new[] { 2250, 2500, 2750, 2500, 2750, 3000, 2500, 2750, 3100, 2800, 3100, 3500 };
            var categoryAxis = new CategoryAxis
            {
                AxislineStyle = LineStyle.Solid,
                TickStyle     = TickStyle.None
            };

            categoryAxis.Labels.AddRange(new[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" });
            pm.Axes.Add(categoryAxis);
            pm.Axes.Add(
                new LinearAxis
            {
                Position      = AxisPosition.Left,
                Minimum       = 0,
                Maximum       = 4000,
                MajorStep     = 500,
                MinorStep     = 500,
                AxislineStyle = LineStyle.Solid,
                TickStyle     = TickStyle.Outside,
                StringFormat  = "#,0"
            });
            var s1 = new LineSeries {
                Color = OxyColors.Orange
            };

            for (int i = 0; i < 12; i++)
            {
                s1.Points.Add(new DataPoint(i, sales1[i]));
            }

            var s2 = new LineSeries {
                Color = OxyColors.Gray
            };

            for (int i = 0; i < 12; i++)
            {
                s2.Points.Add(new DataPoint(i, sales2[i]));
            }

            pm.Series.Add(s1);
            pm.Series.Add(s2);
            return(pm);
        }
コード例 #31
0
        private void ShowColumnChart()
        {
            chart.Series.Clear();
            chart.Title.Text        = "Balance";
            chart.Legend.Visibility = Visibility.Visible;

            CategoryAxis primaryAxis = new CategoryAxis();

            primaryAxis.Title.Text = "Month";
            chart.PrimaryAxis      = primaryAxis;

            //Initializing Secondary Axis
            NumericalAxis secondaryAxis = new NumericalAxis();

            secondaryAxis.Title.Text = "Amount";
            chart.SecondaryAxis      = secondaryAxis;

            var dataModel = Statistics.Statistics.ColumnChartData(account);

            if (account.Id == 0)
            {
                int counter = 1;
                foreach (var item in dataModel)
                {
                    chart.Series.Add(new ColumnSeries()
                    {
                        DataSource                = item,
                        AnimationEnabled          = true,
                        AnimationDuration         = 0.2,
                        DataPointSelectionEnabled = true,
                        Label          = listOfAccounts[counter].Name,
                        StrokeWidth    = 7,
                        TooltipEnabled = true,
                    });

                    counter += 1;
                }
            }
            else
            {
                chart.Series.Add(new ColumnSeries()
                {
                    DataSource                = dataModel.FirstOrDefault(),
                    AnimationEnabled          = true,
                    AnimationDuration         = 0.2,
                    DataPointSelectionEnabled = true,
                    Label          = account.Name,
                    StrokeWidth    = 7,
                    TooltipEnabled = true,
                });
            }
        }
コード例 #32
0
        /// <summary>
        ///     Set a custom CashFlowModel with the set Start and Enddate
        /// </summary>
        public PlotModel GetCashFlowModel()
        {
            var cashFlow = cashFlowDataProvider.GetValues(StartDate, EndDate);

            var model = new PlotModel();

            var columnSeries = new ColumnSeries();
            var axe          = new CategoryAxis {
                AxislineColor = OxyColors.Black,
                TextColor     = OxyColors.Black,
                IsPanEnabled  = false,
                IsZoomEnabled = false,
                Angle         = 45
            };

            if (SettingsHelper.IsDarkThemeSelected)
            {
                axe.AxislineColor = OxyColors.White;
                axe.AxislineColor = OxyColors.White;

                model.Background = OxyColors.Black;
                model.TextColor  = OxyColors.White;
            }
            else
            {
                axe.AxislineColor = OxyColors.Black;
                axe.AxislineColor = OxyColors.Black;

                model.Background = OxyColors.White;
                model.TextColor  = OxyColors.Black;
            }

            columnSeries.Items.Add(new ColumnItem(cashFlow.Income.Value)
            {
                Color = OxyColors.LightGreen
            });
            axe.Labels.Add(cashFlow.Income.Label);
            columnSeries.Items.Add(new ColumnItem(cashFlow.Spending.Value)
            {
                Color = OxyColor.FromRgb(196, 54, 51)
            });
            axe.Labels.Add(cashFlow.Spending.Label);
            columnSeries.Items.Add(new ColumnItem(cashFlow.Revenue.Value)
            {
                Color = OxyColors.Cyan
            });
            axe.Labels.Add(cashFlow.Revenue.Label);

            model.Axes.Add(axe);
            model.Series.Add(columnSeries);
            return(model);
        }
コード例 #33
0
        /// <summary>
        /// Will perform a coverage plot
        /// </summary>
        /// <param name="theProtein">The PatternTools Fasta Item</param>
        /// <param name="peptides">A List of Tuples were the first item is a list of positions were this peptide aligns with the protein, the second item is the peptide sequence</param>
        public void Plot(FastaItem theProtein, List <Tuple <List <int>, string> > peptides)
        {
            peptides.Sort((a, b) => a.Item1[0].CompareTo(b.Item1[0]));

            PlotModel MyModel = new PlotModel();

            MyModel.Title = theProtein.SequenceIdentifier;

            MyModel.IsLegendVisible = false;


            IntervalBarSeries intervalBarSeriesProtein = new IntervalBarSeries();

            intervalBarSeriesProtein.Title = theProtein.SequenceIdentifier;
            intervalBarSeriesProtein.Items.Add(new IntervalBarItem(0, theProtein.Sequence.Length));


            var categoryAxis1 = new CategoryAxis();

            categoryAxis1.Position = AxisPosition.Left;
            categoryAxis1.Labels.Add(theProtein.SequenceIdentifier);

            MyModel.Series.Add(intervalBarSeriesProtein);

            IntervalBarSeries intervalBarSeriesPeptide = new IntervalBarSeries();

            //Lets insert a blank entry so that the first peptide appears in the first row
            intervalBarSeriesPeptide.FillColor = OxyColors.AliceBlue;
            intervalBarSeriesPeptide.Items.Add(new IntervalBarItem(0, 0));

            foreach (Tuple <List <int>, string> peptide in peptides)
            {
                foreach (int index in peptide.Item1)
                {
                    categoryAxis1.Labels.Add(peptide.Item2);
                    intervalBarSeriesPeptide.Title = peptide.Item2;
                    intervalBarSeriesPeptide.Items.Add(new IntervalBarItem(index, index + peptide.Item2.Length));

                    //And one series to show the coverage on the protein
                    IntervalBarSeries intervalBarSeriesPeptideProtein = new IntervalBarSeries();
                    intervalBarSeriesPeptideProtein.FillColor = OxyColors.AliceBlue;
                    intervalBarSeriesPeptideProtein.Items.Add(new IntervalBarItem(index, index + peptide.Item2.Length));
                    MyModel.Series.Add(intervalBarSeriesPeptideProtein);
                }
            }

            MyModel.Series.Add(intervalBarSeriesPeptide);

            MyModel.Axes.Add(categoryAxis1);

            MyPlot.Model = MyModel;
        }
コード例 #34
0
ファイル: EmpirePlotMV.cs プロジェクト: KrzychuR/CotGBrowser
        private void RefreshPlot()
        {
            PlotModel m = new PlotModel();

            m.Title = Labels.EmpireStats;

            if (ShowScore)
            {
                PlotScore(m);
            }

            if (ShowCities)
            {
                PlotCities(m);
            }

            if (ShowUnitsKills)
            {
                if (ShowKillsAsBars)
                {
                    PlotUnitKillsBar(m);
                }
                else
                {
                    PlotUnitKills(m);
                }
            }

            if (ShowDefRep)
            {
                m_XCatDates = null;

                LinearAxis yAxis = new LinearAxis();
                yAxis.Title = Labels.Reputation;

                if (DiffDefReputation)
                {
                    yAxis.Title += " " + Labels.Difference1;
                }

                yAxis.Key                = "reputation";
                yAxis.Position           = AxisPosition.Left;
                yAxis.MajorGridlineStyle = LineStyle.Solid;
                yAxis.MinorGridlineStyle = LineStyle.Dash;
                m.Axes.Add(yAxis);

                PlotDefRepBars(m);
                PlotOffRepBars(m);
            }

            PlotM = m;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SfChart chart = new SfChart(this);

            chart.Title.Text = "Chart";
            chart.SetBackgroundColor(Color.White);

            //Initializing primary axis
            CategoryAxis primaryAxis = new CategoryAxis();

            primaryAxis.Title.Text = "Name";
            chart.PrimaryAxis      = primaryAxis;

            //Initializing secondary Axis
            NumericalAxis secondaryAxis = new NumericalAxis();

            secondaryAxis.Title.Text = "Height (in cm)";
            chart.SecondaryAxis      = secondaryAxis;

            ObservableCollection <ChartData> data = new ObservableCollection <ChartData>()
            {
                new ChartData {
                    Name = "David", Height = 180
                },
                new ChartData {
                    Name = "Michael", Height = 170
                },
                new ChartData {
                    Name = "Steve", Height = 160
                },
                new ChartData {
                    Name = "Joel", Height = 182
                }
            };

            //Initializing column series
            ColumnSeries series = new ColumnSeries();

            series.ItemsSource  = data;
            series.XBindingPath = "Name";
            series.YBindingPath = "Height";

            series.DataMarker.ShowLabel = true;
            series.Label          = "Heights";
            series.TooltipEnabled = true;

            chart.Series.Add(series);
            chart.Legend.Visibility = Visibility.Visible;
            SetContentView(chart);
        }
コード例 #36
0
        public void FitnessChart_OnFitnessSortOptionChanged()
        {
            FitnessChart chart = new FitnessChart();
            PlotModel    model = chart.PlotModel;

            CategoryAxis axis = (CategoryAxis)model.Axes[0];

            axis.Labels.Add("test");

            chart.FitnessSortOption = FitnessSortOption.Fitness;

            Assert.Empty(axis.Labels);
        }
コード例 #37
0
ファイル: ChartComponent.cs プロジェクト: bhrnjica/daany
        public static PlotModel BarPlot(string title, List<object> x, IEnumerable<double> y, string xLabel = "", string yLabel = "")
        {
            var model = new PlotModel { Title = title };

            var barSeries = new BarSeries { XAxisKey = xLabel, YAxisKey = yLabel }; ;// new ColumnSeries();

            for (int i = 0; i < y.Count(); i++)
                barSeries.Items.Add(new BarItem(y.ElementAt(i), i));

            //var bars = new List<ColumnItem>();
            //for (int i = 0; i < y.Count(); i++)
            //{
            //    var b = new ColumnItem(y.ElementAt(i), i);
            //    bars.Add(b);
            //}
            //barSeries.ItemsSource = bars;

            //add category axis
            // specify key and position
            var xAxes = new CategoryAxis { Position = AxisPosition.Bottom, Key = xLabel };
            foreach (var xL in x)
                xAxes.Labels.Add(xL.ToString());

            model.Axes.Add(xAxes);

            //var xAxes = new CategoryAxis
            //{
            //    Title = xLabel,
            //    Position = AxisPosition.Bottom,
            //    Key = "Target",
            //    ItemsSource = x.ToArray(),
            //};
            //xAxes.ActualLabels.AddRange(x.Select(xx => xx.ToString()));
            //model.Axes.Add(xAxes);


            //add category axis
            var yAxes = new LinearAxis()
            {
                Title = yLabel,
                Position = AxisPosition.Left,


            };
            model.Axes.Add(yAxes);

            model.Series.Add(barSeries);
            //
            return model;

        }
コード例 #38
0
        // khởi tạo ColumnStackChart
        private void TuanOxyPlotColumtStack()
        {
            ModelColumnStack = new PlotModel();
            ModelColumnStack.LegendBorderThickness = 0;
            ModelColumnStack.LegendOrientation     = LegendOrientation.Horizontal;
            //ModelColumnStack.LegendOrientation = LegendOrientation.Vertical;
            ModelColumnStack.LegendPlacement = LegendPlacement.Outside;
            ModelColumnStack.LegendPosition  = LegendPosition.BottomCenter;


            //ModelColumnStack.Title = "Simple stacked model";
            var categoryAxis1 = new CategoryAxis();

            categoryAxis1.MinorStep = 1;
            categoryAxis1.Labels.Add("Category A");
            categoryAxis1.Labels.Add("Category B");
            categoryAxis1.Labels.Add("Category C");
            categoryAxis1.Labels.Add("Category D");
            categoryAxis1.IsZoomEnabled = false;
            categoryAxis1.IsPanEnabled  = false;
            ModelColumnStack.Axes.Add(categoryAxis1);
            var linearAxis1 = new LinearAxis();

            linearAxis1.IsZoomEnabled   = false;
            linearAxis1.IsPanEnabled    = false;
            linearAxis1.AbsoluteMinimum = 0;
            linearAxis1.MaximumPadding  = 0.1;
            linearAxis1.MinimumPadding  = 0;
            ModelColumnStack.Axes.Add(linearAxis1);
            var columnSeries1 = new ColumnSeries();

            columnSeries1.FillColor       = OxyColor.FromRgb(0, 0, 255);
            columnSeries1.IsStacked       = true;
            columnSeries1.StrokeThickness = 1;
            columnSeries1.Title           = "Series 1";
            columnSeries1.Items.Add(new ColumnItem(25));
            columnSeries1.Items.Add(new ColumnItem(137));
            columnSeries1.Items.Add(new ColumnItem(18));
            columnSeries1.Items.Add(new ColumnItem(40));
            ModelColumnStack.Series.Add(columnSeries1);
            var columnSeries2 = new ColumnSeries();

            columnSeries2.IsStacked       = true;
            columnSeries2.StrokeThickness = 1;
            columnSeries2.Title           = "Series 2";
            columnSeries2.Items.Add(new ColumnItem(12));
            columnSeries2.Items.Add(new ColumnItem(14));
            columnSeries2.Items.Add(new ColumnItem(120));
            columnSeries2.Items.Add(new ColumnItem(26));
            ModelColumnStack.Series.Add(columnSeries2);
        }
コード例 #39
0
        public static PlotModel StackingGroups()
        {
            var model = new PlotModel {
                Title = "Stacking groups"
            };
            var series = new TSeries {
                Title = "Series 1", StackGroup = "1", IsStacked = true
            };

            series.Items.Add(new TItem {
                Value = 1
            });
            series.Items.Add(new TItem {
                Value = 2
            });
            model.Series.Add(series);

            var series2 = new TSeries {
                Title = "Series 2", StackGroup = "2", IsStacked = true
            };

            series2.Items.Add(new TItem {
                Value = 2
            });
            series2.Items.Add(new TItem {
                Value = 1
            });
            model.Series.Add(series2);

            var series3 = new TSeries {
                Title = "Series 3", StackGroup = "1", IsStacked = true
            };

            series3.Items.Add(new TItem {
                Value = 3
            });
            series3.Items.Add(new TItem {
                Value = 1
            });
            model.Series.Add(series3);

            var categoryAxis = new CategoryAxis
            {
                Title    = "Category",
                Position = CategoryAxisPosition()
            };

            categoryAxis.Labels.AddRange(new[] { "A", "B" });
            model.Axes.Add(categoryAxis);
            return(model);
        }
コード例 #40
0
        /// <summary>Gets an array of values for the given enumerator</summary>
        /// <param name="xEnum">The enumumerator</param>
        /// <param name="axisType">Type of the axis.</param>
        /// <returns></returns>
        private double[] GetDataPointValues(IEnumerator enumerator, Models.Graph.Axis.AxisType axisType)
        {
            List <double> dataPointValues = new List <double>();

            enumerator.MoveNext();

            if (enumerator.Current.GetType() == typeof(DateTime))
            {
                this.EnsureAxisExists(axisType, typeof(DateTime));
                do
                {
                    DateTime d = Convert.ToDateTime(enumerator.Current);
                    dataPointValues.Add(DateTimeAxis.ToDouble(d));
                    if (d < smallestDate)
                    {
                        smallestDate = d;
                    }
                    if (d > largestDate)
                    {
                        largestDate = d;
                    }
                }while (enumerator.MoveNext());
            }
            else if (enumerator.Current.GetType() == typeof(double) || enumerator.Current.GetType() == typeof(float))
            {
                this.EnsureAxisExists(axisType, typeof(double));
                do
                {
                    dataPointValues.Add(Convert.ToDouble(enumerator.Current,
                                                         System.Globalization.CultureInfo.InvariantCulture));
                }while (enumerator.MoveNext());
            }
            else
            {
                this.EnsureAxisExists(axisType, typeof(string));
                CategoryAxis axis = GetAxis(axisType) as CategoryAxis;
                do
                {
                    int index = axis.Labels.IndexOf(enumerator.Current.ToString());
                    if (index == -1)
                    {
                        axis.Labels.Add(enumerator.Current.ToString());
                        index = axis.Labels.IndexOf(enumerator.Current.ToString());
                    }

                    dataPointValues.Add(index);
                }while (enumerator.MoveNext());
            }

            return(dataPointValues.ToArray());
        }
        private void LoadHumidityemperaturePlot()
        {
            HumidityPlotModel = new PlotModel
            {
                Title      = "Humidity",
                TitleColor = OxyColors.Black
            };

            var magnitudeAxis = new LinearAxis()
            {
                Minimum = 0,
                Title   = "Humidity %",
                MajorGridlineThickness = 1,
                MajorGridlineStyle     = LineStyle.Solid,
                MajorGridlineColor     = OxyColor.Parse("#E9ECEF"),
                CropGridlines          = true,
                TickStyle = TickStyle.None
            };

            HumidityPlotModel.Axes.Add(magnitudeAxis);

            var dateAxis = new CategoryAxis()
            {
                TickStyle = TickStyle.Outside
            };

            HumidityPlotModel.Axes.Add(dateAxis);

            var humiditySerie = new ColumnSeries
            {
                FillColor = OxyColors.Blue
            };

            HumidityPlotModel.Series.Add(humiditySerie);

            var result = Summary
                         .GroupBy(d => Convert.ToDateTime(d.Date).Hour)
                         .Select(i => new
            {
                Hour = i.Key,
                Avg  = i.Average(v => v.Humidity),
                Min  = i.Min(v => v.Humidity),
                Max  = i.Max(v => v.Humidity)
            });

            foreach (var item in result)
            {
                dateAxis.Labels.Add(string.Format("{0}:00", item.Hour));
                humiditySerie.Items.Add(new ColumnItem(item.Avg));
            }
        }
コード例 #42
0
ファイル: Analysis.cs プロジェクト: EFIMCHIK-AA/Rusal
        //Метод создания гистограммы и добавления данных в неё
        private static void SetParamBriefDiagramm(PlotView pv)
        {
            Axis_X = new CategoryAxis()
            {
                Position           = AxisPosition.Bottom,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                Title         = TitleX,
                AxisDistance  = 5,
                TitleFontSize = 14,
                IsZoomEnabled = false,
                IsPanEnabled  = false
            };

            BriefDiagramm = new ColumnSeries()
            {
                IsStacked = true
            };

            Axis_Y = new LinearAxis()
            {
                Position           = AxisPosition.Left,
                MajorGridlineStyle = LineStyle.Dot,
                Title         = TitleY,
                AxisDistance  = 10,
                IsZoomEnabled = false,
                IsPanEnabled  = false,
                TitleFontSize = 14
            };

            pv.Model = new PlotModel
            {
                Title = Title
            };

            pv.Model.DefaultColors = new List <OxyColor>
            {
                OxyColor.FromRgb(30, 144, 255)
            };

            pv.Model.Axes.Add(Axis_Y);
            pv.Model.Axes.Add(Axis_X);
            pv.Model.Series.Add(BriefDiagramm);

            for (int i = 0; i < dataBriefExports.Count; i++)
            {
                BriefDiagramm.Items.Add(new ColumnItem(dataBriefExports[i].Value));
                Axis_X.Labels.Add(dataBriefExports[i].Name);
            }
            SystemArgs.PrintLog("Создание диаграммы краткого отчета завершено успешно");
        }
コード例 #43
0
        public MainWindowModel()
        {
            FAMA.AP.DataLayer.DbBarSeries dataBarSeries = new FAMA.AP.DataLayer.DbBarSeries();

            dataBarSeries.Selectalldata();


            PlotModel = new PlotModel {
                Title = ""
            };
            // var PlotModel = new PlotModel();

            PlotModel.Title           = "";
            PlotModel.LegendPlacement = LegendPlacement.Outside;
            var categoryAxis1 = new CategoryAxis();

            categoryAxis1.MinorStep = 1;
            categoryAxis1.Position  = AxisPosition.Left;
            categoryAxis1.Labels.Add("Activity A");
            categoryAxis1.Labels.Add("Activity B");
            categoryAxis1.Labels.Add("Activity C");
            categoryAxis1.Labels.Add("Activity D");
            //categoryAxis1.ActualLabels.Add("Activity A");
            //categoryAxis1.ActualLabels.Add("Activity B");
            //categoryAxis1.ActualLabels.Add("Activity C");
            //categoryAxis1.ActualLabels.Add("Activity D");
            PlotModel.Axes.Add(categoryAxis1);



            var linearAxis1 = new LinearAxis();

            linearAxis1.MaximumPadding = 0.1;
            linearAxis1.MinimumPadding = 0.1;
            linearAxis1.Position       = AxisPosition.Bottom;
            linearAxis1.IsAxisVisible  = false;
            PlotModel.Axes.Add(linearAxis1);


            var intervalBarSeries1 = new IntervalBarSeries();

            intervalBarSeries1.Title = "";
            intervalBarSeries1.Items.Add(new IntervalBarItem(6, 8));
            intervalBarSeries1.Items.Add(new IntervalBarItem(4, 8));
            intervalBarSeries1.Items.Add(new IntervalBarItem(5, 11));
            intervalBarSeries1.Items.Add(new IntervalBarItem(4, 12));
            intervalBarSeries1.FillColor         = OxyColors.LightBlue;
            intervalBarSeries1.LabelFormatString = "{0},{1}";

            PlotModel.Series.Add(intervalBarSeries1);
        }
コード例 #44
0
ファイル: ChartComponent.cs プロジェクト: bhrnjica/daany
        public static ScatterSeries ScatterSeries(List<object> x, double[] y, System.Drawing.Color markerColor, MarkerType mType)
        {
            var scatterSeries = new ScatterSeries();
           // var scatterSeries = new List<DataPoint>();

            for (int i = 0; i < x.Count; i++)
            {
                var b = new ScatterPoint(CategoryAxis.ToDouble(x[i]), y[i]);
                scatterSeries.Points.Add(b);
            }
            scatterSeries.MarkerFill = OxyColor.FromRgb(markerColor.R, markerColor.G, markerColor.B);
            scatterSeries.MarkerType = mType;
            return scatterSeries;
        }
コード例 #45
0
        public static PlotModel ConfusionMatrix()
        {
            // Example provided by Pau Climent Pérez
            // See also http://en.wikipedia.org/wiki/Confusion_matrix
            var data = new double[3, 3];

            data[0, 0] = 1;
            data[1, 1] = 0.8;
            data[1, 2] = 0.2;
            data[2, 2] = 1;

            // I guess this is where the confusion comes from?
            data = data.Transpose();

            string[] cat1 = { "class A", "class B", "class C" };

            var model = new PlotModel { Title = "Confusion Matrix" };

            var palette = OxyPalette.Interpolate(50, OxyColors.White, OxyColors.Black);

            var lca = new LinearColorAxis { Position = AxisPosition.Right, Palette = palette, HighColor = OxyColors.White, LowColor = OxyColors.White };
            model.Axes.Add(lca);

            var axis1 = new CategoryAxis { Position = AxisPosition.Top, Title = "Actual class" };
            axis1.Labels.AddRange(cat1);
            model.Axes.Add(axis1);

            // We invert this axis, so that they look "symmetrical"
            var axis2 = new CategoryAxis { Position = AxisPosition.Left, Title = "Predicted class" };
            axis2.Labels.AddRange(cat1);
            axis2.Angle = -90;
            axis2.StartPosition = 1;
            axis2.EndPosition = 0;

            model.Axes.Add(axis2);

            var hms = new HeatMapSeries
            {
                Data = data,
                Interpolate = false,
                LabelFontSize = 0.25,
                X0 = 0,
                X1 = data.GetLength(1) - 1,
                Y0 = 0,
                Y1 = data.GetLength(0) - 1,
            };

            model.Series.Add(hms);
            return model;
        }
コード例 #46
0
        public void AddLabel_EmptyLabels_AbsoluteMaximumSet()
        {
            // Setup
            var plotView = new CategoryPlotView();

            // Call
            plotView.AddLabels(Enumerable.Empty <string>());

            // Assert
            CategoryAxis axis = plotView.Model.Axes.OfType <CategoryAxis>().First();

            Assert.AreEqual(0, axis.Labels.Count);
            Assert.AreEqual(0, axis.AbsoluteMaximum);
        }
コード例 #47
0
 public static PlotModel MajorStepCategoryAxis()
 {
     var plotModel1 = new PlotModel();
     plotModel1.Title = "Major Step = 4, IsTickCentered = true";
     var catAxis = new CategoryAxis();
     catAxis.IsTickCentered = true;
     catAxis.MajorStep = 4;
     catAxis.Labels = new List<string>() { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" };
     plotModel1.Axes.Add(catAxis);
     var linearAxis = new LinearAxis();
     linearAxis.Position = AxisPosition.Left;
     plotModel1.Axes.Add(linearAxis);
     return plotModel1;
 }
コード例 #48
0
        private PlotModel GetModel()
        {
            var monthlyExpenses = monthlyExpensesDataProvider.GetCashFlowList(StartDate, EndDate).ToList();

            //TODO: refactor this into an helper class
            var model = new PlotModel();
            LegendList.Clear();

            var columnSeriesIncome = new ColumnSeries();
            var columnSeriesExpense = new ColumnSeries();
            var columnSeriesRevenue = new ColumnSeries();
            var axe = new CategoryAxis
            {
                IsPanEnabled = false,
                IsZoomEnabled = false,
            };

            if (settingsManager.IsDarkThemeSelected)
            {
                model.Background = OxyColors.Black;
                model.TextColor = OxyColors.White;

                axe.AxislineColor = OxyColors.White;
                axe.TextColor = OxyColors.White;
            }
            else
            {
                model.Background = OxyColors.White;
                model.TextColor = OxyColors.Black;
                axe.AxislineColor = OxyColors.Black;
                axe.TextColor = OxyColors.Black;
            }

            foreach (var statisticItem in monthlyExpenses)
            {
                columnSeriesIncome.Items.Add(new ColumnItem(statisticItem.Income.Value) {Color = OxyColors.LightGreen });
                columnSeriesExpense.Items.Add(new ColumnItem(statisticItem.Expense.Value) {Color = expenseRed});
                columnSeriesRevenue.Items.Add(new ColumnItem(statisticItem.Revenue.Value) {Color = OxyColors.Cyan });
                axe.Labels.Add(statisticItem.Month);
            }
            LegendList.Add(new LegendItem {Text = Strings.LegendHeaderText });
            LegendList.AddRange(monthlyExpenses.Select(x => new LegendItem { Text = x.Label}));

            model.Axes.Add(axe);
            model.Series.Add(columnSeriesIncome);
            model.Series.Add(columnSeriesExpense);
            model.Series.Add(columnSeriesRevenue);
            return model;
        }
コード例 #49
0
        public static PlotModel TornadoDiagram1()
        {
            // http://en.wikipedia.org/wiki/Tornado_diagram
            var model = new PlotModel("Tornado diagram 1") { LegendPlacement = LegendPlacement.Outside };

            var s1 = new BarSeries
                {
                    Title = "High",
                    IsStacked = true,
                    FillColor = OxyColor.FromRgb(216, 82, 85),
                    BaseValue = 7,
                    StrokeColor = OxyColors.Black,
                    StrokeThickness = 1
                };
            s1.Items.Add(new BarItem(1));
            s1.Items.Add(new BarItem(1));
            s1.Items.Add(new BarItem(4));
            s1.Items.Add(new BarItem(5));

            var s2 = new BarSeries
                {
                    Title = "Low",
                    IsStacked = true,
                    FillColor = OxyColor.FromRgb(84, 138, 209),
                    BaseValue = 7,
                    StrokeColor = OxyColors.Black,
                    StrokeThickness = 1
                };
            s2.Items.Add(new BarItem(-1));
            s2.Items.Add(new BarItem(-3));
            s2.Items.Add(new BarItem(-2));
            s2.Items.Add(new BarItem(-3));

            var categoryAxis = new CategoryAxis { Position = AxisPosition.Left };
            categoryAxis.Labels.Add("F/X rate");
            categoryAxis.Labels.Add("Inflation");
            categoryAxis.Labels.Add("Price");
            categoryAxis.Labels.Add("Conversion");
            var valueAxis = new LinearAxis(AxisPosition.Bottom) { ExtraGridlines = new[] { 7.0 } };
            model.Series.Add(s1);
            model.Series.Add(s2);
            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);
            return model;
        }
コード例 #50
0
        public static PlotModel Graph2()
        {
            var pm = new PlotModel
                         {
                             Title = "2003 Sales",
                             PlotAreaBorderThickness = new OxyThickness(0),
                             IsLegendVisible = false
                         };
            var sales1 = new[] { 1000, 1010, 1020, 1010, 1020, 1030, 1000, 500, 1000, 900, 900, 1000 };
            var sales2 = new[] { 2250, 2500, 2750, 2500, 2750, 3000, 2500, 2750, 3100, 2800, 3100, 3500 };
            var categoryAxis = new CategoryAxis
            {
                AxislineStyle = LineStyle.Solid,
                TickStyle = TickStyle.None
            };
            categoryAxis.Labels.AddRange(new[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" });
            pm.Axes.Add(categoryAxis);
            pm.Axes.Add(
                new LinearAxis
                {
                    Position = AxisPosition.Left,
                    Minimum = 0,
                    Maximum = 4000,
                    MajorStep = 500,
                    MinorStep = 500,
                    AxislineStyle = LineStyle.Solid,
                    TickStyle = TickStyle.Outside,
                    StringFormat = "#,0"
                });
            var s1 = new LineSeries { Color = OxyColors.Orange };
            for (int i = 0; i < 12; i++)
            {
                s1.Points.Add(new DataPoint(i, sales1[i]));
            }

            var s2 = new LineSeries { Color = OxyColors.Gray };
            for (int i = 0; i < 12; i++)
            {
                s2.Points.Add(new DataPoint(i, sales2[i]));
            }

            pm.Series.Add(s1);
            pm.Series.Add(s2);
            return pm;
        }
コード例 #51
0
        protected override PlotModel createModel(List<DataPoint> points)
        {
            var plotModel = new PlotModel();
            var functionSeries = new StairStepSeries();
            var categoryAxis = new CategoryAxis();

            categoryAxis.Position = AxisPosition.Left;
            categoryAxis.AxislineStyle = LineStyle.Solid;
            categoryAxis.MinorStep = 1;
            categoryAxis.TickStyle = TickStyle.None;
            categoryAxis.Labels.AddRange(Labels);
            plotModel.Axes.Add(categoryAxis);
            functionSeries.Points.AddRange(points);
            plotModel.Series.Add(functionSeries);
            plotModel.Title = Title;
            Points = functionSeries.Points;
            return plotModel;
        }
コード例 #52
0
        /// <summary>
        ///     Set a custom CashFlowModel with the set Start and Enddate
        /// </summary>
        public PlotModel GetCashFlowModel()
        {
            var cashFlow = cashFlowDataProvider.GetCashFlow(StartDate, EndDate);

            var model = new PlotModel();

            var columnSeries = new ColumnSeries();
            var axe = new CategoryAxis
            {
                IsPanEnabled = false,
                IsZoomEnabled = false,
                Angle = 45
            };

            if (settingsManager.IsDarkThemeSelected)
            {
                axe.AxislineColor = OxyColors.White;
                axe.TextColor = OxyColors.White;

                model.Background = OxyColors.Black;
                model.TextColor = OxyColors.White;
            }
            else
            {
                axe.AxislineColor = OxyColors.Black;
                axe.AxislineColor = OxyColors.Black;

                model.Background = OxyColors.White;
                model.TextColor = OxyColors.Black;
            }

            columnSeries.Items.Add(new ColumnItem(cashFlow.Income.Value) {Color = OxyColors.LightGreen});
            axe.Labels.Add(cashFlow.Income.Label);
            columnSeries.Items.Add(new ColumnItem(cashFlow.Expense.Value) {Color = expenseRed });
            axe.Labels.Add(cashFlow.Expense.Label);
            columnSeries.Items.Add(new ColumnItem(cashFlow.Revenue.Value) {Color = OxyColors.Cyan});
            axe.Labels.Add(cashFlow.Revenue.Label);

            model.Axes.Add(axe);
            model.Series.Add(columnSeries);
            return model;
        }
コード例 #53
0
        //private void CreateIntervallItems(DataItemCollection dataItems, int index, IntervalBarSeries intervalBarSeries)
        //{
        //    foreach (var item in dataItems)
        //    {
        //        OxyColor color;
        //        if (!this.ColorMapping.TryGetValue(item.ItemType, out color))
        //        {
        //            color = OxyColor.FromArgb(100, 0, 120, 0);
        //        }
        //        intervalBarSeries.Items.Add(new IntervalBarItem(Axis.ToDouble(item.StartPoint), Axis.ToDouble(item.EndPoint), "Hallo") { Color = color, CategoryIndex = index });
        //        this.CreateIntervallItems(item.Children, index, intervalBarSeries);
        //    }
        //}
        public static PlotModel DiagramBase()
        {
            var plotModel1 = new PlotModel();
            plotModel1.LegendPlacement = LegendPlacement.Outside;
            plotModel1.Title = "Project Events";
            var categoryAxis1 = new CategoryAxis();
            categoryAxis1.MinorStep = 0.5;
            categoryAxis1.Position = AxisPosition.Left;

            plotModel1.Axes.Add(categoryAxis1);
            var linearAxis1 = new DateTimeAxis();
            linearAxis1.MaximumPadding = 0.1;
            linearAxis1.MinimumPadding = 0.1;
            linearAxis1.Position = AxisPosition.Bottom;
            linearAxis1.MajorGridlineStyle = LineStyle.Solid;
            linearAxis1.MinorGridlineStyle = LineStyle.Dot;
            plotModel1.Axes.Add(linearAxis1);

            return plotModel1;
        }
コード例 #54
0
        public static PlotModel TornadoDiagram2()
        {
            var model = new PlotModel { Title = "Tornado diagram 2", LegendPlacement = LegendPlacement.Outside };

            var s1 = new TornadoBarSeries { Title = "TornadoBarSeries", BaseValue = 7 };
            s1.Items.Add(new TornadoBarItem { Minimum = 6, Maximum = 8 });
            s1.Items.Add(new TornadoBarItem { Minimum = 4, Maximum = 8 });
            s1.Items.Add(new TornadoBarItem { Minimum = 5, Maximum = 11 });
            s1.Items.Add(new TornadoBarItem { Minimum = 4, Maximum = 12 });

            var categoryAxis = new CategoryAxis { Position = AxisPosition.Left };
            categoryAxis.Labels.Add("F/X rate");
            categoryAxis.Labels.Add("Inflation");
            categoryAxis.Labels.Add("Price");
            categoryAxis.Labels.Add("Conversion");
            var valueAxis = new LinearAxis { Position = AxisPosition.Bottom, ExtraGridlines = new[] { 7.0 }, MinimumPadding = 0.1, MaximumPadding = 0.1 };
            model.Series.Add(s1);
            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);
            return model;
        }
コード例 #55
0
        private PlotModel GetModel()
        {
            var monthlyExpenses = monthlyExpensesDataProvider.GetValues(StartDate, EndDate);

            //TODO: refactor this into an helper class
            var model = new PlotModel();

            var columnSeries = new ColumnSeries();
            var axe = new CategoryAxis
            {
                IsPanEnabled = false,
                IsZoomEnabled = false,
                Angle = 45
            };

            if (SettingsHelper.IsDarkThemeSelected)
            {
                model.Background = OxyColors.Black;
                model.TextColor = OxyColors.White;
                axe.AxislineColor = OxyColors.White;
                axe.TextColor = OxyColors.White;
            }
            else
            {
                model.Background = OxyColors.White;
                model.TextColor = OxyColors.Black;
                axe.AxislineColor = OxyColors.Black;
                axe.TextColor = OxyColors.Black;
            }

            foreach (var statisticItem in monthlyExpenses)
            {
                columnSeries.Items.Add(new ColumnItem(statisticItem.Value) {Color = graphColor});
                axe.Labels.Add(statisticItem.Label);
            }

            model.Axes.Add(axe);
            model.Series.Add(columnSeries);
            return model;
        }
コード例 #56
0
        private void btnColumnSeries_Click(object sender, EventArgs e)
        {
            plotView1.Focus();

            var categorias = _categoriaService.GetCategorias();

            foreach (var categoria in categorias)
            {
                categoria.Variaveis = _variavelService.GetVariaveis();
            }

            var categoriaAxis = new CategoryAxis();
            categoriaAxis.ItemsSource = categorias;
            categoriaAxis.LabelField = "Nome";

            var linearAxis = new LinearAxis();
            linearAxis.Position = AxisPosition.Left;
            linearAxis.MinimumPadding = 0;
            linearAxis.AbsoluteMinimum = 0;

            var plotModel = new PlotModel { Title = "ColumnSeries" };
            plotModel.Axes.Add(categoriaAxis);
            plotModel.Axes.Add(linearAxis);

            foreach (var categoria in categorias)
            {
                foreach (var variavel in categoria.Variaveis)
                {
                    var columnSeries = new ColumnSeries();
                    columnSeries.Title = variavel.Data.ToString("dd/MM/yyyy");
                    columnSeries.ItemsSource = categoria.Variaveis;
                    columnSeries.ValueField = "Valor";
                    plotModel.Series.Add(columnSeries);
                }
            }

            plotView1.Model = plotModel;
            configurarPlotModel(plotModel);
        }
コード例 #57
0
        private void CreatePlotModel()
        {
            UnrealizedPnLChartModel = new PlotModel { Title = "Unrealized Profit/Loss" };

            var linearAxis = new LinearAxis
            {
                Position = AxisPosition.Bottom,
                StringFormat = "c0",
                MajorGridlineStyle = LineStyle.Dash
            };
            
            UnrealizedPnLChartModel.Axes.Add(linearAxis);

            var categoryAxis = new CategoryAxis
            {
                Position = AxisPosition.Left,
                MinorStep = 1,
                ItemsSource = UnrealizedPnL,
                LabelField = "Item1",
                GapWidth = 0.5,
                Minimum = -1
            };
            UnrealizedPnLChartModel.Axes.Add(categoryAxis);

            var series = new BarSeries
            {
                FillColor = OxyColors.DodgerBlue,
                StrokeColor = OxyColor.FromRgb(67, 110, 160),
                StrokeThickness = 1,
                ItemsSource = UnrealizedPnL,
                ValueField = "Item2",
                LabelFormatString = "{0:c0}",
                LabelPlacement = LabelPlacement.Inside
            };

            UnrealizedPnLChartModel.Series.Add(series);
            
            UnrealizedPnLChartModel.InvalidatePlot(true);
        }
コード例 #58
0
 private void RefreshModel()
 {
     Model = new PlotModel();
     _xAxis = new CategoryAxis
     {
         Key = "X",
         IsPanEnabled = true,
         IsZoomEnabled = false,
         Position = AxisPosition.Bottom,
         GapWidth = 0.1
     };
     Model.Axes.Add(_xAxis);
     Model.Axes.Add(new LinearAxis
     {
         IsPanEnabled = false,
         IsZoomEnabled = false,
         Key = "Y",
         Position = AxisPosition.Left
     });
     _series = new ColumnSeries();
     Model.Series.Add(_series);
     Model.ApplyDefaultTheme();
 }
コード例 #59
0
        public void UpdateGraph(double val)
        {
            Reset();
            try {
                Debug.Assert(val >= 0 && val <= 20);
                var columnSeries = new ColumnSeries() {
                    ItemsSource = new List<ColumnItem>(new[] {
                            new ColumnItem { Value = val }
                    }),
                    FillColor = OxyColors.Black
                };
                columnSeries.Background = OxyColor.FromRgb(255, 0, 0);
                Series.Add(columnSeries);
                Axes.Clear();

                var catAxis = new CategoryAxis {
                    Position = AxisPosition.Bottom,
                    Key = "DraftAxis"
                };
                catAxis.ActualLabels.Add(CategoryName);
                Axes.Add(catAxis);

                var yAxisNew = new LinearAxis() {
                    AbsoluteMinimum = 0,
                    AbsoluteMaximum = 20,
                    Maximum = 20,
                    Position = AxisPosition.Left,
                    MinorStep = 2,
                    MajorStep = 4
                };
                Axes.Add(yAxisNew);

            }
            catch (Exception e) {
                MessageBox.Show(e.InnerException.Message, e.Message);
            }
        }
コード例 #60
0
        public static PlotModel GetErrorColumnSeries()
        {
            var model = new PlotModel
            {
                Title = "ErrorColumnSeries",
                LegendPlacement = LegendPlacement.Outside,
                LegendPosition = LegendPosition.BottomCenter,
                LegendOrientation = LegendOrientation.Horizontal,
                LegendBorderThickness = 0
            };

            var s1 = new ErrorColumnSeries { Title = "Series 1", IsStacked = false, StrokeColor = OxyColors.Black, StrokeThickness = 1 };
            s1.Items.Add(new ErrorColumnItem { Value = 25, Error = 2 });
            s1.Items.Add(new ErrorColumnItem { Value = 137, Error = 25 });
            s1.Items.Add(new ErrorColumnItem { Value = 18, Error = 4 });
            s1.Items.Add(new ErrorColumnItem { Value = 40, Error = 29 });

            var s2 = new ErrorColumnSeries { Title = "Series 2", IsStacked = false, StrokeColor = OxyColors.Black, StrokeThickness = 1 };
            s2.Items.Add(new ErrorColumnItem { Value = 35, Error = 20 });
            s2.Items.Add(new ErrorColumnItem { Value = 17, Error = 7 });
            s2.Items.Add(new ErrorColumnItem { Value = 118, Error = 44 });
            s2.Items.Add(new ErrorColumnItem { Value = 49, Error = 29 });

            var categoryAxis = new CategoryAxis { Position = AxisPosition.Bottom };
            categoryAxis.Labels.Add("Category A");
            categoryAxis.Labels.Add("Category B");
            categoryAxis.Labels.Add("Category C");
            categoryAxis.Labels.Add("Category D");

            var valueAxis = new LinearAxis { Position = AxisPosition.Left, MinimumPadding = 0, MaximumPadding = 0.06, AbsoluteMinimum = 0 };
            model.Series.Add(s1);
            model.Series.Add(s2);
            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);

            return model;
        }