public MainWindow()
        {
            InitializeComponent();
            ThreadPool.QueueUserWorkItem(Connect);
            OutputChart.Series.Clear();

            OutputChart.Axes.Clear();

            var readseries = new ColumnSeries { Title = "Read", Background = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0)) };
            var writeseries = new ColumnSeries { Title = "Write", Background = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0)) };
            var diskaxis = new CategoryAxis { Orientation = AxisOrientation.X };
            OutputChart.Axes.Add(diskaxis);

            var iopsaxis = new LinearAxis { Minimum = 0, Maximum = 50, Orientation = AxisOrientation.Y, Title = "IOPS", ExtendRangeToOrigin = true };
            OutputChart.Axes.Add(iopsaxis);

            readseries.IndependentValueBinding = new Binding("Key");
            readseries.DependentValueBinding = new Binding("Value");
            readseries.ItemsSource = _readdata;

            writeseries.IndependentValueBinding = new Binding("Key");
            writeseries.DependentValueBinding = new Binding("Value");
            writeseries.ItemsSource = _writedata;
            OutputChart.Series.Add(readseries);
            OutputChart.Series.Add(writeseries);
        }
 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
        public static PlotModel BrewerColors6()
        {
            var model = new PlotModel
            {
                Title = "Brewer colors (Paired scheme)",
            };

            model.Axes.Add(new CategoryAxis { Position = AxisPosition.Bottom });

            // See http://colorbrewer2.org/?type=qualitative&scheme=Paired&n=6
            model.DefaultColors = new[]
            {
                OxyColor.FromRgb(166, 206, 227),
                OxyColor.FromRgb(31, 120, 180),
                OxyColor.FromRgb(178, 223, 138),
                OxyColor.FromRgb(51, 160, 44),
                OxyColor.FromRgb(251, 154, 153),
                OxyColor.FromRgb(227, 26, 28)
            };

            var r = new Random(37);
            for (var i = 0; i < model.DefaultColors.Count; i++)
            {
                var columnSeries = new ColumnSeries();
                columnSeries.Items.Add(new ColumnItem(50 + r.Next(50)));
                columnSeries.Items.Add(new ColumnItem(40 + r.Next(50)));
                model.Series.Add(columnSeries);
            }

            return model;
        }
 public static PlotModel Graph1()
 {
     var pm = new PlotModel("Q1 2003 Calls by Region");
     pm.PlotAreaBorderThickness = 0;
     pm.Axes.Add(
         new CategoryAxis
             {
                 AxislineStyle = LineStyle.Solid,
                 Labels = new List<string> { "North", "East", "South", "West" },
                 TickStyle = TickStyle.None
             });
     pm.Axes.Add(
         new LinearAxis(AxisPosition.Left, 0, 6000, 1000, 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;
 }
예제 #5
0
        public static PlotModel BrewerColors4()
        {
            var model = new PlotModel
            {
                Title = "Brewer colors (Accent scheme)",
            };

            model.Axes.Add(new CategoryAxis { Position = AxisPosition.Bottom });

            // See http://colorbrewer2.org/?type=qualitative&scheme=Accent&n=4
            model.DefaultColors = new[]
            {
                OxyColor.FromRgb(127, 201, 127),
                OxyColor.FromRgb(190, 174, 212),
                OxyColor.FromRgb(253, 192, 134),
                OxyColor.FromRgb(255, 255, 153)
            };

            var r = new Random(37);
            for (var i = 0; i < model.DefaultColors.Count; i++)
            {
                var columnSeries = new ColumnSeries();
                columnSeries.Items.Add(new ColumnItem(50 + r.Next(50)));
                columnSeries.Items.Add(new ColumnItem(40 + r.Next(50)));
                model.Series.Add(columnSeries);
            }

            return model;
        }
 public void CategoryNamesAreNotSorted()
 {
     Chart chart = new Chart();
     ColumnSeries series = new ColumnSeries();
     series.IndependentValueBinding = new Binding("Key");
     series.DependentValueBinding = new Binding("Value");
     series.ItemsSource = new KeyValuePair<string, int>[]
     {
         new KeyValuePair<string, int>("c", 3),
         new KeyValuePair<string, int>("a", 1),
         new KeyValuePair<string, int>("b", 2),
     };
     chart.Series.Add(series);
     CategoryAxis axis = null;
     TestAsync(
         chart,
         () => axis = chart.ActualAxes.OfType<CategoryAxis>().FirstOrDefault(),
         () =>
         {
             object[] labels = ChartTestUtilities.GetAxisLabels(axis).Select(l => l.DataContext).ToArray();
             Assert.AreEqual("c", labels[0]);
             Assert.AreEqual("a", labels[1]);
             Assert.AreEqual("b", labels[2]);
         });
 }
        public MainWindow()
        {
            InitializeComponent();

            WeightResultList = new ObservableCollection<FitbitWeightResult>();

            var columnSeries1 = new ColumnSeries()
            {
                ItemsSource = WeightResultList,
                XBindingPath = "Date",
                YBindingPath = "Weight",
                EnableAnimation = true,
                ShowTooltip = true
            };

            var columnSeries2 = new ColumnSeries()
            {
                ItemsSource = WeightResultList,
                XBindingPath = "Date",
                YBindingPath = "Bmi",
                EnableAnimation = true,
                ShowTooltip = true
            };

            weightChart.Series.Add(columnSeries1);
            weightChart.Series.Add(columnSeries2);
        }
        public MainWindow()
        {
            InitializeComponent();

            SummaryList = new ObservableCollection<BandSummary>();

            var columnSeries1 = new ColumnSeries()
            {
                ItemsSource = SummaryList,
                XBindingPath = "Date",
                YBindingPath = "StepCount",
                EnableAnimation = true,
                ShowTooltip = true
            };

            var columnSeries2 = new ColumnSeries()
            {
                ItemsSource = SummaryList,
                XBindingPath = "Date",
                YBindingPath = "Distance",
                EnableAnimation = true,
                ShowTooltip = true
            };

            stepCountChart.Series.Add(columnSeries1);
            stepCountChart.Series.Add(columnSeries2);
        }
        public static PlotModel ColumnSeries()
        {
            var model = new PlotModel
                            {
                                Title = "ColumnSeries",
                                LegendPlacement = LegendPlacement.Outside,
                                LegendPosition = LegendPosition.BottomCenter,
                                LegendOrientation = LegendOrientation.Horizontal,
                                LegendBorderThickness = 0
                            };

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

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

            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;
        }
        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;
        }
예제 #11
0
파일: ChartWindow.cs 프로젝트: neismit/emds
        private void x628e6c716ec340be(int xf3efd21c486a5cce, object x11d58b056c032b03)
        {
            int num = xf3efd21c486a5cce;
            switch (num)
            {
                case 1:
                    this.chart = (Chart) x11d58b056c032b03;
                    break;

                case 2:
                    this.barSeries = (ColumnSeries) x11d58b056c032b03;
                    break;

                case 3:
                    ((Button) x11d58b056c032b03).Click += new RoutedEventHandler(this.x04abae94658fc85d);
                    break;

                default:
                    this._x7dc3d9d322900926 = true;
                    if ((((uint) xf3efd21c486a5cce) - ((uint) num)) <= uint.MaxValue)
                    {
                    }
                    break;
            }
        }
예제 #12
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,
                },
            };
        }
예제 #13
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;
        }
예제 #14
0
        public RegionFieldWindow(string parameterName, IParameter1DimensionalTypeless<double> parameterToDisplay)
        {
            InitializeComponent();

            _parameter = parameterToDisplay;
            _parameterName = parameterName;

            //plotterHeader.Content = parameterName;
            //var l = new System.Windows.Controls.DataVisualization.Charting.LineSeries();
            var data = from p in parameterToDisplay.GetEnumerator()
                       where !Double.IsNaN(p.Value) && !double.IsInfinity(p.Value)
                       select new Tuple<string, double>(p.Dimension1.ToString(), p.Value);

            chart1.Title = parameterName;

            var mySeries = new ColumnSeries();
            mySeries.IndependentValueBinding = new Binding("Item1");
            mySeries.DependentValueBinding = new Binding("Item2");
            mySeries.ItemsSource = data;
            chart1.Series.Add(mySeries);

            var axis = new LinearAxis();
            axis.Orientation = AxisOrientation.Y;
            axis.Minimum = data.Select(i => i.Item2).Min();
            axis.Maximum = data.Select(i => i.Item2).Max();
            chart1.Axes.Add(axis);
        }
        /// <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;
        }
예제 #16
0
 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;
 }
예제 #17
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;
        }
        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;
        }
예제 #19
0
 public void BindingSource(IList<int> distributionList)
 {
     var column = new ColumnSeries { Title = "Electron", StrokeColor = OxyColors.Black, StrokeThickness = 1 };
     var count = 0;
     for (int i = 0; i < 20; i++)
     {
         column.Items.Add(new ColumnItem { Value = distributionList[count] });
         count += 49;
     }
     //foreach (var item in distributionList)
     //{
     //    column.Items.Add(new ColumnItem { Value = item });
     //}
     this.MyElectronPlotModel.Series.Add(column);
 }
예제 #20
0
        void Compare(IList<double> list)
        {
            var column = new ColumnSeries { Title = "Пример", StrokeColor = OxyColors.Black, StrokeThickness = 1 };
            //var count = 0;
            //for (int i = 0; i < 20; i++)
            //{
            //    column.Items.Add(new ColumnItem { Value = list[count] });
            //    count += 49;
            //}

            foreach (double item in list)
            {
                column.Items.Add(new ColumnItem { Value = item });
            }
            this.MyModel.Series.Add(column);
        }
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);
            chart.SetBackgroundColor(Color.White);

            var primaryAxis = new CategoryAxis { LabelPlacement = LabelPlacement.BetweenTicks };
            primaryAxis.Title.Text = "Month";
            chart.PrimaryAxis = primaryAxis;

            var secondaryAxis = new NumericalAxis();
            secondaryAxis.Title.Text = "Sales";
            secondaryAxis.LabelStyle.LabelFormat = "$##.##";
            chart.SecondaryAxis = secondaryAxis;

            var columnSeries = new ColumnSeries
            {
                DataSource = MainPage.GetSelectionData(),
                DataMarkerPosition = DataMarkerPosition.Center,
                SelectedDataPointIndex = 2,
                DataPointSelectionEnabled = true,
            };

            columnSeries.DataMarker.ShowLabel = true;
            chart.Series.Add(columnSeries);
            
            chart.Behaviors.Add(new ChartSelectionBehavior());
            chart.SelectionChanged += chart_SelectionChanged;

            label = new TextView(context){ TextSize = 20 };
            label.SetPadding(5, 5, 5, 5);

            var layout = new LinearLayout(context){ Orientation = Android.Widget.Orientation.Vertical };

            var layoutLabel = new LinearLayout(context)
            {
                Orientation = Android.Widget.Orientation.Horizontal,
                LayoutParameters =
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };

            layoutLabel.SetHorizontalGravity(GravityFlags.CenterHorizontal);
            layoutLabel.AddView(label);
            layout.AddView(layoutLabel);
            layout.AddView(chart);

            return layout;
        }
