Esempio n. 1
0
        protected override void OnAttached()
        {
            this.UpdateGradientBarTemplates();

            TXFC.RadCartesianChart xfChart = (TXFC.RadCartesianChart) this.Element;
            xfChart.Series.CollectionChanged += this.Series_CollectionChanged;
        }
Esempio n. 2
0
        public BarSeriesHorizontal()
        {
            InitializeComponent();

            var model = new MainViewModel();

            model.Data1 = MainViewModel.GetCategoricalData();
            model.Data2 = MainViewModel.GetCategoricalData();

            var grid = new CartesianChartGrid();

            var chart = new Telerik.XamarinForms.Chart.RadCartesianChart
            {
                VerticalAxis   = new Telerik.XamarinForms.Chart.CategoricalAxis(),
                HorizontalAxis = new Telerik.XamarinForms.Chart.NumericalAxis(),
                HeightRequest  = 400,
                Grid           = grid,
            };

            grid.MajorLinesVisibility = GridLineVisibility.XY;
            grid.MajorXLineDashArray  = Device.OnPlatform(null, new double[] { 4, 2 }, new double[] { 4, 2 });
            grid.StripLinesVisibility = GridLineVisibility.X;

            grid.XStripeAlternativeColor = Color.FromHex("FFA9A9A9");
            grid.MajorLineColor          = Color.Green;
            grid.MajorLineThickness      = Device.OnPlatform(0.5, 2, 2);


            grid.MajorLinesVisibility = GridLineVisibility.XY;

            //grid.MajorYLineDashArray = new double[] { 10, 10 };
            //grid.MajorXLineDashArray = new double[] { 5, 15 };
            grid.StripLinesVisibility = GridLineVisibility.None;
            //grid.XStripeColor = Color.FromRgba(255, 0, 0, 50);
            //grid.XStripeAlternativeColor = Color.FromRgba(0, 255, 0, 50);

            //grid.YStripeColor = Color.FromRgba(255, 0, 0, 50);
            //grid.YStripeAlternativeColor = Color.FromRgba(0, 255, 0, 50);
            grid.MajorLineColor     = Color.Gray;
            grid.MajorLineThickness = 0.5;

            var series = new Telerik.XamarinForms.Chart.BarSeries();

            series.ItemsSource = model.Data1;

            series.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Value"
            };

            series.CategoryBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Category"
            };

            chart.Series.Add(series);


            this.Content = chart;
        }
        protected override void OnAttached()
        {
            this.UpdatePointMarkFills();

            TXFC.RadCartesianChart xfChart = (TXFC.RadCartesianChart) this.Element;
            xfChart.Series.CollectionChanged += this.Series_CollectionChanged;
        }
        public BarSeriesPage()
        {
            InitializeComponent();

            var model = new MainViewModel();

            model.Data1 = MainViewModel.GetCategoricalData();
            model.Data2 = MainViewModel.GetCategoricalData();

            var grid = new CartesianChartGrid();

            var chart = new Telerik.XamarinForms.Chart.RadCartesianChart
            {
                VerticalAxis = new Telerik.XamarinForms.Chart.NumericalAxis()
                {
                    LabelFitMode = AxisLabelFitMode.MultiLine,
                },
                HorizontalAxis = new Telerik.XamarinForms.Chart.CategoricalAxis()
                {
                    LabelFitMode = AxisLabelFitMode.MultiLine,
                },
                Grid = grid,
            };

            grid.MajorLinesVisibility = GridLineVisibility.Y;
            grid.MajorYLineDashArray  = Device.OnPlatform(null, new double[] { 4, 2 }, new double[] { 4, 2 });
            grid.StripLinesVisibility = GridLineVisibility.Y;

            grid.YStripeColor = Color.Transparent;

            grid.YStripeAlternativeColor = Color.FromHex("1FA9A9A9");
            grid.MajorLineColor          = Color.FromHex("D3D3D3");
            grid.MajorLineThickness      = Device.OnPlatform(0.5, 2, 2);

            var series = new Telerik.XamarinForms.Chart.BarSeries();

            series.ItemsSource = model.Data1;

            series.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Value"
            };

            series.CategoryBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Category"
            };


            //series.Stroke = Color.Gray;
            //series.StrokeThickness = 4;

            chart.Series.Add(series);

            this.Content = chart;
        }
        public PlotBandAnnotationsPage()
        {
            InitializeComponent();

            var model = new MainViewModel();
            var data  = MainViewModel.GetCategoricalData();

            model.Data1 = data;

            var startTreshold = data.Average(c => c.Value) * 0.9;
            var endTreshold   = data.Average(c => c.Value) * 1.1;


            var chart = new Telerik.XamarinForms.Chart.RadCartesianChart
            {
                HorizontalAxis = new Telerik.XamarinForms.Chart.CategoricalAxis()
                {
                    LabelFitMode = Telerik.XamarinForms.Chart.AxisLabelFitMode.MultiLine,
                    PlotMode     = Telerik.XamarinForms.Chart.AxisPlotMode.OnTicks
                },
                VerticalAxis  = new Telerik.XamarinForms.Chart.NumericalAxis(),
                HeightRequest = 400
            };


            var series = new Telerik.XamarinForms.Chart.AreaSeries();

            series.ItemsSource = model.Data1;

            series.ValueBinding = new PropertyNameDataPointBinding
            {
                PropertyName = "Value"
            };

            series.CategoryBinding = new PropertyNameDataPointBinding
            {
                PropertyName = "Category"
            };

            chart.Series.Add(series);

            var annotation = new CartesianPlotBandAnnotation()
            {
                Axis            = chart.VerticalAxis,
                From            = startTreshold,
                To              = endTreshold,
                Stroke          = Color.Green,
                Fill            = Color.FromHex("2F66FF33"),
                StrokeThickness = 2
            };

            chart.Annotations.Add(annotation);

            this.Content = chart;
        }
        public ChartGridLinesPage()
        {
            InitializeComponent();

            var model = new MainViewModel();
            model.Data1 = MainViewModel.GetCategoricalData();
            model.Data2 = MainViewModel.GetCategoricalData();

            var grid = new CartesianChartGrid();

            var chart = new Telerik.XamarinForms.Chart.RadCartesianChart
            {
                HorizontalAxis = new Telerik.XamarinForms.Chart.CategoricalAxis() 
                {
                    LabelFitMode = AxisLabelFitMode.MultiLine
                },
                VerticalAxis = new Telerik.XamarinForms.Chart.NumericalAxis(),
                HeightRequest = 400,
                Grid = grid,
            };

            chart.HorizontalAxis.LabelFitMode = AxisLabelFitMode.MultiLine;
            grid.MajorLinesVisibility = GridLineVisibility.XY;

            //grid.MajorYLineDashArray = new double[] { 10, 10 };
            //grid.MajorXLineDashArray = new double[] { 5, 15 };
            grid.StripLinesVisibility = GridLineVisibility.None;
            //grid.XStripeColor = Color.FromRgba(255, 0, 0, 50);
            //grid.XStripeAlternativeColor = Color.FromRgba(0, 255, 0, 50);

            //grid.YStripeColor = Color.FromRgba(255, 0, 0, 50);
            //grid.YStripeAlternativeColor = Color.FromRgba(0, 255, 0, 50);
            grid.MajorLineColor = Color.Gray;
            grid.MajorLineThickness = 1;

            var series = new Telerik.XamarinForms.Chart.BarSeries();

            series.ItemsSource = model.Data1;

            series.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Value"
            };

            series.CategoryBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Category"
            };

            chart.Series.Add(series);


            this.Content = chart;
        }