예제 #22
0
        public MixingSeries()
        {
            InitializeComponent();

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

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

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

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

            DataContext = this;
        }
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);
            chart.SetBackgroundColor(Color.White);

            var primaryAxis = new CategoryAxis {LabelPlacement = LabelPlacement.BetweenTicks};
            primaryAxis.Title.Text = "Month";
            chart.PrimaryAxis = primaryAxis;

            var secondaryAxis = new NumericalAxis();
            secondaryAxis.Title.Text = "Sales";
            secondaryAxis.LabelStyle.LabelFormat = "$##.##";
            chart.SecondaryAxis = secondaryAxis;

            var columnSeries = new ColumnSeries
            {
                DataSource = MainPage.GetSelectionData(),
                DataMarkerPosition = DataMarkerPosition.Center,
            };

            chart.Series.Add(columnSeries);
            chart.Behaviors.Add(new ChartZoomPanBehavior {SelectionZoomingEnabled = true, SelectionRectStrokeWidth = 1});

           
            var label = new TextView(context);;
            label.SetPadding(5, 5, 5, 5);
            label.Text = "Pinch to zoom or double tap and drag to select a region to zoom in.";

            var layout = new LinearLayout(context){ Orientation = Android.Widget.Orientation.Vertical };

            var layoutLabel = new LinearLayout(context)
            {
                Orientation = Android.Widget.Orientation.Horizontal,
                LayoutParameters =
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };

            layoutLabel.SetHorizontalGravity(GravityFlags.CenterHorizontal);
            layoutLabel.AddView(label);
            
            layout.AddView(layoutLabel);
            layout.AddView(chart);

            return layout;
        }
예제 #24
0
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);

            chart.PrimaryAxis = new CategoryAxis { LabelPlacement = LabelPlacement.BetweenTicks };
            chart.SecondaryAxis = new NumericalAxis();

            var series = new ColumnSeries
            {
                DataSource = MainPage.GetData1(),
            };

            series.DataMarker.ShowLabel = true;
            chart.Series.Add(series);
            
            return chart;
        }
예제 #25
0
        public override View GetSampleContent(Context context)
        {
            random = new System.Random();
            LoadData();

            chart = new SfChart(context);
            chart.SetBackgroundColor(Color.White);

            chart.PrimaryAxis = new DateTimeAxis { AutoScrollingDelta = 5, AutoScrollingDeltaType = DateTimeDeltaType.Seconds };
            chart.PrimaryAxis.LabelStyle.LabelFormat = "HH:mm:ss";
            
            var axis = new NumericalAxis {Minimum = 0, Maximum = 100};
            chart.SecondaryAxis = axis;

            var columnSeries = new ColumnSeries {DataSource = data};
            chart.Series.Add(columnSeries);

            chart.Behaviors.Add(new ChartZoomPanBehavior {ScrollingEnabled = true, ZoomingEnabled = false});
            
            UpdateData();

            var label = new TextView(context);
            label.SetPadding(5, 5, 5, 5);
            label.Text = "In this demo, a data point is being added every 500 milliseconds." +
                         " The Chart is then automatically scrolled to display the fixed range of data points at the end." +
                         " You can also pan to view previous data points. In this sample the delta value is 5 seconds.";

            var layout = new LinearLayout(context) { Orientation = Android.Widget.Orientation.Vertical };

            var layoutLabel = new LinearLayout(context)
            {
                Orientation = Android.Widget.Orientation.Horizontal,
                LayoutParameters =
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };

            layoutLabel.SetHorizontalGravity(GravityFlags.CenterHorizontal);
            layoutLabel.AddView(label);

            layout.AddView(layoutLabel);
            layout.AddView(chart);
            return layout;
        }
        /// <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;
        }
예제 #27
0
 public Block CreateColumnChart(double width)
 {
     var cs = new ColumnSeries
     {
         ItemsSource = this._groups,
         IndependentValueBinding = new Binding("SuggestionItems[0].Text"),
         DependentValueBinding = new Binding("Count"),
     };
     cs.Refresh();
     return new BlockUIContainer(new Chart
     {
         DataContext = this._groups,
         Width = width,
         Height = width * 0.60,
         Series =
         {
            cs,
         }
     });
 }
        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;
        }
예제 #29
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);
        }
예제 #30
0
    private void buildCompareChart(string datestart, string dateEnd)
    {
        RadHtmlChart chartCompare = new RadHtmlChart();

        int boid = 0;
        DataTable dsSource = new DataTable();
        Int32.TryParse(CU.getBOID().ToString(),out boid);
        string sl = "Số lượng";
        string gt = "Giá trị(triệu đồng)";

        chartCompare.Height = Unit.Pixel(500);
        ColumnSeries lineSL = new ColumnSeries();

        dsSource = GetDataChartCompare(boid, datestart, dateEnd);
        chartCompare.DataSource = dsSource;
        chartCompare.DataBind();

        ColumnSeries lineGT = new ColumnSeries();

        lineSL.DataFieldY = "SumQuantity";
        lineSL.Name = sl;
        lineSL.TooltipsAppearance.ClientTemplate = sl;

        lineGT.DataFieldY = "SumValue";
        lineGT.Name = gt;
        lineGT.TooltipsAppearance.ClientTemplate = gt;

        for (int i = 0; i < dsSource.Rows.Count;i++)
        {
            AxisItem axitItem = new AxisItem(dsSource.Rows[i]["productno"].ToString());
            chartCompare.PlotArea.XAxis.Items.Add(axitItem);
        }
        chartCompare.PlotArea.Series.Add(lineSL);

        chartCompare.PlotArea.Series.Add(lineGT);
        chartCompare.ChartTitle.Text = "Biểu đồ so sánh doanh số sản phẩm";
        chartCompare.ChartTitle.Appearance.BackgroundColor = System.Drawing.Color.GreenYellow;
        pl.Controls.Add(chartCompare);
    }
예제 #31
0
        public RegionalData()
        {
            InitializeComponent();
            using (LocalDBWorldCountryEntities db = new LocalDBWorldCountryEntities())
            {
                var          data = db.RegionPopulation();
                ColumnSeries col  = new ColumnSeries()
                {
                    Title = "Population", DataLabels = true, Values = new ChartValues <long>(), LabelPoint = point => point.Y.ToString()
                };
                Axis ax = new Axis()
                {
                    Separator = new Separator()
                    {
                        Step = 1, IsEnabled = false
                    }
                };
                ax.Labels = new List <string>();
                foreach (var x in data)
                {
                    col.Values.Add(x.Population.Value);
                    ax.Labels.Add(x.Name.ToString());
                }

                cartesianChart.Series.Add(col);
                cartesianChart.AxisX.Add(ax);
                cartesianChart.AxisY.Add(new Axis
                {
                    LabelFormatter = value => value.ToString(),
                    Separator      = new Separator()
                });
            }


            using (LocalDBWorldCountryEntities db = new LocalDBWorldCountryEntities())
            {
                var data = db.RegionPopulation();

                Axis ax = new Axis()
                {
                    Separator = new Separator()
                    {
                        Step = 1, IsEnabled = false
                    }
                };
                ax.Labels = new List <string>();
                SeriesCollection series = new SeriesCollection();
                foreach (var x in data)
                {
                    PieSeries t = new PieSeries
                    {
                        Title  = x.Name.ToString(),
                        Values = new ChartValues <long> {
                            long.Parse(x.Population.ToString())
                        },
                        DataLabels = true
                    };

                    series.Add(t);
                }


                pieChart1.Series = series;

                pieChart1.AxisY.Add(new Axis
                {
                    LabelFormatter = value => value.ToString(),
                    Separator      = new Separator()
                });
                pieChart1.LegendLocation = LegendLocation.Bottom;
            }
        }
예제 #32
0
        protected override void OnElementChanged(ElementChangedEventArgs <MobileCRM.Shared.CustomControls.BarChart> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement != null || this.Element == null)
            {
                return;
            }

            var plotModel1 = new PlotModel();

            plotModel1.Background = OxyColors.Transparent;


            plotModel1.LegendBorderThickness = 0;
            plotModel1.LegendOrientation     = LegendOrientation.Horizontal;
            plotModel1.LegendPlacement       = LegendPlacement.Outside;
            plotModel1.LegendPosition        = LegendPosition.BottomCenter;
            plotModel1.PlotAreaBorderColor   = OxyColors.White;


            var categoryAxis1 = new CategoryAxis();

            categoryAxis1.AxislineColor      = OxyColors.White;
            categoryAxis1.MajorGridlineColor = OxyColors.White;
            categoryAxis1.MinorGridlineColor = OxyColors.White;
            categoryAxis1.TextColor          = OxyColors.White;
            categoryAxis1.ExtraGridlineColor = OxyColors.White;
            plotModel1.Axes.Add(categoryAxis1);

            var linearAxis1 = new LinearAxis();

            linearAxis1.AxislineColor      = OxyColors.White;
            linearAxis1.MajorGridlineColor = OxyColors.White;
            linearAxis1.MinorGridlineColor = OxyColors.White;
            linearAxis1.TextColor          = OxyColors.White;
            linearAxis1.ExtraGridlineColor = OxyColors.White;
            linearAxis1.AbsoluteMinimum    = 0;
            linearAxis1.MaximumPadding     = 0.06;
            linearAxis1.MinimumPadding     = 0;
            plotModel1.Axes.Add(linearAxis1);

            var columnSeries1 = new ColumnSeries();

            columnSeries1.LabelFormatString = "{0}";
            columnSeries1.LabelPlacement    = LabelPlacement.Inside;
            columnSeries1.StrokeThickness   = 0;
            columnSeries1.TextColor         = OxyColors.White;
            columnSeries1.StrokeColor       = OxyColors.Transparent;
            plotModel1.Series.Add(columnSeries1);

            foreach (var item in Element.Items)
            {
                columnSeries1.Items.Add(new ColumnItem(item.Value, -1)
                {
                    Color = FILLCOLOR
                });
                categoryAxis1.ActualLabels.Add(item.Name);
            }

            var plotView = new PlotView();

            plotView.Model = plotModel1;

            SetNativeControl(plotView);
        }
        private void GenerateGraphColumnData()
        {
            if (m_SelectedPlantPermissionViewModel == null)
            {
                return;
            }

            var textForegroundColor = (Color)Application.Current.Resources["TextForegroundColor"];
            var lightControlColor   = (Color)Application.Current.Resources["LightControlColor"];

            var countOfAuxillaryConditions = m_SelectedPlantPermissionViewModel.Permission.AuxillaryConditions.Count;

            var civm =
                m_SelectedPlantPermissionViewModel.Permission.AuxillaryConditions.SelectMany(
                    ac => m_ConditionInspectionViewModels.Where(ci => ci.ModelAuxillaryCondition.Model.Id == ac.Id));

            var civmIds = civm.Select(ci => ci.ModelAuxillaryCondition.Model.Id).Distinct();

            var civmTrue  = new Collection <ConditionInspectionViewModel>();
            var civmFalse = new Collection <ConditionInspectionViewModel>();

            //var civmTrue = civm.Where(ci => ci.Status);
            //var civmFalse = civm.Where(ci => ci.Status == false);

            foreach (var conditionInspectionViewModel in civmIds)
            {
                var civmOfId = civm.Where(ci => ci.ModelAuxillaryCondition.Model.Id == conditionInspectionViewModel).OrderByDescending(ci => ci.EntryDate).First();

                if (civmOfId.Status)
                {
                    civmTrue.Add(civmOfId);
                }
                else
                {
                    civmFalse.Add(civmOfId);
                }
            }

            var columnTotalCount = new ColumnSeries()
            {
                StrokeThickness = 0,
                FillColor       = OxyColors.Yellow,
                IsStacked       = true,
                StrokeColor     = OxyColors.Yellow
            };

            var columnTrueCount = new ColumnSeries()
            {
                StrokeThickness = 0,
                FillColor       = OxyColors.Green,
                IsStacked       = true,
                StrokeColor     = OxyColors.Green
            };

            var columnFalseCount = new ColumnSeries()
            {
                StrokeThickness = 0,
                FillColor       = OxyColors.Red,
                IsStacked       = true,
                StrokeColor     = OxyColors.Red
            };

            columnTotalCount.Items.Add(new ColumnItem(countOfAuxillaryConditions, 0));
            columnTrueCount.Items.Add(new ColumnItem(civmTrue.Count(), 1));
            columnFalseCount.Items.Add(new ColumnItem(civmFalse.Count(), 2));

            m_LineModelSelectedPermission.Series.Add(columnTotalCount);
            m_LineModelSelectedPermission.Series.Add(columnTrueCount);
            m_LineModelSelectedPermission.Series.Add(columnFalseCount);
        }