Esempio n. 7
0
        private void UpdateGradientBarRenderers()
        {
            TXFC.RadCartesianChart xfChart     = (TXFC.RadCartesianChart) this.Element;
            RadCartesianChartView  nativeChart = (RadCartesianChartView)this.Control;

            for (int i = 0; i < nativeChart.Series.Size(); i++)
            {
                BarSeries barSeries = nativeChart.Series.Get(i) as BarSeries;
                if (barSeries != null)
                {
                    this.TrySetGradientBarRenderer(barSeries, xfChart.Series[i]);
                }
            }
        }
Esempio n. 8
0
        private void UpdateGradientBarTemplates()
        {
            TXFC.RadCartesianChart xfChart     = (TXFC.RadCartesianChart) this.Element;
            RadCartesianChart      nativeChart = (RadCartesianChart)this.Control;

            for (int i = 0; i < nativeChart.Series.Count; i++)
            {
                BarSeries barSeries = nativeChart.Series[i] as BarSeries;
                if (barSeries != null)
                {
                    this.TrySetGradientBarTemplate(barSeries, xfChart.Series[i]);
                }
            }
        }
Esempio n. 9
0
        private void UpdatePointMarkTemplates()
        {
            TXFC.RadCartesianChart xfChart     = (TXFC.RadCartesianChart) this.Element;
            RadCartesianChart      nativeChart = (RadCartesianChart)this.Control;

            for (int i = 0; i < nativeChart.Series.Count; i++)
            {
                LineSeries lineSeries = nativeChart.Series[i] as LineSeries;
                if (lineSeries != null)
                {
                    this.TrySetPointMarkTemplate(lineSeries, xfChart.Series[i]);
                }
            }
        }
        private void UpdateGradientBarFills()
        {
            TXFC.RadCartesianChart xfChart     = (TXFC.RadCartesianChart) this.Element;
            TKExtendedChart        nativeChart = (TKExtendedChart)this.Control;

            for (int i = 0; i < nativeChart.Series.Length; i++)
            {
                TKChartColumnSeries columnSeries = nativeChart.Series[i] as TKChartColumnSeries;
                if (columnSeries != null)
                {
                    this.TrySetGradientBarFill(columnSeries, xfChart.Series[i]);
                }
            }
        }