예제 #34
0
파일: Fragment4.cs 프로젝트: xardas663/mgr
        private async Task CreatePlotModel()
        {
            var results = await GetDataForSeries();

            var    names = results.Keys.ToArray();
            string title;

            if (isHumidity)
            {
                if (cbDaily.Checked)
                {
                    title = "Wartoœci œrednie dzienne wilgotnoœci";
                }
                else if (cbMonthly.Checked)
                {
                    title = "Wartoœci œrednie miesiêczne wilgotnoœci";
                }
                else
                {
                    title = "Wartoœci œrednie roczne wilgotnoœci";
                }
            }
            else
            {
                if (cbDaily.Checked)
                {
                    title = "Wartoœci œrednie dzienne temperatury";
                }
                else if (cbMonthly.Checked)
                {
                    title = "Wartoœci œrednie miesiêczne temperatury";
                }
                else
                {
                    title = "Wartoœci œrednie roczne temperatury";
                }
            }
            var model = new PlotModel {
                Title = title
            };

            // A ColumnSeries requires a CategoryAxis on the x-axis.
            model.Axes.Add(new CategoryAxis
            {
                ItemsSource = names
            });
            var series = new ColumnSeries();

            foreach (var value in results.Values)
            {
                ColumnItem item;
                if (isHumidity)
                {
                    if (value > room.MaxHumidity)
                    {
                        item       = new ColumnItem(value);
                        item.Color = OxyColor.FromRgb(255, 0, 0);
                    }
                    else if (value < room.MinHumidity)
                    {
                        item       = new ColumnItem(value);
                        item.Color = OxyColor.FromRgb(0, 0, 255);
                    }
                    else if (value > room.ExpectedHumidity + 2 && value < room.MaxHumidity)
                    {
                        item       = new ColumnItem(value);
                        item.Color = OxyColor.FromRgb(200, 70, 10);
                    }

                    else if (value < room.ExpectedHumidity - 2 && value > room.MinHumidity)
                    {
                        item       = new ColumnItem(value);
                        item.Color = OxyColor.FromRgb(40, 70, 120);
                    }

                    else
                    {
                        item       = new ColumnItem(value);
                        item.Color = OxyColor.FromRgb(0, 255, 0);
                    }
                    series.LabelFormatString = "{0:.0}%";
                }

                else
                {
                    if (value > room.MaxTemperature)
                    {
                        item       = new ColumnItem(value);
                        item.Color = OxyColor.FromRgb(255, 0, 0);
                    }
                    else if (value < room.MinTemperature)
                    {
                        item       = new ColumnItem(value);
                        item.Color = OxyColor.FromRgb(0, 0, 255);
                    }
                    else if (value > room.ExpectedTemperature + 1 && value < room.MaxTemperature)
                    {
                        item       = new ColumnItem(value);
                        item.Color = OxyColor.FromRgb(200, 70, 10);
                    }

                    else if (value < room.ExpectedTemperature - 1 && value > room.MinTemperature)
                    {
                        item       = new ColumnItem(value);
                        item.Color = OxyColor.FromRgb(40, 70, 120);
                    }

                    else
                    {
                        item       = new ColumnItem(value);
                        item.Color = OxyColor.FromRgb(0, 255, 0);
                    }
                    series.LabelFormatString = "{0:.0}°C";
                }
                series.LabelPlacement = LabelPlacement.Inside;
                series.Items.Add(item);
            }
            model.Series.Add(series);
            plotView.Model = model;
        }
예제 #35
0
        /// <summary>
        /// Initalizes the crtMonthlyTotals chart.
        /// </summary>
        /// <remarks>
        /// The top part of the form is made up a 3 charts that look like one big chart. This is the bottom
        /// chart which displays the inflow and outflow and projected values for each month.
        /// </remarks>
        private void InitializeMonthlyTotalsChart()
        {
            // Turn off zooming / panning.
            this.crtMonthlyTotals.HorizontalZoomable = false;
            this.crtMonthlyTotals.VerticalZoomable   = false;

            // The chart is a different color at design-time to make it easy to see and interact with.
            // But at run-time, make it the same color as the panel it's in.
            this.crtMonthlyTotals.BackColor = this.pnlTotalCashFlowChart.BackColor;

            // Make sure this chart lines up with the other two.
            this.crtMonthlyTotals.ViewerMargin = new System.Windows.Forms.Padding(0, 0, 0, 0);
            this.crtMonthlyTotals.Margin       = new Padding(0);

            // Set the scale so that only one year of data is visible.
            this.crtMonthlyTotals.WindowScaleHorizontal = MainForm.TotalCashflowChartHorizontalScale;

            // X Axis 1
            // This chart has 2 X Axes. This one is for the Column Series which displays the
            // inflow and outflow for each month.
            //
            #region X Axis 1
            var monthlyTotalsChartCategoryX1 = new CategoryXAxis();
            monthlyTotalsChartCategoryX1.DataSource = DataManager.MonthlyData;

            // Explicitly set the Interval to 1 so we always show every month.
            monthlyTotalsChartCategoryX1.Interval = 1;

            // We are using the Month field for the label. But this is really irrelevant. We
            // are going to use the FormatLabel event to show a three-letter abbreviation for the month
            // instead of the value of the Month field (which is an integer from 1 to 12).
            monthlyTotalsChartCategoryX1.Label           = "Month";
            monthlyTotalsChartCategoryX1.LabelFontFamily = "Verdana";
            monthlyTotalsChartCategoryX1.LabelTextColor  = new SolidColorBrush(Color.FromArgb(146, 146, 146));

            // This eliminates the alternative background color for each interval.
            monthlyTotalsChartCategoryX1.Strip = new Infragistics.Win.DataVisualization.SolidColorBrush(Color.FromArgb(235, 233, 234));

            // This is to create a solid vertical line between each month.
            monthlyTotalsChartCategoryX1.MajorStroke = new SolidColorBrush(Color.FromArgb(195, 195, 195));

            // Hook FormatLabel so we can take the integer (Month) and display a more user-friendly
            // 3-letter abbreviation for the month.
            monthlyTotalsChartCategoryX1.FormatLabel += new AxisFormatLabelHandler(monthlyTotalsChartCategoryX1_FormatLabel);
            #endregion // X Axis 1

            // X Axis 2
            // This chart has 2 X Axes. This one is for the Column Series which displays the
            // PROJECTED inflow and outflow for each month.
            //
            #region X Axis 2
            var monthlyTotalsChartCategoryX2 = new CategoryXAxis();

            monthlyTotalsChartCategoryX2.DataSource = DataManager.MonthlyData;
            monthlyTotalsChartCategoryX2.Interval   = 1;

            // Even though this axis will not be displaying any labels, we still need to set the
            // Label field so it has the right number of data items.
            monthlyTotalsChartCategoryX2.Label = "Month";

            // This is a sneaky trick to draw some lines going up that join with the chart
            // in the middle (this.crtLabels) so they look like one big chart.
            monthlyTotalsChartCategoryX2.LabelLocation = AxisLabelsLocation.OutsideTop;
            monthlyTotalsChartCategoryX2.LabelExtent   = 10;
            monthlyTotalsChartCategoryX2.TickLength    = 10;

            // This is essentially to hide the labels, which are unneccessary since X Axis 1
            // is displaying the labels we need.
            monthlyTotalsChartCategoryX2.LabelTextColor = new SolidColorBrush(Color.FromArgb(235, 233, 234));

            // We don't needs any of these to draw since X Axis 1 already gives us the lines we need.
            monthlyTotalsChartCategoryX2.Strip       = new SolidColorBrush(Color.Transparent);
            monthlyTotalsChartCategoryX2.Stroke      = new SolidColorBrush(Color.Transparent);
            monthlyTotalsChartCategoryX2.MajorStroke = new SolidColorBrush(Color.Transparent);
            #endregion // X Axis 2

            // Y Axis
            // The Y Axis is the monetary value of each inflow and outflow. We will use the
            // same Y Axis for all 4 Columns (and both X Axes).
            //
            #region Y Axis
            var monthlyTotalsChartNumericY = new NumericYAxis();
            monthlyTotalsChartNumericY.LabelTextColor  = new SolidColorBrush(Color.FromArgb(146, 146, 146));
            monthlyTotalsChartNumericY.MajorStroke     = new SolidColorBrush(Color.FromArgb(195, 195, 195));
            monthlyTotalsChartNumericY.StrokeThickness = 1;

            // We need to set the label extent so that the labels line up with the other
            // two charts.
            monthlyTotalsChartNumericY.LabelExtent = TotalCashflowChartYAxisLabelExtent;

            // Always start at 0 so the relative sizes of the columns are meaningful.
            monthlyTotalsChartNumericY.MinimumValue = 0;

            // Hook format label so we can apply custom formatting to the labels. Otherwise,
            // these labels will show the raw values in the millions and there will be a whole
            // lot of unneccessary zeroes.
            monthlyTotalsChartNumericY.FormatLabel += new AxisFormatLabelHandler(monthlyTotalsChartNumericY_FormatLabel);
            #endregion // Y Axis

            // Add the axes to the chart.
            this.crtMonthlyTotals.Axes.Add(monthlyTotalsChartNumericY);
            this.crtMonthlyTotals.Axes.Add(monthlyTotalsChartCategoryX1);
            this.crtMonthlyTotals.Axes.Add(monthlyTotalsChartCategoryX2);

            // Inflow column series
            //
            #region inflow column series
            var monthlyTotalsChartInflowSeries = new ColumnSeries();
            monthlyTotalsChartInflowSeries.Title                 = "inflow";
            monthlyTotalsChartInflowSeries.XAxis                 = monthlyTotalsChartCategoryX1;
            monthlyTotalsChartInflowSeries.YAxis                 = monthlyTotalsChartNumericY;
            monthlyTotalsChartInflowSeries.ValueMemberPath       = "Inflow";
            monthlyTotalsChartInflowSeries.DataSource            = DataManager.MonthlyData;
            monthlyTotalsChartInflowSeries.IsTransitionInEnabled = true;
            monthlyTotalsChartInflowSeries.Brush                 = new SolidColorBrush(Color.FromArgb(56, 106, 155));
            monthlyTotalsChartInflowSeries.Outline               = new SolidColorBrush(Color.FromArgb(56, 106, 155));
            #endregion // inflow column  series

            // Outflow column series
            //
            #region Outflow column series
            var monthlyTotalsChartOutflowSeries = new ColumnSeries();
            monthlyTotalsChartOutflowSeries.Title                 = "outflow";
            monthlyTotalsChartOutflowSeries.XAxis                 = monthlyTotalsChartCategoryX1;
            monthlyTotalsChartOutflowSeries.YAxis                 = monthlyTotalsChartNumericY;
            monthlyTotalsChartOutflowSeries.ValueMemberPath       = "Outflow";
            monthlyTotalsChartOutflowSeries.DataSource            = DataManager.MonthlyData;
            monthlyTotalsChartOutflowSeries.IsTransitionInEnabled = true;
            monthlyTotalsChartOutflowSeries.Brush                 = new SolidColorBrush(Color.FromArgb(243, 122, 43));
            monthlyTotalsChartOutflowSeries.Outline               = new SolidColorBrush(Color.FromArgb(243, 122, 43));
            #endregion // Outflow column series

            // Projected inflow column series
            //
            #region Projected inflow column series
            var monthlyTotalsChartProjectedInflow = new ColumnSeries();
            monthlyTotalsChartProjectedInflow.Title                 = "projected inflow";
            monthlyTotalsChartProjectedInflow.XAxis                 = monthlyTotalsChartCategoryX2;
            monthlyTotalsChartProjectedInflow.YAxis                 = monthlyTotalsChartNumericY;
            monthlyTotalsChartProjectedInflow.ValueMemberPath       = "ProjectedInflow";
            monthlyTotalsChartProjectedInflow.DataSource            = DataManager.MonthlyData;
            monthlyTotalsChartProjectedInflow.IsTransitionInEnabled = true;
            monthlyTotalsChartProjectedInflow.MarkerType            = MarkerType.Circle;
            monthlyTotalsChartProjectedInflow.Brush                 = new SolidColorBrush(Color.Transparent);
            monthlyTotalsChartProjectedInflow.Outline               = new SolidColorBrush(Color.Transparent);
            monthlyTotalsChartProjectedInflow.MarkerBrush           = new SolidColorBrush(Color.FromArgb(56, 106, 155));
            monthlyTotalsChartProjectedInflow.MarkerOutline         = new SolidColorBrush(Color.FromArgb(240, 240, 240));
            #endregion // Projected inflow column series

            // Projected outflow column series
            //
            #region Projected outflow column series
            var monthlyTotalsChartProjectedOutflow = new ColumnSeries();
            monthlyTotalsChartProjectedOutflow.Title                 = "projected outflow";
            monthlyTotalsChartProjectedOutflow.XAxis                 = monthlyTotalsChartCategoryX2;
            monthlyTotalsChartProjectedOutflow.YAxis                 = monthlyTotalsChartNumericY;
            monthlyTotalsChartProjectedOutflow.ValueMemberPath       = "ProjectedOutflow";
            monthlyTotalsChartProjectedOutflow.DataSource            = DataManager.MonthlyData;
            monthlyTotalsChartProjectedOutflow.IsTransitionInEnabled = true;
            monthlyTotalsChartProjectedOutflow.MarkerType            = MarkerType.Circle;
            monthlyTotalsChartProjectedOutflow.Brush                 = new SolidColorBrush(Color.Transparent);
            monthlyTotalsChartProjectedOutflow.Outline               = new SolidColorBrush(Color.Transparent);
            monthlyTotalsChartProjectedOutflow.MarkerBrush           = new SolidColorBrush(Color.FromArgb(243, 122, 43));
            monthlyTotalsChartProjectedOutflow.MarkerOutline         = new SolidColorBrush(Color.FromArgb(240, 240, 240));
            #endregion // Projected outflow column series

            // Add the series to the chart.
            this.crtMonthlyTotals.Series.Add(monthlyTotalsChartInflowSeries);
            this.crtMonthlyTotals.Series.Add(monthlyTotalsChartOutflowSeries);
            this.crtMonthlyTotals.Series.Add(monthlyTotalsChartProjectedInflow);
            this.crtMonthlyTotals.Series.Add(monthlyTotalsChartProjectedOutflow);
        }
예제 #36
0
        private void cmbGrafikler_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbGrafikler.SelectedIndex == 0)
            {
                //cartesianChart2.Visible = false;
                //cartesianChart3.Visible = false;
                //cartesianChart1.Visible = true;
                cartesianChart1.Series.Clear();
                cartesianChart1.AxisX.Clear();
                cartesianChart1.AxisY.Clear();

                var data = _finansTakipService.GelirYillikChart(DateTime.Now);
                ChartValues <decimal> listGelir = new ChartValues <decimal>();
                foreach (var item in data)
                {
                    listGelir.Add(item.ToplamTutar);
                }
                List <string> listAylar = new List <string>();
                foreach (var item1 in data)
                {
                    string ay = Enum.GetName(typeof(Aylar), item1.Ay);
                    listAylar.Add(ay);
                }

                var data1 = _finansTakipService.GiderYillikChart(DateTime.Now);
                ChartValues <decimal> listGider = new ChartValues <decimal>();
                foreach (var item in data1)
                {
                    listGider.Add(item.ToplamTutar);
                }
                List <string> listAylar1 = new List <string>();
                foreach (var item1 in data1)
                {
                    listAylar1.Add(item1.Ay.ToString());
                }

                cartesianChart1.Series = new SeriesCollection();
                LineSeries gelir = new LineSeries();
                gelir.Title             = "Aylık Toplam Gelir";
                gelir.Values            = listGelir;
                gelir.PointGeometry     = DefaultGeometries.Diamond;
                gelir.LineSmoothness    = 1;
                gelir.PointGeometrySize = 10;
                gelir.PointForeground   = System.Windows.Media.Brushes.DarkBlue;
                cartesianChart1.Series.Add(gelir);

                LineSeries gider = new LineSeries();
                gider.Title             = "Aylık Toplam Gider";
                gider.Values            = listGider;
                gider.PointGeometry     = DefaultGeometries.Square;
                gider.LineSmoothness    = 1;
                gider.PointGeometrySize = 10;
                gider.PointForeground   = System.Windows.Media.Brushes.Black;
                cartesianChart1.Series.Add(gider);


                Axis ax1 = new Axis();
                ax1.Labels     = listAylar;
                ax1.Title      = "Aylar";
                ax1.Foreground = System.Windows.Media.Brushes.Black;
                ax1.FontStyle  = System.Windows.FontStyles.Italic;
                ax1.FontWeight = System.Windows.FontWeights.Bold;
                cartesianChart1.AxisX.Add(ax1);
                cartesianChart1.AxisY.Add(new Axis
                {
                    Foreground = System.Windows.Media.Brushes.Black,
                    FontWeight = System.Windows.FontWeights.Bold,
                    MinValue   = 0,
                    Title      = "Toplam Tutar"
                });

                cartesianChart1.LegendLocation = LegendLocation.Top;
            }
            else if (cmbGrafikler.SelectedIndex == 1)
            {
                cartesianChart1.Series.Clear();
                cartesianChart1.AxisX.Clear();
                cartesianChart1.AxisY.Clear();
                #region YillikUrun
                var data2 = _urunService.UrunKazancGrafigi();

                ColumnSeries col2 = new ColumnSeries()
                {
                    DataLabels = true, Values = new ChartValues <decimal>(), LabelPoint = point => point.Y.ToString(), Title = "Toplam Fiyat : "
                };
                Axis ax = new Axis()
                {
                    Separator = new Separator()
                    {
                        Step = 1, IsEnabled = false
                    }
                };
                ax.Labels = new List <string>();

                ax.Title      = "Aylar";
                ax.Foreground = System.Windows.Media.Brushes.Black;
                ax.FontWeight = System.Windows.FontWeights.Bold;

                foreach (var x in data2)
                {
                    col2.Values.Add(x.Fiyat);
                    string ay = Enum.GetName(typeof(Aylar), x.Ay);
                    ax.Labels.Add(ay);
                }


                cartesianChart1.Series.Add(col2);
                cartesianChart1.AxisX.Add(ax);
                cartesianChart1.AxisY.Add(new Axis
                {
                    LabelFormatter = value => value.ToString(),
                    Separator      = new Separator(),
                    Foreground     = System.Windows.Media.Brushes.Black,
                    FontWeight     = System.Windows.FontWeights.Bold,
                    Title          = "Aylık Ürün Geliri/TL"
                });
                #endregion
            }
            else if (cmbGrafikler.SelectedIndex == 3)
            {
                cartesianChart1.Series.Clear();
                cartesianChart1.AxisX.Clear();
                cartesianChart1.AxisY.Clear();
                #region UyeDagilimi

                var data = _uyeService.UyeDonemDagilimiGetir();
                ChartValues <int> list = new ChartValues <int>();
                foreach (var item in data)
                {
                    list.Add(item.ToplamSayi);
                }
                List <string> listYillar = new List <string>();
                foreach (var item1 in data)
                {
                    listYillar.Add(item1.Yil.ToString());
                }
                cartesianChart1.Series = new SeriesCollection();
                LineSeries a = new LineSeries();
                a.Title             = "Yeni Kayıt Sayısı";
                a.Values            = list;
                a.PointGeometry     = DefaultGeometries.Circle;
                a.LineSmoothness    = 0;
                a.PointGeometrySize = 10;
                a.PointForeground   = System.Windows.Media.Brushes.DarkBlue;
                cartesianChart1.Series.Add(a);


                Axis ax1 = new Axis();
                ax1.Labels = listYillar;
                ax1.Title  = "Yıllar";
                cartesianChart1.AxisX.Add(ax1);
                cartesianChart1.AxisY.Add(new Axis
                {
                    Title = "Yeni Kayıt Sayısı"
                });

                cartesianChart1.LegendLocation = LegendLocation.Top;



                #endregion
            }
            else if (cmbGrafikler.SelectedIndex == 2)
            {
                cartesianChart1.Series.Clear();
                cartesianChart1.AxisX.Clear();
                cartesianChart1.AxisY.Clear();
                #region UrunStok

                var          dataUrunStok = _urunService.UrunStokDagilimiGrafigi();
                ColumnSeries col          = new ColumnSeries()
                {
                    DataLabels = true, Values = new ChartValues <int>(), LabelPoint = point => point.Y.ToString(), Title = "STOK"
                };
                Axis ax = new Axis()
                {
                    Separator = new Separator()
                    {
                        Step = 1, IsEnabled = false
                    }
                };
                ax.Labels         = new List <string>();
                ax.LabelsRotation = 135;
                ax.Title          = "ÜRÜN ADI";
                foreach (var x in dataUrunStok)
                {
                    col.Values.Add(x.UrunStok);
                    ax.Labels.Add(x.UrunAdi);
                }

                cartesianChart1.Series.Add(col);
                cartesianChart1.AxisX.Add(ax);
                cartesianChart1.AxisY.Add(new Axis
                {
                    LabelFormatter = value => value.ToString(),
                    Separator      = new Separator()
                });
                #endregion
            }
        }