Esempio n. 11
0
        private void UpdatePointMarkRenderers()
        {
            TXFC.RadCartesianChart xfChart     = (TXFC.RadCartesianChart) this.Element;
            RadCartesianChartView  nativeChart = (RadCartesianChartView)this.Control;

            for (int i = 0; i < nativeChart.Series.Size(); i++)
            {
                LineSeries lineSeries = nativeChart.Series.Get(i) as LineSeries;
                if (lineSeries != null)
                {
                    this.TrySetPointMarkRenderer(lineSeries, xfChart.Series[i]);
                }
            }
        }
        private void UpdatePointMarkFills()
        {
            TXFC.RadCartesianChart xfChart     = (TXFC.RadCartesianChart) this.Element;
            TKExtendedChart        nativeChart = (TKExtendedChart)this.Control;

            for (int i = 0; i < nativeChart.Series.Length; i++)
            {
                TKChartLineSeries lineSeries = nativeChart.Series[i] as TKChartLineSeries;
                if (lineSeries != null)
                {
                    this.TrySetPointMarkFill(lineSeries, xfChart.Series[i]);
                }
            }
        }
Esempio n. 13
0
        public AreaSeriesPage()
        {
            InitializeComponent();

            var grid = new CartesianChartGrid();

            var model = new MainViewModel();
            model.Data1 = MainViewModel.GetCategoricalData();
            model.Data2 = MainViewModel.GetCategoricalData();

            var chart = new Telerik.XamarinForms.Chart.RadCartesianChart
            {
                HorizontalAxis = new Telerik.XamarinForms.Chart.CategoricalAxis()
                {
                    LabelFitMode = Telerik.XamarinForms.Chart.AxisLabelFitMode.MultiLine,
                    PlotMode = Telerik.XamarinForms.Chart.AxisPlotMode.OnTicks
                },
                VerticalAxis = new Telerik.XamarinForms.Chart.NumericalAxis(),
                Grid = grid,
            };

            grid.MajorLinesVisibility = GridLineVisibility.Y;
            grid.MajorYLineDashArray = Device.OnPlatform(null, new double[] { 4, 2 }, new double[] { 4, 2 });


            grid.MajorLineColor = Color.FromHex("D3D3D3");
            grid.MajorLineThickness = Device.OnPlatform(0.5, 2, 2);

            var series = new Telerik.XamarinForms.Chart.AreaSeries();

            series.ItemsSource = model.Data1;

            series.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Value"
            };

            series.CategoryBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Category"
            };

            chart.Series.Add(series);


            this.Content = chart;


        }
        public ScatterAreaSeriesPage()
        {
            InitializeComponent();

            var model = new MainViewModel();

            model.Data1 = MainViewModel.GetNumericData2(20, 30, 3, (i) => 60 * i + 450, (i) => 20 * (Math.Sin(0.13 * i)) + 6);

            var grid = new CartesianChartGrid();

            var chart = new Telerik.XamarinForms.Chart.RadCartesianChart
            {
                VerticalAxis   = new Telerik.XamarinForms.Chart.NumericalAxis(),
                HorizontalAxis = new Telerik.XamarinForms.Chart.NumericalAxis()
                {
                    LabelFitMode = Telerik.XamarinForms.Chart.AxisLabelFitMode.MultiLine,
                },
                Grid = grid,
            };

            grid.MajorLinesVisibility = GridLineVisibility.Y;
            grid.MajorYLineDashArray  = Device.OnPlatform(null, new double[] { 4, 2 }, new double[] { 4, 2 });


            grid.MajorLineColor     = Color.FromHex("D3D3D3");
            grid.MajorLineThickness = Device.OnPlatform(0.5, 2, 2);


            var series = new Telerik.XamarinForms.Chart.ScatterAreaSeries();

            series.ItemsSource = model.Data1;

            series.XValueBinding = new PropertyNameDataPointBinding
            {
                PropertyName = "XData"
            };

            series.YValueBinding = new PropertyNameDataPointBinding
            {
                PropertyName = "YData"
            };

            chart.Series.Add(series);

            this.Content = chart;
        }
        public StackBarHorizontal()
        {
            InitializeComponent();

            var model = new MainViewModel();

            model.Data1 = MainViewModel.GetCategoricalData();
            model.Data2 = MainViewModel.GetCategoricalData();

            var grid = new CartesianChartGrid();

            var chart = new Telerik.XamarinForms.Chart.RadCartesianChart
            {
                HorizontalAxis = new Telerik.XamarinForms.Chart.NumericalAxis(),
                VerticalAxis   = new Telerik.XamarinForms.Chart.CategoricalAxis(),
                Grid           = grid,
            };

            grid.MajorLinesVisibility = GridLineVisibility.X;
            grid.MajorXLineDashArray  = Device.OnPlatform(null, new double[] { 4, 2 }, new double[] { 4, 2 });
            grid.StripLinesVisibility = GridLineVisibility.X;

            grid.XStripeColor = Color.Transparent;

            grid.XStripeAlternativeColor = Color.FromHex("1FA9A9A9");
            grid.MajorLineColor          = Color.FromHex("D3D3D3");
            grid.MajorLineThickness      = Device.OnPlatform(0.5, 2, 2);


            var series = new Telerik.XamarinForms.Chart.BarSeries();

            series.CombineMode = Telerik.XamarinForms.Chart.ChartSeriesCombineMode.Stack;
            series.ItemsSource = model.Data1;

            series.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Value"
            };

            series.CategoryBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Category"
            };

            chart.Series.Add(series);

            var series2 = new Telerik.XamarinForms.Chart.BarSeries();

            series2.CombineMode = Telerik.XamarinForms.Chart.ChartSeriesCombineMode.Stack;
            series2.ItemsSource = model.Data2;

            series2.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Value"
            };

            series2.CategoryBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Category"
            };

            chart.Series.Add(series2);

            this.Content = chart;
        }
 protected override void OnDetached()
 {
     TXFC.RadCartesianChart xfChart = (TXFC.RadCartesianChart) this.Element;
     xfChart.Series.CollectionChanged -= this.Series_CollectionChanged;
 }
        public SelectionSeriesPage()
        {
            InitializeComponent();

            var model = new MainViewModel();

            model.Data1 = MainViewModel.GetCategoricalData();
            model.Data2 = MainViewModel.GetCategoricalData();

            var grid = new CartesianChartGrid();

            var chart = new Telerik.XamarinForms.Chart.RadCartesianChart
            {
                VerticalAxis   = new Telerik.XamarinForms.Chart.NumericalAxis(),
                HorizontalAxis = new Telerik.XamarinForms.Chart.CategoricalAxis()
                {
                    LabelFitMode = Telerik.XamarinForms.Chart.AxisLabelFitMode.MultiLine
                },
                Grid          = grid,
                HeightRequest = 400
            };

            grid.MajorLinesVisibility = GridLineVisibility.Y;
            grid.MajorYLineDashArray  = Device.OnPlatform(null, new double[] { 4, 2 }, new double[] { 4, 2 });
            grid.StripLinesVisibility = GridLineVisibility.Y;

            grid.YStripeColor = Color.Transparent;

            grid.YStripeAlternativeColor = Color.FromHex("1FA9A9A9");
            grid.MajorLineColor          = Color.FromHex("D3D3D3");
            grid.MajorLineThickness      = Device.OnPlatform(0.5, 2, 2);


            var series = new Telerik.XamarinForms.Chart.BarSeries();

            series.StackGroupKey = 1;
            series.CombineMode   = Telerik.XamarinForms.Chart.ChartSeriesCombineMode.Stack;
            series.ItemsSource   = model.Data1;

            series.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Value"
            };

            series.CategoryBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Category"
            };
            series.AllowSelect = true;

            chart.Series.Add(series);

            var series2 = new Telerik.XamarinForms.Chart.BarSeries();

            series2.StackGroupKey = 1;
            series2.CombineMode   = Telerik.XamarinForms.Chart.ChartSeriesCombineMode.Stack;
            series2.ItemsSource   = model.Data2;

            series2.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Value"
            };

            series2.CategoryBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Category"
            };
            series2.AllowSelect = true;

            chart.PaletteName          = PaletteNames.Light;
            chart.SelectionPaletteName = PaletteNames.LightSelected;

            chart.Series.Add(series2);
            beh = new Telerik.XamarinForms.Chart.ChartSelectionBehavior
            {
                DataPointSelectionMode = Telerik.XamarinForms.Chart.ChartSelectionMode.Single,
                SeriesSelectionMode    = ChartSelectionMode.None
            };
            chart.Behaviors.Add(beh);

            this.Content = chart;
        }