예제 #37
0
        bool ProcessSeriesData(ref List <object> listOfSeries, string chartType, string seriesDataString, ref string failOverMessage)
        {
            bool parsed         = false;
            bool isSingleSeries = false;

            List <ColumnSeries> columnSeriesList = new List <ColumnSeries>();

            string[] seriesDataStringArray = seriesDataString.Split(new string[] { Statics.SeparateLineSeries }, StringSplitOptions.RemoveEmptyEntries);

            if (seriesDataStringArray.Length < 1)
            {
                isSingleSeries = true;
            }

            foreach (string lineSeriesItemString in seriesDataStringArray)
            {
                object series;
                switch (chartType.ToUpper().Replace(" ", ""))
                {
                case Statics.Area:
                    series = new AreaSeries();
                    ((AreaSeries)series).IndependentValuePath = "Key";
                    ((AreaSeries)series).DependentValuePath   = "Value";
                    break;

                case Statics.Bar:
                    series = new ColumnSeries();
                    ((ColumnSeries)series).IndependentValuePath = "Key";
                    ((ColumnSeries)series).DependentValuePath   = "Value";
                    break;

                case Statics.Bubble:
                    series = new BubbleSeries();
                    ((BubbleSeries)series).IndependentValuePath = "Key";
                    ((BubbleSeries)series).DependentValuePath   = "Value";
                    break;

                case Statics.RotatedBar:
                    series = new BarSeries();
                    ((BarSeries)series).IndependentValuePath = "Key";
                    ((BarSeries)series).DependentValuePath   = "Value";
                    break;

                case Statics.Histogram:
                    series = new ColumnSeries();
                    ((ColumnSeries)series).IndependentValuePath = "Key";
                    ((ColumnSeries)series).DependentValuePath   = "Value";
                    break;

                case Statics.Line:
                    series = new LineSeries();
                    ((LineSeries)series).IndependentValuePath = "Key";
                    ((LineSeries)series).DependentValuePath   = "Value";
                    break;

                case Statics.Pie:
                    series = new PieSeries();
                    ((PieSeries)series).IndependentValuePath = "Key";
                    ((PieSeries)series).DependentValuePath   = "Value";
                    break;

                case Statics.Scatter:
                    series = new ScatterSeries();
                    ((ScatterSeries)series).IndependentValuePath = "Key";
                    ((ScatterSeries)series).DependentValuePath   = "Value";
                    break;

                case Statics.Stacked:
                //series = new StackedBarSeries();
                //((StackedBarSeries)series).IndependentValuePath = "Key";
                //((StackedBarSeries)series).DependentValuePath = "Value";

                case Statics.TreeMap:
                default:
                    failOverMessage = "The specified graph type supplied in the input parameters (initParams) could not be parsed.";
                    return(false);
                }

                string[] titleSplit = lineSeriesItemString.Split(new string[] { Statics.LineSeriesTitle }, StringSplitOptions.None);

                if (titleSplit.Length == 3)
                {
                    switch (chartType.ToUpper().Replace(" ", ""))
                    {
                    case Statics.Area:
                        ((AreaSeries)series).Title = titleSplit[1];
                        break;

                    case Statics.Bar:
                        ((ColumnSeries)series).Title = titleSplit[1];
                        break;

                    case Statics.Bubble:
                        ((BubbleSeries)series).Title = titleSplit[1];
                        break;

                    case Statics.RotatedBar:
                        ((BarSeries)series).Title = titleSplit[1];
                        break;

                    case Statics.Histogram:
                        ((ColumnSeries)series).Title = titleSplit[1];
                        break;

                    case Statics.Line:
                        ((LineSeries)series).Title = titleSplit[1];
                        break;

                    case Statics.Pie:
                        ((PieSeries)series).Title = titleSplit[1];
                        break;

                    case Statics.Scatter:
                        ((ScatterSeries)series).Title = titleSplit[1];
                        break;

                    case Statics.Stacked:
                    case Statics.TreeMap:
                    default:
                        break;
                    }
                }

                Dictionary <object, object> pointList = new Dictionary <object, object>();

                string[] dataSplit = lineSeriesItemString.Split(new string[] { Statics.LineSeriesDataString }, StringSplitOptions.None);

                object independentValue = string.Empty;
                object dependentValue   = 0.0;

                if (dataSplit.Length == 3)
                {
                    string dataString = dataSplit[1];

                    string[] dataPairStringArray = dataString.Split(new string[] { Statics.SeparateDataPoints }, StringSplitOptions.None);

                    foreach (string pair in dataPairStringArray)
                    {
                        if (pair.Length > 0)
                        {
                            string[] set = pair.Split(new string[] { Statics.SeparateIndDepValues }, StringSplitOptions.None);

                            try
                            {
                                if (set.Length == 2)
                                {
                                    Double   doubleCandidate;
                                    DateTime dateTimeCandidate;

                                    // < independent >
                                    if (Double.TryParse(set[0], out doubleCandidate))
                                    {
                                        independentValue = doubleCandidate;

                                        if (_minIndependentValueIsValid)
                                        {
                                            if ((double)independentValue < (double)_minIndependentValue)
                                            {
                                                _minIndependentValue = independentValue;
                                            }
                                        }
                                        else
                                        {
                                            _minIndependentValue        = independentValue;
                                            _minIndependentValueIsValid = true;
                                        }

                                        if (_maxIndependentValueIsValid)
                                        {
                                            if ((double)independentValue > (double)_maxIndependentValue)
                                            {
                                                _maxIndependentValue = independentValue;
                                            }
                                        }
                                        else
                                        {
                                            _maxIndependentValue        = independentValue;
                                            _maxIndependentValueIsValid = true;
                                        }
                                    }
                                    else if (DateTime.TryParse(set[0], out dateTimeCandidate))
                                    {
                                        independentValue = dateTimeCandidate;

                                        if (_minIndependentValueIsValid)
                                        {
                                            if ((DateTime)independentValue < (DateTime)_minIndependentValue)
                                            {
                                                _minIndependentValue = independentValue;
                                            }
                                        }
                                        else
                                        {
                                            _minIndependentValue        = independentValue;
                                            _minIndependentValueIsValid = true;
                                        }

                                        if (_maxIndependentValueIsValid)
                                        {
                                            if ((DateTime)independentValue > (DateTime)_maxIndependentValue)
                                            {
                                                _maxIndependentValue = independentValue;
                                            }
                                        }
                                        else
                                        {
                                            _maxIndependentValue        = independentValue;
                                            _maxIndependentValueIsValid = true;
                                        }
                                    }
                                    else
                                    {
                                        independentValue = set[0].ToString();
                                    }

                                    // < dependent >
                                    if (Double.TryParse(set[1], out doubleCandidate))
                                    {
                                        dependentValue = doubleCandidate;
                                    }
                                    else if (DateTime.TryParse(set[1], out dateTimeCandidate))
                                    {
                                        dependentValue = dateTimeCandidate;
                                    }
                                    else
                                    {
                                        dependentValue = set[1].ToString();
                                    }

                                    pointList.Add(independentValue, dependentValue);
                                }
                            }
                            catch
                            {
                                return(false);
                            }
                        }
                    }
                }
                else
                {
                    failOverMessage = string.Format("Parse fail with '{0}'", lineSeriesItemString);
                    return(false);
                }

                AddItemSourceToSeries(chartType, series, pointList);

                if (isSingleSeries)
                {
                    AddAxesToSeries(chartType, series, independentValue);
                }
                else
                {
                    //((ColumnSeries)series).IndependentAxis = new LinearAxis
                    //{
                    //    Title = _independentLabel,
                    //    Orientation = AxisOrientation.X,
                    //    Minimum = (double)_minIndependentValue,
                    //    Maximum = (double)_maxIndependentValue
                    //};
                }

                listOfSeries.Add(series);
                parsed = true;
            }
            return(parsed);
        }