Esempio n. 18
0
        public TrackballSeriesPage()
        {
            InitializeComponent();

            var model = new MainViewModel();

            model.Data1 = MainViewModel.GetCategoricalData();
            model.Data2 = MainViewModel.GetCategoricalData2();

            var grid = new CartesianChartGrid();

            var chart = new Telerik.XamarinForms.Chart.RadCartesianChart
            {
                VerticalAxis   = new Telerik.XamarinForms.Chart.NumericalAxis(),
                HorizontalAxis = new Telerik.XamarinForms.Chart.CategoricalAxis()
                {
                    LabelFitMode = Telerik.XamarinForms.Chart.AxisLabelFitMode.MultiLine,
                    PlotMode     = Telerik.XamarinForms.Chart.AxisPlotMode.OnTicks
                },
                Grid = grid,
            };

            grid.MajorLinesVisibility = GridLineVisibility.XY;
            grid.MajorYLineDashArray  = Device.OnPlatform(null, new double[] { 4, 2 }, new double[] { 4, 2 });
            grid.MajorXLineDashArray  = Device.OnPlatform(null, new double[] { 4, 2 }, new double[] { 4, 2 });


            grid.MajorLineColor     = Color.FromHex("D3D3D3");
            grid.MajorLineThickness = Device.OnPlatform(0.5, 2, 2);


            var series = new Telerik.XamarinForms.Chart.LineSeries();

            series.DisplayName = "Sales 1";
            series.ItemsSource = model.Data1;

            series.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Value"
            };

            series.CategoryBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Category"
            };

            chart.Series.Add(series);

            var series1 = new Telerik.XamarinForms.Chart.LineSeries();

            series1.DisplayName = "Sales 2";
            series1.ItemsSource = model.Data2;

            series1.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Value"
            };

            series1.CategoryBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Category"
            };

            chart.Series.Add(series1);

            chart.Behaviors.Add(new Telerik.XamarinForms.Chart.ChartTrackBallBehavior
            {
                ShowIntersectionPoints = true,
                ShowTrackInfo          = true
            });

            this.Content = chart;
        }
Esempio n. 19
0
        public GridLineAnnotationsPage()
        {
            InitializeComponent();

            var model = new MainViewModel();
            var data  = MainViewModel.GetCategoricalData();

            model.Data1 = data;

            var treshold      = data.Average(c => c.Value);
            var startTreshold = treshold * 0.95;
            var endTreshold   = treshold * 1.05;


            var chart = new Telerik.XamarinForms.Chart.RadCartesianChart
            {
                HorizontalAxis = new Telerik.XamarinForms.Chart.CategoricalAxis()
                {
                    LabelFitMode = Telerik.XamarinForms.Chart.AxisLabelFitMode.MultiLine,
                },
                VerticalAxis  = new Telerik.XamarinForms.Chart.NumericalAxis(),
                HeightRequest = 400
            };


            var series = new Telerik.XamarinForms.Chart.BarSeries();

            series.ItemsSource = model.Data1;

            series.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Value"
            };

            series.CategoryBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding
            {
                PropertyName = "Category"
            };

            chart.Series.Add(series);

            var lineAnnotation = new CartesianGridLineAnnotation()
            {
                Axis            = chart.VerticalAxis,
                Value           = treshold,
                Stroke          = Color.FromHex("0E72F6"),
                StrokeThickness = Device.OnPlatform(0.5, 2, 2),
                DashArray       = new double[] { 4, 2 }
            };

            var bandAnnotation = new CartesianPlotBandAnnotation()
            {
                Axis            = chart.VerticalAxis,
                From            = startTreshold,
                To              = endTreshold,
                Fill            = Color.FromHex("33A9A9A9"),
                StrokeThickness = 2,
                Stroke          = Color.Transparent,
            };

            chart.Annotations.Add(lineAnnotation);
            chart.Annotations.Add(bandAnnotation);

            this.Content = chart;
        }