예제 #38
0
        private void buffer_Click(object sender, RoutedEventArgs e)
        {
            this.mychart.Series.Clear();
            List <DynamicData> drLst = new List <DynamicData>();
            int xax = this.xaxis.SelectedIndex;
            int yax = this.yaxis.SelectedIndex;

            try
            {
                Convert.ToDouble(_data.Rows[0].Values[yax]);
            }
            catch
            {
                MessageBox.Show("字段" + this.yaxis.SelectedItem.ToString() + "无法统计,请重新选择!");
                return;
            }
            for (int i = 0; i < _data.Rows.Length; i++)
            {
                DynamicData dd = new DynamicData();
                dd.X = _data.Rows[i].Values[xax].ToString( );
                dd.Y = Convert.ToDouble(_data.Rows[i].Values[yax]);
                drLst.Add(dd);
            }
            switch (this.chartType.SelectedItem.ToString())
            {
            case "柱状图":
                this.mychart.Title       = "柱状图";
                this.mychart.LegendTitle = "";
                ColumnSeries myColumn = new ColumnSeries
                {
                    ItemsSource             = drLst,
                    Title                   = "柱状图",
                    IndependentValueBinding = new Binding("X"),    //X轴
                    DependentValueBinding   = new Binding("Y"),    //Y轴
                };
                this.mychart.Series.Add(myColumn);
                break;

            case "饼图":
                this.mychart.Title       = "饼图";
                this.mychart.LegendTitle = "饼图";
                PieSeries myPie = new PieSeries
                {
                    ItemsSource             = drLst,
                    Title                   = "饼图",
                    IndependentValueBinding = new Binding("X"),    //X轴
                    DependentValueBinding   = new Binding("Y"),    //Y轴
                };
                this.mychart.Series.Add(myPie);
                break;

            case "点状图":
                this.mychart.Title       = "点状图";
                this.mychart.LegendTitle = "";
                ScatterSeries myScatter = new ScatterSeries
                {
                    ItemsSource             = drLst,
                    Title                   = "点状图",
                    IndependentValueBinding = new Binding("X"),    //X轴
                    DependentValueBinding   = new Binding("Y"),    //Y轴
                };
                this.mychart.Series.Add(myScatter);
                break;

            case "线形图":
                this.mychart.Title       = "线形图";
                this.mychart.LegendTitle = "";
                LineSeries myLine = new LineSeries
                {
                    ItemsSource             = drLst,
                    Title                   = "线形图",
                    IndependentValueBinding = new Binding("X"),   //X轴
                    DependentValueBinding   = new Binding("Y"),   //Y轴
                };
                this.mychart.Series.Add(myLine);
                break;

            case "区域图":
                this.mychart.Title       = "区域图";
                this.mychart.LegendTitle = "";
                AreaSeries myArea = new AreaSeries
                {
                    ItemsSource             = drLst,
                    Title                   = "区域图",
                    IndependentValueBinding = new Binding("X"),   //X轴
                    DependentValueBinding   = new Binding("Y"),   //Y轴
                };
                this.mychart.Series.Add(myArea);
                break;
            }
        }
예제 #39
0
        public void AddLevel3Control(Point p)
        {
            switch (ControlTag)
            {
            case 31:
            {
                PieChart pieChart = new PieChart();
                pieChart.Width  = 400;
                pieChart.Height = 300;

                pieChart.LegendLocation = LegendLocation.Bottom;

                PieSeries pieSeries = new PieSeries();
                pieSeries.Values = new ChartValues <int> {
                    5
                };
                pieSeries.Title      = "A";
                pieSeries.DataLabels = true;

                PieSeries pieSeries2 = new PieSeries();
                pieSeries2.Values = new ChartValues <int> {
                    3
                };
                pieSeries2.Title      = "B";
                pieSeries2.DataLabels = true;

                PieSeries pieSeries3 = new PieSeries();
                pieSeries3.Values = new ChartValues <int> {
                    6
                };
                pieSeries3.Title      = "C";
                pieSeries3.DataLabels = true;

                pieChart.Series.Add(pieSeries);
                pieChart.Series.Add(pieSeries2);
                pieChart.Series.Add(pieSeries3);
                pieChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(pieChart, 0);
                Canvas.SetLeft(pieChart, p.X - pieChart.DesiredSize.Width / 2);
                Canvas.SetTop(pieChart, p.Y - pieChart.DesiredSize.Height / 2);

                AddEvents(pieChart);
                DesignCanvas.Children.Add(pieChart);
            }

            break;

            case 32:
            {
                CartesianChart cartesianChart = new CartesianChart();
                cartesianChart.Width  = 400;
                cartesianChart.Height = 300;

                cartesianChart.LegendLocation = LegendLocation.Bottom;

                ColumnSeries columnSeries = new ColumnSeries();
                columnSeries.Values = new ChartValues <int> {
                    5
                };
                columnSeries.Title      = "A";
                columnSeries.DataLabels = true;

                ColumnSeries columnSeries2 = new ColumnSeries();
                columnSeries2.Values = new ChartValues <int> {
                    3
                };
                columnSeries2.Title      = "B";
                columnSeries2.DataLabels = true;

                ColumnSeries columnSeries3 = new ColumnSeries();
                columnSeries3.Values = new ChartValues <int> {
                    6
                };
                columnSeries3.Title      = "C";
                columnSeries3.DataLabels = true;

                cartesianChart.Series.Add(columnSeries);
                cartesianChart.Series.Add(columnSeries2);
                cartesianChart.Series.Add(columnSeries3);

                cartesianChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(cartesianChart, 0);
                Canvas.SetLeft(cartesianChart, p.X - cartesianChart.DesiredSize.Width / 2);
                Canvas.SetTop(cartesianChart, p.Y - cartesianChart.DesiredSize.Height / 2);

                AddEvents(cartesianChart);
                DesignCanvas.Children.Add(cartesianChart);
            }
            break;

            case 33:
            {
                CartesianChart cartesianChart = new CartesianChart();
                cartesianChart.Width  = 400;
                cartesianChart.Height = 300;

                cartesianChart.LegendLocation = LegendLocation.Bottom;

                StackedColumnSeries columnSeries = new StackedColumnSeries();
                columnSeries.Values = new ChartValues <int> {
                    5, 6, 5
                };
                columnSeries.Title      = "A";
                columnSeries.DataLabels = true;

                StackedColumnSeries columnSeries2 = new StackedColumnSeries();
                columnSeries2.Values = new ChartValues <int> {
                    3, 4, 2
                };
                columnSeries2.Title      = "B";
                columnSeries2.DataLabels = true;

                StackedColumnSeries columnSeries3 = new StackedColumnSeries();
                columnSeries3.Values = new ChartValues <int> {
                    6, 3, 3
                };
                columnSeries3.Title      = "C";
                columnSeries3.DataLabels = true;

                cartesianChart.Series.Add(columnSeries);
                cartesianChart.Series.Add(columnSeries2);
                cartesianChart.Series.Add(columnSeries3);

                cartesianChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(cartesianChart, 0);
                Canvas.SetLeft(cartesianChart, p.X - cartesianChart.DesiredSize.Width / 2);
                Canvas.SetTop(cartesianChart, p.Y - cartesianChart.DesiredSize.Height / 2);

                AddEvents(cartesianChart);
                DesignCanvas.Children.Add(cartesianChart);
            }
            break;

            case 34:
            {
                CartesianChart cartesianChart = new CartesianChart();
                cartesianChart.Width  = 400;
                cartesianChart.Height = 300;

                cartesianChart.LegendLocation = LegendLocation.Bottom;

                RowSeries CarSeries = new RowSeries();
                CarSeries.Values = new ChartValues <int> {
                    5
                };
                CarSeries.Title      = "A";
                CarSeries.DataLabels = true;

                RowSeries CarSeries2 = new RowSeries();
                CarSeries2.Values = new ChartValues <int> {
                    3
                };
                CarSeries2.Title      = "B";
                CarSeries2.DataLabels = true;

                RowSeries CarSeries3 = new RowSeries();
                CarSeries3.Values = new ChartValues <int> {
                    6
                };
                CarSeries3.Title      = "C";
                CarSeries3.DataLabels = true;

                cartesianChart.Series.Add(CarSeries);
                cartesianChart.Series.Add(CarSeries2);
                cartesianChart.Series.Add(CarSeries3);

                cartesianChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(cartesianChart, 0);
                Canvas.SetLeft(cartesianChart, p.X - cartesianChart.DesiredSize.Width / 2);
                Canvas.SetTop(cartesianChart, p.Y - cartesianChart.DesiredSize.Height / 2);

                AddEvents(cartesianChart);
                DesignCanvas.Children.Add(cartesianChart);
            }
            break;

            case 35:
            {
                CartesianChart cartesianChart = new CartesianChart();
                cartesianChart.Width  = 400;
                cartesianChart.Height = 300;

                cartesianChart.LegendLocation = LegendLocation.Bottom;

                StackedRowSeries columnSeries = new StackedRowSeries();
                columnSeries.Values = new ChartValues <int> {
                    5, 6, 5
                };
                columnSeries.Title      = "A";
                columnSeries.DataLabels = true;

                StackedRowSeries columnSeries2 = new StackedRowSeries();
                columnSeries2.Values = new ChartValues <int> {
                    3, 4, 2
                };
                columnSeries2.Title      = "B";
                columnSeries2.DataLabels = true;

                StackedRowSeries columnSeries3 = new StackedRowSeries();
                columnSeries3.Values = new ChartValues <int> {
                    6, 3, 3
                };
                columnSeries3.Title      = "C";
                columnSeries3.DataLabels = true;

                cartesianChart.Series.Add(columnSeries);
                cartesianChart.Series.Add(columnSeries2);
                cartesianChart.Series.Add(columnSeries3);

                cartesianChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(cartesianChart, 0);
                Canvas.SetLeft(cartesianChart, p.X - cartesianChart.DesiredSize.Width / 2);
                Canvas.SetTop(cartesianChart, p.Y - cartesianChart.DesiredSize.Height / 2);

                AddEvents(cartesianChart);
                DesignCanvas.Children.Add(cartesianChart);
            }
            break;

            case 36:
            {
                CartesianChart lineChart = new CartesianChart();
                lineChart.Width  = 400;
                lineChart.Height = 300;

                lineChart.LegendLocation = LegendLocation.Bottom;

                LineSeries lineSeries = new LineSeries();
                lineSeries.Values = new ChartValues <int> {
                    5, 6, 8
                };
                lineSeries.Title      = "A";
                lineSeries.DataLabels = true;

                LineSeries lineSeries2 = new LineSeries();
                lineSeries2.Values = new ChartValues <int> {
                    3, 2, 5
                };
                lineSeries2.Title      = "B";
                lineSeries2.DataLabels = true;

                LineSeries lineSeries3 = new LineSeries();
                lineSeries3.Values = new ChartValues <int> {
                    6, 5, 3
                };
                lineSeries3.Title      = "C";
                lineSeries3.DataLabels = true;

                lineChart.Series.Add(lineSeries);
                lineChart.Series.Add(lineSeries2);
                lineChart.Series.Add(lineSeries3);

                lineChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(lineChart, 0);
                Canvas.SetLeft(lineChart, p.X - lineChart.DesiredSize.Width / 2);
                Canvas.SetTop(lineChart, p.Y - lineChart.DesiredSize.Height / 2);

                AddEvents(lineChart);
                DesignCanvas.Children.Add(lineChart);
            }
            break;

            case 37:
            {
                CartesianChart cartesianChart = new CartesianChart();
                cartesianChart.Width  = 400;
                cartesianChart.Height = 300;

                cartesianChart.LegendLocation = LegendLocation.Bottom;

                StackedAreaSeries columnSeries = new StackedAreaSeries();
                columnSeries.Values = new ChartValues <int> {
                    2, 4, 6
                };
                columnSeries.Title      = "A";
                columnSeries.DataLabels = true;

                StackedAreaSeries columnSeries2 = new StackedAreaSeries();
                columnSeries2.Values = new ChartValues <int> {
                    3, 5, 7
                };
                columnSeries2.Title      = "B";
                columnSeries2.DataLabels = true;

                StackedAreaSeries columnSeries3 = new StackedAreaSeries();
                columnSeries3.Values = new ChartValues <int> {
                    4, 6, 8
                };
                columnSeries3.Title      = "C";
                columnSeries3.DataLabels = true;

                cartesianChart.Series.Add(columnSeries);
                cartesianChart.Series.Add(columnSeries2);
                cartesianChart.Series.Add(columnSeries3);

                cartesianChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(cartesianChart, 0);
                Canvas.SetLeft(cartesianChart, p.X - cartesianChart.DesiredSize.Width / 2);
                Canvas.SetTop(cartesianChart, p.Y - cartesianChart.DesiredSize.Height / 2);

                AddEvents(cartesianChart);
                DesignCanvas.Children.Add(cartesianChart);
            }
            break;

            case 38:
            {
                CartesianChart cartesianChart = new CartesianChart();
                cartesianChart.Width  = 400;
                cartesianChart.Height = 300;

                cartesianChart.LegendLocation = LegendLocation.Bottom;

                StepLineSeries columnSeries = new StepLineSeries();
                columnSeries.Values = new ChartValues <int> {
                    1, 2, 1
                };
                columnSeries.Title      = "A";
                columnSeries.DataLabels = true;

                StepLineSeries columnSeries2 = new StepLineSeries();
                columnSeries2.Values = new ChartValues <int> {
                    3, 5, 6
                };
                columnSeries2.Title      = "B";
                columnSeries2.DataLabels = true;

                StepLineSeries columnSeries3 = new StepLineSeries();
                columnSeries3.Values = new ChartValues <int> {
                    6, 7, 7
                };
                columnSeries3.Title      = "C";
                columnSeries3.DataLabels = true;

                cartesianChart.Series.Add(columnSeries);
                cartesianChart.Series.Add(columnSeries2);
                cartesianChart.Series.Add(columnSeries3);

                cartesianChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(cartesianChart, 0);
                Canvas.SetLeft(cartesianChart, p.X - cartesianChart.DesiredSize.Width / 2);
                Canvas.SetTop(cartesianChart, p.Y - cartesianChart.DesiredSize.Height / 2);

                AddEvents(cartesianChart);
                DesignCanvas.Children.Add(cartesianChart);
            }
            break;
            }
        }
예제 #40
0
        public override View GetSampleContent(Context context)
        {
            chart            = new SfChart(context);
            chart.Title.Text = "Product Sale 2016";
            chart.SetBackgroundColor(Color.White);

            var primaryAxis = new CategoryAxis {
                LabelPlacement = LabelPlacement.BetweenTicks
            };

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

            var secondaryAxis = new NumericalAxis();

            primaryAxis.ShowMajorGridLines       = false;
            secondaryAxis.Title.Text             = "Sales";
            secondaryAxis.LabelStyle.LabelFormat = "$##.##";
            chart.SecondaryAxis = secondaryAxis;

            columnSeries = new ColumnSeries
            {
                ItemsSource               = MainPage.GetSelectionData(),
                XBindingPath              = "XValue",
                YBindingPath              = "YValue",
                Color                     = Color.ParseColor("#00BDAE"),
                SelectedDataPointColor    = Color.ParseColor("#007168"),
                DataPointSelectionEnabled = true,
                EnableAnimation           = true,
                Label                     = "Product A"
            };

            chart.Series.Add(columnSeries);

            columnSeries1 = new ColumnSeries
            {
                ItemsSource               = MainPage.GetSelectionData1(),
                XBindingPath              = "XValue",
                YBindingPath              = "YValue",
                Color                     = Color.ParseColor("#7F84E8"),
                SelectedDataPointColor    = Color.ParseColor("#4A4FB2"),
                DataPointSelectionEnabled = true,
                EnableAnimation           = true,
                Label                     = "Product B"
            };

            chart.Series.Add(columnSeries1);

            datapoint  = columnSeries.ItemsSource as IList <DataPoint>;
            datapoint1 = columnSeries1.ItemsSource as IList <DataPoint>;

            foreach (var data in datapoint)
            {
                sumOfTotalSeries1 += data.YValue;
            }

            foreach (var data in datapoint1)
            {
                sumOfTotalSeries2 += data.YValue;
            }

            chart.Behaviors.Add(new ChartSelectionBehavior());
            chart.SelectionChanged += chart_SelectionChanged;

            label = new TextView(context)
            {
                TextSize = 15
            };
            label.Text = "Tap on a bar segment to select a data point.";
            label.SetPadding(5, 5, 5, 5);

            productLabel1 = new TextView(context)
            {
                TextSize = 15, Visibility = ViewStates.Gone,
            };
            productLabel1.SetTextColor(Color.ParseColor("#007168"));
            productLabel1.SetPadding(5, 5, 5, 5);

            productLabel2 = new TextView(context)
            {
                TextSize = 15, Visibility = ViewStates.Gone,
            };
            productLabel2.SetTextColor(Color.ParseColor("#4A4FB2"));
            productLabel2.SetPadding(5, 5, 5, 5);

            var layout = new LinearLayout(context)
            {
                Orientation = Android.Widget.Orientation.Vertical
            };

            var layoutLabel = new LinearLayout(context)
            {
                Orientation      = Android.Widget.Orientation.Horizontal,
                LayoutParameters =
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };

            layoutLabel.SetHorizontalGravity(GravityFlags.CenterHorizontal);
            layoutLabel.AddView(label);
            layoutLabel.AddView(productLabel1);
            layoutLabel.AddView(productLabel2);
            layout.AddView(layoutLabel);
            layout.AddView(chart);

            return(layout);
        }
예제 #41
0
        public void ViewChart()
        {
            var chart = new Chart()
            {
                Name            = "ColSerias",
                BorderThickness = new Thickness(0.0),

                LegendTitle = rm.GetString("ChartTitle", Culture) + " " + ChartTitle, //Привязка к заголовку легенды
                Background  = Brushes.GhostWhite,
                Width       = WidthOfChart,                                           //Привязка к ширине гистограммы
                Height      = 530,
                Padding     = new Thickness(0.0)
            };

            chart.PlotAreaStyle = new Style(typeof(Grid));
            chart.PlotAreaStyle.Setters.Add(new Setter(Grid.BackgroundProperty, Brushes.Transparent));


            chart.LegendStyle = new Style(typeof(Legend));
            chart.LegendStyle.Setters.Add(new Setter(Legend.MarginProperty, new Thickness(15.0, 0.0, 15.0, 0.0)));
            chart.LegendStyle.Setters.Add(new Setter(Legend.BorderBrushProperty, Brushes.Transparent));
            chart.LegendStyle.Setters.Add(new Setter(Legend.BackgroundProperty, Brushes.Transparent));


            chart.TitleStyle = new Style(typeof(Title));
            chart.TitleStyle.Setters.Add(new Setter(Title.FontSizeProperty, 22.0));
            chart.TitleStyle.Setters.Add(new Setter(Title.FontFamilyProperty, new FontFamily("Arial")));
            chart.TitleStyle.Setters.Add(new Setter(Title.FontStyleProperty, FontStyles.Italic));
            chart.TitleStyle.Setters.Add(new Setter(Title.MarginProperty, new Thickness(10.0, 0.0, 0.0, 5.0)));


            var ChartTemplate = new ControlTemplate(typeof(Chart));
            var context       = new ParserContext();

            context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
            context.XmlnsDictionary.Add("visualizationToolkit", "clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit");
            context.XmlnsDictionary.Add("chartPrimitive", "clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit");
            context.XmlnsDictionary.Add("chartingToolkit", "clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit");
            ChartTemplate = (ControlTemplate)XamlReader.Parse(
                "<ControlTemplate TargetType=\"chartingToolkit:Chart\">\n" +
                "<Border BorderBrush = \"{TemplateBinding BorderBrush}\" BorderThickness = \"{TemplateBinding BorderThickness}\"\n" +
                "Background = \"{TemplateBinding Background}\" Padding = \"{TemplateBinding Padding}\">\n" +
                "<Grid>\n" +
                "<Grid.RowDefinitions>\n" +
                "<RowDefinition Height = \"Auto\"/>\n" +
                "<RowDefinition Height = \"*\"/>\n" +
                "</Grid.RowDefinitions>\n" +
                "<visualizationToolkit:Legend " +
                "Name = \"Legend\" Grid.Row = \"0\" HorizontalAlignment = \"Left\" Style = \"{TemplateBinding LegendStyle}\"\n" +
                "Title = \"{TemplateBinding LegendTitle}\" TitleStyle = \"{TemplateBinding TitleStyle}\" Width = \"Auto\" Height = \"Auto\"/>\n" +
                "<chartPrimitive:EdgePanel " +
                "Name = \"ChartArea\" Margin = \"0,5\" Grid.Row = \"1\" Style = \"{TemplateBinding ChartAreaStyle}\">\n" +
                "<Grid Style = \"{TemplateBinding PlotAreaStyle}\" Panel.ZIndex = \"-1\"/>\n" +
                "<Border BorderBrush = \"#FF919191\" BorderThickness = \"0\" Panel.ZIndex = \"10\"/>\n" +
                "</chartPrimitive:EdgePanel>\n" +
                "</Grid>\n" +
                "</Border>\n" +
                "</ControlTemplate>", context);

            var chartStyle = new Style(typeof(Chart));

            chartStyle.Setters.Add(new Setter(Chart.TemplateProperty, ChartTemplate));
            chart.Style = chartStyle;


            var axisStyleX = new Style(typeof(AxisLabel));

            axisStyleX.Setters.Add(new Setter(AxisLabel.FontFamilyProperty, new FontFamily("Arial")));
            axisStyleX.Setters.Add(new Setter(AxisLabel.FontSizeProperty, 16.0));
            axisStyleX.Setters.Add(new Setter(AxisLabel.FontStyleProperty, FontStyles.Italic));
            axisStyleX.Setters.Add(new Setter(AxisLabel.MarginProperty, new Thickness(0.0, 5.0, 0.0, 5.0)));

            chart.Axes.Add(new CategoryAxis()
            {
                Orientation    = AxisOrientation.X,
                Title          = rm.GetString("ChartCellNumber", Culture),                                                                  //Привязка к заголовку оси X
                FontSize       = 22.0,
                FontStyle      = FontStyles.Italic,
                Margin         = new Thickness(0.0, 0.0, 0.0, 5.0),
                AxisLabelStyle = axisStyleX
            });

            var legendItemTemplate = new ControlTemplate(typeof(LegendItem));

            context = new ParserContext();
            context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
            context.XmlnsDictionary.Add("visualizationToolkit", "clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit");
            context.XmlnsDictionary.Add("chartingToolkit", "clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit");
            legendItemTemplate = (ControlTemplate)XamlReader.Parse(
                "<ControlTemplate TargetType=\"chartingToolkit:LegendItem\">\n" +
                "<Border>\n" +
                "<StackPanel>\n" +
                "<StackPanel Orientation = \"Horizontal\">\n" +
                "<Rectangle Width = \"25\" Height = \"15\" Fill = \"{Binding Background}\" Stroke = \"Black\" StrokeThickness = \"1\"/>\n" +
                "<visualizationToolkit:Title " +
                "Content = \"{TemplateBinding Content}\" Margin = \"10,0,0,0\" " +
                "FontFamily = \"Arial\" FontSize = \"16\" FontStyle = \"Italic\"/>\n" +
                "</StackPanel>\n" +
                "</StackPanel>\n" +
                "</Border>\n" +
                "</ControlTemplate>", context);
            var LegendItemStyle = new Style(typeof(LegendItem));

            LegendItemStyle.Setters.Add(new Setter(LegendItem.TemplateProperty, legendItemTemplate));

            var ColSeriasR = new ColumnSeries()
            {
                Name                 = "Resistance",
                Title                = rm.GetString(legendParameterLabel[SelectedParameterIndex], Culture) + "(" + SelectedFrequency + rm.GetString("FrequencyUnit", Culture) + ")",                                                            //Отсутствует привязка к заголовку гистограммы R
                ItemsSource          = RVData,
                DependentValuePath   = "CellResistance",
                IndependentValuePath = "CellName",
                LegendItemStyle      = LegendItemStyle
            };

            var ColumnTemplateForR = new ControlTemplate(typeof(ColumnDataPoint));

            context = new ParserContext();
            context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
            context.XmlnsDictionary.Add("chartingToolkit", "clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit");
            ColumnTemplateForR = (ControlTemplate)XamlReader.Parse(
                "<ControlTemplate TargetType=\"chartingToolkit:ColumnDataPoint\">\n" +
                "<Grid Margin = \"0,0,-4,0\" Width = \"15\" HorizontalAlignment = \"Right\">\n" +
                "<Rectangle Fill = \"{TemplateBinding Background}\" Stroke = \"#FF727272\"/>\n" +
                "<TextBlock Text = \"{TemplateBinding FormattedDependentValue}\" HorizontalAlignment = \"Center\"\n" +
                "Foreground = \"Black\" Margin = \"-10,-20,-10,0\" FontFamily = \"Arial\" FontSize = \"14\"\n" +
                "FontStyle = \"Italic\" FontStretch = \"Normal\" LineStackingStrategy = \"MaxHeight\" VerticalAlignment = \"Top\"/>\n" +
                "</Grid>\n" +
                "</ControlTemplate>", context);

            var DrawningBrushR = (DrawingBrush)XamlReader.Parse(
                "<DrawingBrush xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'\n" +
                "TileMode=\"Tile\" Viewport=\"0,0,5,5\" Stretch=\"Fill\" Viewbox=\"0,0,1,1\" ViewportUnits=\"Absolute\">\n" +
                "<DrawingBrush.Transform>\n" +
                "<RotateTransform CenterX = \"0.5\" CenterY = \"0.5\" Angle = \"-45\"/>\n" +
                "</DrawingBrush.Transform>\n" +
                "<DrawingBrush.Drawing>\n" +
                "<DrawingGroup>\n" +
                "<GeometryDrawing>\n" +
                "<GeometryDrawing.Geometry>\n" +
                "<GeometryGroup>\n" +
                "<LineGeometry StartPoint = \"1,0\" EndPoint = \"1,1\"/>\n" +
                "</GeometryGroup>\n" +
                "</GeometryDrawing.Geometry>\n" +
                "<GeometryDrawing.Pen>\n" +
                "<Pen Thickness = \"1\" Brush = \"#FF4F9DFB\"/>\n" +
                "</GeometryDrawing.Pen>\n" +
                "</GeometryDrawing>\n" +
                "<GeometryDrawing>\n" +
                "<GeometryDrawing.Geometry>\n" +
                "<GeometryGroup>\n" +
                "<LineGeometry StartPoint = \"1,0\" EndPoint = \"1,1\"/>\n" +
                "</GeometryGroup>\n" +
                "</GeometryDrawing.Geometry>\n" +
                "<GeometryDrawing.Pen>\n" +
                "<Pen Thickness = \"6\" Brush = \"Transparent\"/>\n" +
                "</GeometryDrawing.Pen>\n" +
                "</GeometryDrawing>\n" +
                "</DrawingGroup>\n" +
                "</DrawingBrush.Drawing>\n" +
                "</DrawingBrush>");

            ColSeriasR.DataPointStyle = new Style(typeof(ColumnDataPoint));
            ColSeriasR.DataPointStyle.Setters.Add(new Setter(ColumnDataPoint.BackgroundProperty, DrawningBrushR));
            ColSeriasR.DataPointStyle.Setters.Add(new Setter(ColumnDataPoint.TemplateProperty, ColumnTemplateForR));

            ColSeriasR.DependentRangeAxis = new LinearAxis()
            {
                Orientation   = AxisOrientation.Y,
                Width         = 30,
                Minimum       = MinScaleR,
                Maximum       = MaxScaleR,
                Interval      = IntervalR,
                Location      = AxisLocation.Left,
                ShowGridLines = true,
                Visibility    = Visibility.Hidden
            };


            var ColSeriasV = new ColumnSeries()
            {
                Name                 = "Voltage",
                Title                = rm.GetString("ChartVoltage", Culture),                                                            //Привязка к заголовку гистограммы V
                ItemsSource          = RVData,
                DependentValuePath   = "CellVoltage",
                IndependentValuePath = "CellName",
                LegendItemStyle      = LegendItemStyle
            };

            var ColumnTemplateForV = new ControlTemplate(typeof(ColumnDataPoint));

            context = new ParserContext();
            context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
            context.XmlnsDictionary.Add("chartingToolkit", "clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit");
            ColumnTemplateForV = (ControlTemplate)XamlReader.Parse(
                "<ControlTemplate TargetType=\"chartingToolkit:ColumnDataPoint\">\n" +
                "<Grid Margin = \"-4,0,0,0\" Width = \"15\" HorizontalAlignment = \"Left\">\n" +
                "<Rectangle Fill = \"{TemplateBinding Background}\" Stroke = \"#FF727272\"/>\n" +
                "<TextBlock Text = \"{TemplateBinding FormattedDependentValue}\" HorizontalAlignment = \"Center\"\n" +
                "Foreground = \"Black\" Margin = \"-10,-20,-10,0\" FontFamily = \"Arial\" FontSize = \"14\"\n" +
                "FontStyle = \"Italic\"/>\n" +
                "</Grid>\n" +
                "</ControlTemplate>", context);

            var DrawningBrushV = (DrawingBrush)XamlReader.Parse(
                "<DrawingBrush xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' " +
                "TileMode=\"Tile\" Viewport=\"0,0,5,5\" Stretch=\"Fill\" Viewbox=\"0,0,1,1\" ViewportUnits=\"Absolute\">\n" +
                "<DrawingBrush.Transform>\n" +
                "<RotateTransform CenterX = \"0.5\" CenterY = \"0.5\" Angle = \"45\"/>\n" +
                "</DrawingBrush.Transform>\n" +
                "<DrawingBrush.Drawing>\n" +
                "<DrawingGroup>\n" +
                "<GeometryDrawing>\n" +
                "<GeometryDrawing.Geometry>\n" +
                "<GeometryGroup>\n" +
                "<LineGeometry StartPoint = \"0,0\" EndPoint = \"0,1\"/>\n" +
                "</GeometryGroup>\n" +
                "</GeometryDrawing.Geometry>\n" +
                "<GeometryDrawing.Pen>\n" +
                "<Pen Thickness = \"1\" Brush = \"#FFFF8C4A\"/>\n" +
                "</GeometryDrawing.Pen>\n" +
                "</GeometryDrawing>\n" +
                "<GeometryDrawing>\n" +
                "<GeometryDrawing.Geometry>\n" +
                "<GeometryGroup>\n" +
                "<LineGeometry StartPoint = \"1,0\" EndPoint = \"1,1\"/>\n" +
                "</GeometryGroup>\n" +
                "</GeometryDrawing.Geometry>\n" +
                "<GeometryDrawing.Pen>\n" +
                "<Pen Thickness = \"6\" Brush = \"Transparent\"/>\n" +
                "</GeometryDrawing.Pen>\n" +
                "</GeometryDrawing>\n" +
                "</DrawingGroup>\n" +
                "</DrawingBrush.Drawing>\n" +
                "</DrawingBrush>");

            ColSeriasV.DataPointStyle = new Style(typeof(ColumnDataPoint));
            ColSeriasV.DataPointStyle.Setters.Add(new Setter(ColumnDataPoint.BackgroundProperty, DrawningBrushV));
            ColSeriasV.DataPointStyle.Setters.Add(new Setter(ColumnDataPoint.TemplateProperty, ColumnTemplateForV));

            ColSeriasV.DependentRangeAxis = new LinearAxis()
            {
                Orientation   = AxisOrientation.Y,
                Width         = 30,
                Minimum       = MinScaleV,
                Maximum       = MaxScaleV,
                Interval      = IntervalV,
                Location      = AxisLocation.Right,
                ShowGridLines = false,
                Visibility    = Visibility.Hidden
            };


            var LegendItemStyleLine = new Style(typeof(LegendItem));

            LegendItemStyleLine.Setters.Add(new Setter(LegendItem.TemplateProperty, null));

            var LinSeries = new LineSeries()
            {
                Name                 = "LevelLine",
                ItemsSource          = LLPoint,
                DependentValuePath   = "PointY",
                IndependentValuePath = "PointX",
                Visibility           = LineLevelVisibility,          // Привязка к CheckBox
                LegendItemStyle      = LegendItemStyleLine
            };

            LinSeries.DataPointStyle = new Style(typeof(DataPoint));
            LinSeries.DataPointStyle.Setters.Add(new Setter(DataPoint.BackgroundProperty, Brushes.Red));
            LinSeries.DataPointStyle.Setters.Add(new Setter(DataPoint.TemplateProperty, null));

            LinSeries.DependentRangeAxis = new LinearAxis()
            {
                Orientation = AxisOrientation.Y,
                Minimum     = MinScaleR,
                Maximum     = MaxScaleR,
                Interval    = 0,
                Visibility  = Visibility.Hidden
            };

            chart.Series.Add(ColSeriasR);
            chart.Series.Add(ColSeriasV);
            chart.Series.Add(LinSeries);
            ColumnChart = chart;
        }