Exemple #1
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text     = "Average Temperature Analysis";
            chart.Title.TextSize = 15;

            CategoryAxis categoryAxis = new CategoryAxis();

            categoryAxis.Title.Text     = "Year";
            categoryAxis.LabelPlacement = LabelPlacement.BetweenTicks;
            chart.PrimaryAxis           = categoryAxis;

            var numericalAxis = new NumericalAxis();

            numericalAxis.Title.Text = "Temperature (Celsius)";
            numericalAxis.Minimum    = 0;
            numericalAxis.Maximum    = 100;
            numericalAxis.Interval   = 10;
            chart.SecondaryAxis      = numericalAxis;

            ColumnSeries columnSeries = new ColumnSeries();

            columnSeries.EnableAnimation         = true;
            columnSeries.ColorModel.ColorPalette = ChartColorPalette.Natural;
            columnSeries.ItemsSource             = MainPage.GetNumericalData();
            columnSeries.XBindingPath            = "XValue";
            columnSeries.YBindingPath            = "YValue";
            columnSeries.TooltipEnabled          = true;
            chart.Series.Add(columnSeries);
            return(chart);
        }
Exemple #2
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;

            chart.SetBackgroundColor(Color.White);
            chart.Legend.ToggleSeriesVisibility = true;

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

            categoryAxis.Title.Text = "Category Axis";

            chart.PrimaryAxis = categoryAxis;

            var numericalAxis = new NumericalAxis();

            numericalAxis.Title.Text = "Numerical Axis";
            chart.SecondaryAxis      = numericalAxis;

            chart.SecondaryAxis = numericalAxis;
            chart.Series        = new ChartSeriesCollection();

            chart.Series.Add(new ColumnSeries()
            {
                Label      = "Column Series",
                DataSource = MainPage.GetCategoryData()
            });
            return(chart);
        }
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.ToggleSeriesVisibility = true;

            var dateAxis = new DateTimeAxis
            {
                EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift,
                LabelRotationAngle = -45,
            };
            dateAxis.LabelStyle.LabelFormat = "MM/dd/yyyy";

            chart.PrimaryAxis = dateAxis;
            dateAxis.Title.Text = "DateTime Axis";

            var numericalAxis = new NumericalAxis();
            numericalAxis.Title.Text = "Numerical Axis";
            chart.SecondaryAxis = numericalAxis;

            chart.Series.Add(new ColumnSeries
            {
                Label = "Column Series",
                DataSource = MainPage.GetDateTimValue(),
            });

            return chart;
        }
Exemple #4
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;

            chart.SetBackgroundColor(Color.White);
            chart.Legend.ToggleSeriesVisibility = true;

            var dateAxis = new DateTimeAxis
            {
                EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift,
                LabelRotationAngle    = -45,
            };

            dateAxis.LabelStyle.LabelFormat = "MM/dd/yyyy";

            chart.PrimaryAxis   = dateAxis;
            dateAxis.Title.Text = "DateTime Axis";

            var numericalAxis = new NumericalAxis();

            numericalAxis.Title.Text = "Numerical Axis";
            chart.SecondaryAxis      = numericalAxis;

            chart.Series.Add(new ColumnSeries
            {
                Label      = "Column Series",
                DataSource = MainPage.GetDateTimValue(),
            });

            return(chart);
        }
        public override View GetSampleContent(Context context)
        {
            LoadData();

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

            var axis = new NumericalAxis {
                Minimum = -1.5, Maximum = 1.5
            };

            chart.SecondaryAxis            = axis;
            axis.LabelStyle.LabelsPosition = AxisElementPosition.Outside;
            axis.TickPosition = AxisElementPosition.Outside;

            var lineSeries = new FastLineSeries {
                DataSource = data
            };

            chart.Series.Add(lineSeries);

            UpdateData();

            AddSeries();

            return(chart);
        }
        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 {
                ItemsSource = data
            };

            columnSeries.ColorModel.ColorPalette = ChartColorPalette.Natural;
            columnSeries.XBindingPath            = "Date";
            columnSeries.YBindingPath            = "YValue";
            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);
        }
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;

            chart.SetBackgroundColor(Color.White);
            chart.Legend.ToggleSeriesVisibility = true;

            var xAxis = new NumericalAxis {
                Interval = 1
            };

            xAxis.Title.Text  = "X Axis";
            chart.PrimaryAxis = xAxis;

            var yAxis = new NumericalAxis();

            yAxis.Title.Text    = "Y Axis";
            chart.SecondaryAxis = yAxis;
            chart.Series.Clear();

            chart.Series.Add(new ColumnSeries()
            {
                Label      = "Column Series",
                DataSource = MainPage.GetNumericalData(),
            });
            return(chart);
        }
        public override View GetSampleContent(Context context)
        {
            chart            = new SfChart(context);
            chart.Title.Text = "Unemployment Rate";
            chart.SetBackgroundColor(Color.White);
            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;

            density = context.Resources.DisplayMetrics.Density;
            CategoryAxis categoryaxis = new CategoryAxis();

            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Minimum  = 0;
            numericalaxis.Maximum  = 100;
            numericalaxis.Interval = 50;
            chart.SecondaryAxis    = numericalaxis;

            barSeries = new BarSeries();
            barSeries.DataMarker.ShowLabel    = true;
            barSeries.DataMarkerLabelCreated += BarSeries_DataMarkerLabelCreated;
            barSeries.ItemsSource             = MainPage.GetDataMarkerData();
            barSeries.XBindingPath            = "XValue";
            barSeries.YBindingPath            = "YValue";
            chart.Series.Add(barSeries);
            barSeries.EnableAnimation = true;
            return(chart);
        }
Exemple #9
0
        SfChart UpdateChart(SfChart chart, Visibility axisVisibility)
        {
            DateTimeAxis dateTimeAxis = new DateTimeAxis();

            dateTimeAxis.Visibility             = axisVisibility;
            dateTimeAxis.LabelStyle.LabelFormat = "dd/MMM";
            dateTimeAxis.ShowMajorGridLines     = axisVisibility == Visibility.Visible ? true : false;
            chart.PrimaryAxis = dateTimeAxis;

            NumericalAxis numericalAxis = new NumericalAxis();

            numericalAxis.Visibility         = axisVisibility;
            numericalAxis.ShowMajorGridLines = axisVisibility == Visibility.Visible ? true : false;
            chart.SecondaryAxis = numericalAxis;

            chart.Series.Add(new SplineAreaSeries()
            {
                ItemsSource  = GetDateTimeValue(),
                XBindingPath = "Date",
                YBindingPath = "YValue",
                Alpha        = 0.5f,
                Color        = Color.ParseColor("#7ce6c7"),
                StrokeColor  = Color.ParseColor("#1cb2d5")
            });

            return(chart);
        }
Exemple #10
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text                    = "England vs West Indies";
            chart.Title.TextSize                = 15;
            chart.ColorModel.ColorPalette       = ChartColorPalette.Natural;
            chart.Legend.Visibility             = Visibility.Visible;
            chart.Legend.DockPosition           = ChartDock.Bottom;
            chart.Legend.IconHeight             = 14;
            chart.Legend.IconWidth              = 14;
            chart.Legend.ToggleSeriesVisibility = true;

            CategoryAxis categoryAxis = new CategoryAxis();

            categoryAxis.Title.Text     = "Death Overs";
            categoryAxis.LabelPlacement = LabelPlacement.BetweenTicks;
            categoryAxis.PlotOffset     = 2;
            categoryAxis.AxisLineOffset = 2;
            categoryAxis.Interval       = 1;
            chart.PrimaryAxis           = categoryAxis;

            var numericalAxis = new NumericalAxis();

            numericalAxis.Minimum  = 0;
            numericalAxis.Maximum  = 25;
            numericalAxis.Interval = 5;
            numericalAxis.MajorTickStyle.TickSize = 0;
            numericalAxis.LineStyle.StrokeWidth   = 0;
            chart.SecondaryAxis = numericalAxis;

            ColumnSeries columnSeries = new ColumnSeries();

            columnSeries.EnableAnimation      = true;
            columnSeries.ItemsSource          = MainPage.GetNumericalData();
            columnSeries.XBindingPath         = "XValue";
            columnSeries.YBindingPath         = "YValue";
            columnSeries.LegendIcon           = ChartLegendIcon.SeriesType;
            columnSeries.Label                = "England";
            columnSeries.DataMarker.ShowLabel = true;
            columnSeries.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Inner;
            columnSeries.TooltipEnabled = true;
            chart.Series.Add(columnSeries);

            ColumnSeries columnSeries1 = new ColumnSeries();

            columnSeries1.EnableAnimation      = true;
            columnSeries1.ItemsSource          = MainPage.GetNumericalData1();
            columnSeries1.XBindingPath         = "XValue";
            columnSeries1.YBindingPath         = "YValue";
            columnSeries1.LegendIcon           = ChartLegendIcon.SeriesType;
            columnSeries1.Label                = "West Indies";
            columnSeries1.DataMarker.ShowLabel = true;
            columnSeries1.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Inner;
            columnSeries1.TooltipEnabled = true;
            chart.Series.Add(columnSeries1);
            return(chart);
        }
        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);
        }
Exemple #12
0
        private void GetCurrencyDevationChart(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "1 USD to INR form 1977 to 2019";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.Visibility       = Visibility.Visible;
            chart.Legend.DockPosition     = ChartDock.Top;
            chart.Legend.IconHeight       = 14;
            chart.Legend.IconWidth        = 14;
            chart.Legend.Orientation      = ChartOrientation.Vertical;
            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.LineStyle.StrokeWidth   = 0;
            numericalaxis.MajorTickStyle.TickSize = 0;
            numericalaxis.Title.Text             = "Rupees against Dollars";
            numericalaxis.LabelStyle.LabelFormat = "₹##";
            chart.SecondaryAxis = numericalaxis;

            DateTimeAxis primaryAxis = new DateTimeAxis();

            primaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Center;
            primaryAxis.ShowMajorGridLines    = false;
            primaryAxis.Title.Text            = "Years";
            primaryAxis.ShowMinorGridLines    = false;
            primaryAxis.IntervalType          = DateTimeIntervalType.Years;
            primaryAxis.Interval = 5;
            chart.PrimaryAxis    = primaryAxis;

            splineSeries1 = new SplineSeries();
            splineSeries1.XBindingPath = "Date";
            splineSeries1.YBindingPath = "YValue";
            splineSeries1.ItemsSource  = MainPage.GetTrendlineDataSource1();
            splineSeries1.Label        = "Rupees";
            splineSeries1.LegendIcon   = ChartLegendIcon.SeriesType;

            splineSeries1.DataMarker.ShowMarker        = true;
            splineSeries1.DataMarker.ShowLabel         = false;
            splineSeries1.DataMarker.MarkerHeight      = 5;
            splineSeries1.DataMarker.MarkerWidth       = 5;
            splineSeries1.DataMarker.MarkerStrokeWidth = 2;
            splineSeries1.DataMarker.MarkerStrokeColor = Color.ParseColor("#00bdae");
            splineSeries1.Trendlines = new ChartTrendlineCollection();
            linearTrendline          = new ChartTrendline()
            {
                Type               = ChartTrendlineType.Linear,
                StrokeColor        = new Color(201, 23, 97),
                LegendIcon         = ChartLegendIcon.SeriesType,
                VisibilityOnLegend = Visibility.Visible,
                Label              = "Linear",
            };

            splineSeries1.Trendlines.Add(linearTrendline);

            chart.Series.Add(splineSeries1);
        }
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text = "Average temperature for the year 2014";
            chart.Title.SetPadding(0, 0, 0, 15);

            NumericalStripLine numericalStripLines1 = new NumericalStripLine();

            numericalStripLines1.Start               = 28;
            numericalStripLines1.Width               = 8;
            numericalStripLines1.Text                = "Low Temperature";
            numericalStripLines1.FillColor           = Color.ParseColor("#C8D16D");
            numericalStripLines1.LabelStyle.TextSize = 20;

            NumericalStripLine numericalStripLines2 = new NumericalStripLine();

            numericalStripLines2.Start               = 36;
            numericalStripLines2.Width               = 8;
            numericalStripLines2.Text                = "Average Temperature";
            numericalStripLines2.FillColor           = Color.ParseColor("#F4C762");
            numericalStripLines2.LabelStyle.TextSize = 20;

            NumericalStripLine numericalStripLines3 = new NumericalStripLine();

            numericalStripLines3.Start               = 44;
            numericalStripLines3.Width               = 8;
            numericalStripLines3.Text                = "High Temperature";
            numericalStripLines3.FillColor           = Color.ParseColor("#EF7878");
            numericalStripLines3.LabelStyle.TextSize = 20;

            NumericalAxis numericalAxis = new NumericalAxis()
            {
                Minimum = 28, Maximum = 52
            };

            numericalAxis.Title.Text = "Temperature in celsius";

            numericalAxis.StripLines.Add(numericalStripLines1);
            numericalAxis.StripLines.Add(numericalStripLines2);
            numericalAxis.StripLines.Add(numericalStripLines3);

            chart.PrimaryAxis = new CategoryAxis();
            (chart.PrimaryAxis as CategoryAxis).LabelPlacement = LabelPlacement.BetweenTicks;
            chart.PrimaryAxis.Title.Text = "Months";
            chart.SecondaryAxis          = numericalAxis;

            var areaSeries = new SplineSeries
            {
                StrokeWidth = 3,
                DataSource  = MainPage.GetStripLineData(),
                Color       = Color.ParseColor("#2F4F4F")
            };

            chart.Series.Add(areaSeries);
            return(chart);
        }
Exemple #14
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text     = "Climate Graph";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.DockPosition           = ChartDock.Bottom;
            chart.Legend.IconHeight             = 14;
            chart.Legend.IconWidth              = 14;
            chart.Legend.Visibility             = Visibility.Visible;
            chart.Legend.ToggleSeriesVisibility = true;
            chart.ColorModel.ColorPalette       = ChartColorPalette.Natural;

            CategoryAxis categoryaxis = new CategoryAxis();

            categoryaxis.LabelPlacement        = LabelPlacement.BetweenTicks;
            categoryaxis.Title.Text            = "Month";
            categoryaxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Minimum    = -5;
            numericalaxis.Maximum    = 35;
            numericalaxis.Interval   = 5;
            numericalaxis.Title.Text = "Temperature (celsius)";
            chart.SecondaryAxis      = numericalaxis;

            SplineSeries splineSeries1 = new SplineSeries();

            splineSeries1.ItemsSource           = MainPage.GetSplineData1();
            splineSeries1.XBindingPath          = "XValue";
            splineSeries1.YBindingPath          = "YValue";
            splineSeries1.Label                 = "London";
            splineSeries1.DataMarker.ShowMarker = true;
            splineSeries1.TooltipEnabled        = true;
            splineSeries1.StrokeWidth           = 3;

            SplineSeries splineSeries2 = new SplineSeries();

            splineSeries2.ItemsSource           = MainPage.GetSplineData2();
            splineSeries2.XBindingPath          = "XValue";
            splineSeries2.YBindingPath          = "YValue";
            splineSeries2.Label                 = "France";
            splineSeries2.DataMarker.ShowMarker = true;
            splineSeries2.TooltipEnabled        = true;
            splineSeries2.StrokeWidth           = 3;

            splineSeries1.EnableAnimation = true;
            splineSeries2.EnableAnimation = true;

            chart.Series.Add(splineSeries1);
            chart.Series.Add(splineSeries2);
            return(chart);
        }
Exemple #15
0
        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);
        }
Exemple #16
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Efficiency of oil fired power production";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);
            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;

            chart.Legend.Visibility             = Visibility.Visible;
            chart.Legend.DockPosition           = ChartDock.Bottom;
            chart.Legend.IconHeight             = 14;
            chart.Legend.IconWidth              = 14;
            chart.Legend.ToggleSeriesVisibility = true;

            CategoryAxis categoryaxis = new CategoryAxis();

            categoryaxis.LabelPlacement        = LabelPlacement.BetweenTicks;
            categoryaxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            categoryaxis.Title.Text            = "Year";
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Minimum    = 25;
            numericalaxis.Maximum    = 50;
            numericalaxis.Interval   = 5;
            numericalaxis.Title.Text = "Efficiency (%)";
            chart.SecondaryAxis      = numericalaxis;

            LineSeries lineSeries1 = new LineSeries();

            lineSeries1.ItemsSource           = MainPage.GetLineData1();
            lineSeries1.XBindingPath          = "XValue";
            lineSeries1.YBindingPath          = "YValue";
            lineSeries1.DataMarker.ShowMarker = true;
            lineSeries1.Label          = "India";
            lineSeries1.StrokeWidth    = 3;
            lineSeries1.TooltipEnabled = true;

            LineSeries lineSeries2 = new LineSeries();

            lineSeries2.ItemsSource           = MainPage.GetLineData2();
            lineSeries2.XBindingPath          = "XValue";
            lineSeries2.YBindingPath          = "YValue";
            lineSeries2.Label                 = "Germany";
            lineSeries2.DataMarker.ShowMarker = true;
            lineSeries2.StrokeWidth           = 3;
            lineSeries2.TooltipEnabled        = true;

            lineSeries1.EnableAnimation = true;
            lineSeries2.EnableAnimation = true;

            chart.Series.Add(lineSeries1);
            chart.Series.Add(lineSeries2);
            return(chart);
        }
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text = "Profit/loss percentage comparison";

            CategoryAxis primaryAxis = new CategoryAxis();

            primaryAxis.CrossesAt             = 0;
            primaryAxis.PlotOffset            = 7;
            primaryAxis.AxisLineOffset        = 7;
            primaryAxis.ShowMajorGridLines    = false;
            primaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            primaryAxis.Interval           = 2;
            primaryAxis.Name               = "XAxis";
            primaryAxis.CrossingAxisName   = "YAxis";
            primaryAxis.ShowMajorGridLines = false;
            chart.PrimaryAxis              = primaryAxis;

            NumericalAxis secondaryAxis = new NumericalAxis();

            secondaryAxis.ShowMajorGridLines    = false;
            secondaryAxis.Maximum               = -100;
            secondaryAxis.Minimum               = 100;
            secondaryAxis.Interval              = 20;
            secondaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            secondaryAxis.Name = "YAxis";
            secondaryAxis.ShowMajorGridLines = false;
            secondaryAxis.ShowMinorGridLines = false;
            secondaryAxis.CrossingAxisName   = "XAxis";

            secondaryAxis.LabelCreated += SecondaryAxis_LabelCreated;
            chart.SecondaryAxis         = secondaryAxis;

            ScatterSeries scatterSeries = new ScatterSeries()
            {
                Name           = "series1",
                ItemsSource    = Data.CrossingData(),
                XBindingPath   = "XValue",
                YBindingPath   = "YValue",
                ScatterWidth   = 15,
                ScatterHeight  = 15,
                TooltipEnabled = true,
            };

            scatterSeries.ColorModel.ColorPalette = ChartColorPalette.Natural;
            ChartZoomPanBehavior zoomPanBehavior = new ChartZoomPanBehavior();

            chart.Behaviors.Add(zoomPanBehavior);
            chart.Series.Add(scatterSeries);

            chart.SecondaryAxis.CrossesAt = 8;

            return(chart);
        }
Exemple #18
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Electricity-Production";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);
            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;

            chart.Legend.Visibility             = Visibility.Visible;
            chart.Legend.IconHeight             = 14;
            chart.Legend.IconWidth              = 14;
            chart.Legend.DockPosition           = ChartDock.Bottom;
            chart.Legend.ToggleSeriesVisibility = true;

            NumericalAxis categoryaxis = new NumericalAxis();

            categoryaxis.MajorTickStyle.TickSize = 8;
            categoryaxis.ShowMajorGridLines      = false;
            categoryaxis.Interval = 2;
            categoryaxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Title.Text                 = "Production (Billion as kWh)";
            numericalaxis.Minimum                    = 0;
            numericalaxis.Maximum                    = 600;
            numericalaxis.Interval                   = 100;
            numericalaxis.LabelStyle.LabelFormat     = "#'B'";
            numericalaxis.LineStyle.StrokeWidth      = 0;
            numericalaxis.MajorTickStyle.StrokeWidth = 0;
            chart.SecondaryAxis = numericalaxis;

            StepAreaSeries stepAreaSeries1 = new StepAreaSeries();

            stepAreaSeries1.ItemsSource     = MainPage.GetStepAreaData1();
            stepAreaSeries1.XBindingPath    = "XValue";
            stepAreaSeries1.YBindingPath    = "YValue";
            stepAreaSeries1.Label           = "Renewable";
            stepAreaSeries1.EnableAnimation = true;
            stepAreaSeries1.LegendIcon      = ChartLegendIcon.Rectangle;

            StepAreaSeries stepAreaSeries2 = new StepAreaSeries();

            stepAreaSeries2.ItemsSource     = MainPage.GetStepAreaData2();
            stepAreaSeries2.XBindingPath    = "XValue";
            stepAreaSeries2.YBindingPath    = "YValue";
            stepAreaSeries2.Label           = "Non-Renewable";
            stepAreaSeries2.EnableAnimation = true;
            stepAreaSeries2.LegendIcon      = ChartLegendIcon.Rectangle;

            chart.Series.Add(stepAreaSeries1);
            chart.Series.Add(stepAreaSeries2);

            return(chart);
        }
Exemple #19
0
        public override View GetSampleContent(Context context)
        {
            chart                               = new SfChart(context);
            chart.Title.Text                    = "Product Price Comparison";
            chart.Legend.Visibility             = Visibility.Visible;
            chart.Legend.DockPosition           = ChartDock.Bottom;
            chart.Legend.ToggleSeriesVisibility = true;

            chart.Legend.IconHeight       = 14;
            chart.Legend.IconWidth        = 14;
            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;
            chart.SetBackgroundColor(Color.White);

            CategoryAxis categoryaxis = new CategoryAxis();

            categoryaxis.EdgeLabelsDrawingMode   = EdgeLabelsDrawingMode.Shift;
            categoryaxis.ShowMajorGridLines      = false;
            categoryaxis.LabelStyle.MarginTop    = 10;
            categoryaxis.MajorTickStyle.TickSize = 10;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Minimum            = 5;
            numericalaxis.Maximum            = 55;
            numericalaxis.Interval           = 5;
            numericalaxis.ShowMajorGridLines = false;
            numericalaxis.ShowMinorGridLines = false;
            chart.SecondaryAxis = numericalaxis;

            SplineRangeAreaSeries series = new SplineRangeAreaSeries();

            series.EnableAnimation = true;
            series.ItemsSource     = MainPage.GetSplineRangeArea1();
            series.XBindingPath    = "XValue";
            series.High            = "High";
            series.Low             = "Low";
            series.Label           = "Product A";
            series.TooltipEnabled  = true;
            series.EnableAnimation = true;
            chart.Series.Add(series);

            SplineRangeAreaSeries series1 = new SplineRangeAreaSeries();

            series1.EnableAnimation = true;
            series1.ItemsSource     = MainPage.GetSplineRangeArea2();
            series1.XBindingPath    = "XValue";
            series1.High            = "High";
            series1.Low             = "Low";
            series1.Label           = "Product B";
            series1.TooltipEnabled  = true;
            series1.EnableAnimation = true;
            chart.Series.Add(series1);

            return(chart);
        }
Exemple #20
0
        public override View GetSampleContent(Context context)
        {
            chart = new SfChart(context);
            chart.Title.Text = "Olympic Medal Counts";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);

            chart.Legend.Visibility = Visibility.Visible;
            chart.Legend.ToggleSeriesVisibility = true;
            chart.Legend.DockPosition = ChartDock.Bottom;
			chart.Legend.IconHeight = 14;
			chart.Legend.IconWidth = 14;
            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;

            CategoryAxis categoryaxis = new CategoryAxis();
            categoryaxis.LabelPlacement = LabelPlacement.BetweenTicks;
            categoryaxis.Title.Text = "Countries";
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();
            numericalaxis.Minimum = 0;
            numericalaxis.Maximum = 80;
            numericalaxis.Interval = 20;
            numericalaxis.Title.Text = "Medals";
            chart.SecondaryAxis = numericalaxis;

            columnSeries1 = new ColumnSeries();
            columnSeries1.Label = "Gold";
			columnSeries1.ItemsSource = MainPage.GetColumnData1();
			columnSeries1.XBindingPath = "XValue";
			columnSeries1.YBindingPath = "YValue";
            columnSeries1.TooltipEnabled = true;
            columnSeries1.EnableAnimation = true;

			columnSeries2 = new ColumnSeries();
            columnSeries2.Label = "Silver";
			columnSeries2.ItemsSource = MainPage.GetColumnData2();
			columnSeries2.XBindingPath = "XValue";
			columnSeries2.YBindingPath = "YValue";
            columnSeries2.TooltipEnabled = true;
            columnSeries2.EnableAnimation = true;

			columnSeries3 = new ColumnSeries();
            columnSeries3.Label = "Bronze";
			columnSeries3.ItemsSource = MainPage.GetColumnData3();
			columnSeries3.XBindingPath = "XValue";
			columnSeries3.YBindingPath = "YValue";
            columnSeries3.TooltipEnabled = true;
            columnSeries3.EnableAnimation = true;
    
            chart.Series.Add(columnSeries1);
            chart.Series.Add(columnSeries2);
            chart.Series.Add(columnSeries3);

            return chart;
        }
Exemple #21
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Temperature Variation";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.Visibility             = Visibility.Visible;
            chart.Legend.DockPosition           = ChartDock.Bottom;
            chart.Legend.IconHeight             = 14;
            chart.Legend.IconWidth              = 14;
            chart.Legend.ToggleSeriesVisibility = true;
            chart.ColorModel.ColorPalette       = ChartColorPalette.Natural;

            CategoryAxis categoryaxis = new CategoryAxis();

            categoryaxis.ShowMajorGridLines = false;
            categoryaxis.LabelPlacement     = LabelPlacement.BetweenTicks;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Interval = 5;
            numericalaxis.LineStyle.StrokeWidth   = 0;
            numericalaxis.MajorTickStyle.TickSize = 0;
            numericalaxis.LabelStyle.LabelFormat  = "##.##" + (char)0x00B0 + "C";
            chart.SecondaryAxis = numericalaxis;

            RangeColumnSeries rangeColumnSeries = new RangeColumnSeries();

            rangeColumnSeries.EnableAnimation = true;
            rangeColumnSeries.ItemsSource     = MainPage.GetRangeColumnData1();
            rangeColumnSeries.XBindingPath    = "XValue";
            rangeColumnSeries.High            = "High";
            rangeColumnSeries.Low             = "Low";
            rangeColumnSeries.Label           = "India";
            rangeColumnSeries.LegendIcon      = ChartLegendIcon.SeriesType;

            RangeColumnSeries rangeColumnSeries1 = new RangeColumnSeries();

            rangeColumnSeries1.EnableAnimation = true;
            rangeColumnSeries1.ItemsSource     = MainPage.GetRangeColumnData2();
            rangeColumnSeries1.XBindingPath    = "XValue";
            rangeColumnSeries1.High            = "High";
            rangeColumnSeries1.Low             = "Low";
            rangeColumnSeries1.Label           = "Germany";
            rangeColumnSeries1.LegendIcon      = ChartLegendIcon.SeriesType;

            chart.Series.Add(rangeColumnSeries);
            chart.Series.Add(rangeColumnSeries1);
            rangeColumnSeries.TooltipEnabled  = true;
            rangeColumnSeries1.TooltipEnabled = true;

            rangeColumnSeries.EnableAnimation  = true;
            rangeColumnSeries1.EnableAnimation = true;
            return(chart);
        }
Exemple #22
0
        private void GetMeterDevationChart(Context context)
        {
            chart2                = new SfChart(context);
            chart2.Title.Text     = "Distance Measurement";
            chart2.Title.TextSize = 15;
            chart2.SetBackgroundColor(Color.White);
            chart2.Legend.Visibility       = Visibility.Visible;
            chart2.Legend.DockPosition     = ChartDock.Top;
            chart2.Legend.IconHeight       = 14;
            chart2.Legend.IconWidth        = 14;
            chart2.ColorModel.ColorPalette = ChartColorPalette.Natural;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.LineStyle.StrokeWidth   = 0;
            numericalaxis.MajorTickStyle.TickSize = 0;
            numericalaxis.Title.Text = "Meters";
            chart2.SecondaryAxis     = numericalaxis;

            NumericalAxis primaryAxis = new NumericalAxis();

            primaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Center;
            primaryAxis.ShowMajorGridLines    = false;
            primaryAxis.Title.Text            = "Seconds";
            primaryAxis.ShowMinorGridLines    = false;
            chart2.PrimaryAxis = primaryAxis;

            splineSeries2              = new SplineSeries();
            splineSeries2.ItemsSource  = MainPage.GetTrendlineDataSource2();
            splineSeries2.XBindingPath = "XValue";
            splineSeries2.YBindingPath = "YValue";
            splineSeries2.Label        = "Rupees";
            splineSeries2.LegendIcon   = ChartLegendIcon.SeriesType;

            splineSeries2.DataMarker.ShowMarker        = true;
            splineSeries2.DataMarker.ShowLabel         = false;
            splineSeries2.DataMarker.MarkerHeight      = 5;
            splineSeries2.DataMarker.MarkerWidth       = 5;
            splineSeries2.DataMarker.MarkerStrokeWidth = 2;
            splineSeries2.DataMarker.MarkerStrokeColor = Color.ParseColor("#00bdae");

            splineSeries2.Trendlines = new ChartTrendlineCollection();
            powerTrendline           = new ChartTrendline()
            {
                Type               = ChartTrendlineType.Power,
                StrokeColor        = new Color(201, 23, 97),
                LegendIcon         = ChartLegendIcon.SeriesType,
                VisibilityOnLegend = Visibility.Visible,
                Label              = "Power",
            };

            splineSeries2.Trendlines.Add(powerTrendline);
            chart2.Series.Add(splineSeries2);
        }
Exemple #23
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "UK Trade in Food Groups - 2015";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.Visibility             = Visibility.Visible;
            chart.Legend.DockPosition           = ChartDock.Bottom;
            chart.Legend.IconHeight             = 14;
            chart.Legend.IconWidth              = 14;
            chart.Legend.ToggleSeriesVisibility = true;
            chart.ColorModel.ColorPalette       = ChartColorPalette.Natural;

            CategoryAxis categoryaxis = new CategoryAxis();

            categoryaxis.Title.Text            = "Food";
            categoryaxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Visibility            = Visibility.Gone;
            numericalaxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            numericalaxis.ShowMajorGridLines    = false;
            chart.SecondaryAxis = numericalaxis;

            barseries                      = new BarSeries();
            barseries.ItemsSource          = MainPage.GetBarData1();
            barseries.XBindingPath         = "XValue";
            barseries.YBindingPath         = "YValue";
            barseries.Label                = "Imports";
            barseries.DataMarker.ShowLabel = true;
            barseries.DataMarker.LabelStyle.LabelFormat   = "#.#'B'";
            barseries.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Inner;
            barseries.EnableAnimation = true;
            barseries.LegendIcon      = ChartLegendIcon.SeriesType;

            barseries1                      = new BarSeries();
            barseries1.ItemsSource          = MainPage.GetBarData2();
            barseries1.XBindingPath         = "XValue";
            barseries1.YBindingPath         = "YValue";
            barseries1.Label                = "Exports";
            barseries1.DataMarker.ShowLabel = true;
            barseries1.DataMarker.LabelStyle.LabelFormat   = "#.#'B'";
            barseries1.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Inner;
            barseries1.EnableAnimation = true;
            barseries1.LegendIcon      = ChartLegendIcon.SeriesType;

            chart.Series.Add(barseries);
            chart.Series.Add(barseries1);

            return(chart);
        }
Exemple #24
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Unemployment Rate (%)";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.Visibility             = Visibility.Visible;
            chart.Legend.DockPosition           = ChartDock.Bottom;
            chart.Legend.IconHeight             = 14;
            chart.Legend.IconWidth              = 14;
            chart.Legend.ToggleSeriesVisibility = true;
            chart.ColorModel.ColorPalette       = ChartColorPalette.Natural;

            NumericalAxis categoryaxis = new NumericalAxis();

            categoryaxis.Minimum    = 2005;
            categoryaxis.Maximum    = 2012;
            categoryaxis.Interval   = 1;
            categoryaxis.Title.Text = "Years";
            chart.PrimaryAxis       = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Minimum = 3;
            numericalaxis.Maximum = 12;
            numericalaxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            numericalaxis.Interval   = 1;
            numericalaxis.Title.Text = "Percentage";
            chart.SecondaryAxis      = numericalaxis;

            barseries                      = new BarSeries();
            barseries.ItemsSource          = MainPage.GetBarData1();
            barseries.XBindingPath         = "XValue";
            barseries.YBindingPath         = "YValue";
            barseries.Label                = "India";
            barseries.DataMarker.ShowLabel = true;
            barseries.EnableAnimation      = true;

            barseries1                      = new BarSeries();
            barseries1.ItemsSource          = MainPage.GetBarData2();
            barseries1.XBindingPath         = "XValue";
            barseries1.YBindingPath         = "YValue";
            barseries1.Label                = "US";
            barseries1.DataMarker.ShowLabel = true;
            barseries1.EnableAnimation      = true;

            chart.Series.Add(barseries);
            chart.Series.Add(barseries1);

            return(chart);
        }
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context); ;
            chart.SetBackgroundColor(Color.White);
            chart.Title.Text = "Average temperature for the year 2014";
            chart.Title.SetPadding(0, 0, 0, 15);
            
            NumericalStripLine numericalStripLines1 = new NumericalStripLine();
            numericalStripLines1.Start = 28;
            numericalStripLines1.Width = 8;
            numericalStripLines1.Text = "Low Temperature";
            numericalStripLines1.FillColor = Color.ParseColor("#C8D16D");
            numericalStripLines1.LabelStyle.TextSize = 20;

            NumericalStripLine numericalStripLines2 = new NumericalStripLine();
            numericalStripLines2.Start = 36;
            numericalStripLines2.Width = 8;
            numericalStripLines2.Text = "Average Temperature";
            numericalStripLines2.FillColor = Color.ParseColor("#F4C762");
            numericalStripLines2.LabelStyle.TextSize = 20;

            NumericalStripLine numericalStripLines3 = new NumericalStripLine();
            numericalStripLines3.Start = 44;
            numericalStripLines3.Width = 8;
            numericalStripLines3.Text = "High Temperature";
            numericalStripLines3.FillColor = Color.ParseColor("#EF7878");
            numericalStripLines3.LabelStyle.TextSize = 20;

            NumericalAxis numericalAxis = new NumericalAxis() { Minimum = 28, Maximum = 52};
            numericalAxis.Title.Text = "Temperature in celsius";

            numericalAxis.StripLines.Add(numericalStripLines1);
            numericalAxis.StripLines.Add(numericalStripLines2);
            numericalAxis.StripLines.Add(numericalStripLines3);

            chart.PrimaryAxis = new CategoryAxis();
            (chart.PrimaryAxis as CategoryAxis).LabelPlacement = LabelPlacement.BetweenTicks;
            chart.PrimaryAxis.Title.Text = "Months";
            chart.SecondaryAxis = numericalAxis;

            var areaSeries = new SplineSeries
            {
                StrokeWidth = 3,
                DataSource = MainPage.GetStripLineData(),
                Color = Color.ParseColor("#2F4F4F")
            };

            chart.Series.Add(areaSeries);
            return chart;
        }
Exemple #26
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Sales Distribution of Car by Region";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);

            CategoryAxis primaryaxis = new CategoryAxis();

            primaryaxis.ShowMajorGridLines      = false;
            primaryaxis.AxisLineOffset          = 10;
            primaryaxis.PlotOffset              = 10;
            primaryaxis.MajorTickStyle.TickSize = 10;
            primaryaxis.LabelPlacement          = LabelPlacement.BetweenTicks;
            chart.PrimaryAxis = primaryaxis;

            NumericalAxis secondaryAxis = new NumericalAxis();

            secondaryAxis.Minimum  = 15;
            secondaryAxis.Maximum  = 45;
            secondaryAxis.Interval = 5;
            secondaryAxis.LabelStyle.LabelFormat  = "#'%'";
            secondaryAxis.LineStyle.StrokeWidth   = 0;
            secondaryAxis.MajorTickStyle.TickSize = 0;
            chart.SecondaryAxis = secondaryAxis;

            ScatterSeries scatterSeries = new ScatterSeries();

            scatterSeries.ItemsSource             = MainPage.GetErrorBarData();
            scatterSeries.XBindingPath            = "XValue";
            scatterSeries.YBindingPath            = "YValue";
            scatterSeries.ScatterHeight           = 20;
            scatterSeries.ScatterWidth            = 20;
            scatterSeries.ColorModel.ColorPalette = ChartColorPalette.Natural;
            scatterSeries.ShapeType = ChartScatterShapeType.Ellipse;
            chart.Series.Add(scatterSeries);

            errorBar                      = new ErrorBarSeries();
            errorBar.ItemsSource          = MainPage.GetErrorBarData();
            errorBar.XBindingPath         = "XVAlue";
            errorBar.YBindingPath         = "YValue";
            errorBar.HorizontalErrorPath  = "High";
            errorBar.VerticalErrorPath    = "Low";
            errorBar.HorizontalErrorValue = 3;
            errorBar.VerticalErrorValue   = 3;
            errorBar.Type                 = ErrorBarType.Fixed;
            errorBar.Mode                 = ErrorBarMode.Vertical;
            chart.Series.Add(errorBar);
            return(chart);
        }
Exemple #27
0
        public override View GetSampleContent(Context context)
        {
            chart = new SfChart(context);
            chart.Legend.Visibility             = Visibility.Visible;
            chart.Legend.DockPosition           = ChartDock.Bottom;
            chart.Legend.ToggleSeriesVisibility = true;
            chart.Legend.IconHeight             = 14;
            chart.Legend.IconWidth        = 14;
            chart.Title.Text              = "World Gold Price";
            chart.Title.TextSize          = 15;
            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;
            chart.SetBackgroundColor(Color.White);

            CategoryAxis categoryaxis = new CategoryAxis();

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

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Minimum    = 5;
            numericalaxis.Maximum    = 55;
            numericalaxis.Interval   = 5;
            numericalaxis.Title.Text = "Gold Price";
            chart.SecondaryAxis      = numericalaxis;

            RangeAreaSeries series = new RangeAreaSeries();

            series.ItemsSource     = MainPage.GetRangeArea1();
            series.XBindingPath    = "XValue";
            series.High            = "High";
            series.Low             = "Low";
            series.Label           = "India";
            series.TooltipEnabled  = true;
            series.EnableAnimation = true;
            chart.Series.Add(series);

            RangeAreaSeries series1 = new RangeAreaSeries();

            series1.ItemsSource     = MainPage.GetRangeArea();
            series1.XBindingPath    = "XValue";
            series1.High            = "High";
            series1.Low             = "Low";
            series1.Label           = "Germany";
            series1.TooltipEnabled  = true;
            series1.EnableAnimation = true;
            chart.Series.Add(series1);

            return(chart);
        }
Exemple #28
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.Title.Text     = "World Countries Details";
            chart.Title.TextSize = 15;

            NumericalAxis primaryAxis = new NumericalAxis();

            primaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            primaryAxis.Minimum            = 60;
            primaryAxis.Maximum            = 100;
            primaryAxis.Interval           = 5;
            primaryAxis.Title.Text         = "Literacy Rate";
            primaryAxis.ShowMajorGridLines = false;
            primaryAxis.ShowMinorGridLines = false;
            chart.PrimaryAxis = primaryAxis;

            NumericalAxis secondaryAxis = new NumericalAxis();

            secondaryAxis.Minimum            = 0;
            secondaryAxis.Maximum            = 10;
            secondaryAxis.Interval           = 2.5;
            secondaryAxis.Title.Text         = "GDP Growth Rate";
            secondaryAxis.ShowMajorGridLines = false;
            secondaryAxis.ShowMinorGridLines = false;
            chart.SecondaryAxis = secondaryAxis;

            var bubble = new BubbleSeries();

            bubble.MinimumRadius           = 5;
            bubble.MaximumRadius           = 40;
            bubble.Alpha                   = 0.7f;
            bubble.ColorModel.ColorPalette = ChartColorPalette.Natural;
            bubble.ItemsSource             = MainPage.GetBubbleData();
            bubble.XBindingPath            = "XValue";
            bubble.YBindingPath            = "YValue";
            bubble.Size            = "Size";
            bubble.EnableAnimation = true;
            chart.Series.Add(bubble);

            bubble.TooltipEnabled = true;

            tooltipBehavior = new BubbleTooltipBehavior(context);
            chart.Behaviors.Add(tooltipBehavior);

            chart.TooltipCreated += Chart_TooltipCreated;
            return(chart);
        }
        public override View GetSampleContent(Context context)
        {
            datas1 = new ObservableCollection <DataPoint>();

            sfChart = new SfChart(context);
            sfChart.ColorModel.ColorPalette = ChartColorPalette.Natural;

            sfChart.Title.Text     = "Seismograph analysis of a country";
            sfChart.Title.TextSize = 15;

            sfChart.Legend.Visibility             = Visibility.Visible;
            sfChart.Legend.ToggleSeriesVisibility = true;

            NumericalAxis primaryAxis = new NumericalAxis();

            primaryAxis.Title.Text         = "Time (s)";
            primaryAxis.ShowMajorGridLines = false;
            sfChart.PrimaryAxis            = primaryAxis;

            NumericalAxis numericalAxis = new NumericalAxis()
            {
                Minimum = -15,
                Maximum = 15,
            };

            numericalAxis.Title.Text         = "Velocity (m/s)";
            numericalAxis.ShowMajorGridLines = false;
            sfChart.SecondaryAxis            = numericalAxis;

            FastLineSeries fastLineSeries = new FastLineSeries();

            fastLineSeries.ItemsSource  = datas1;
            fastLineSeries.XBindingPath = "XValue";
            fastLineSeries.YBindingPath = "YValue";
            fastLineSeries.Label        = "Indonesia";
            fastLineSeries.Transposed   = true;
            sfChart.Series.Add(fastLineSeries);

            Random random = new Random();

            for (int i = 1; i < 50; i++)
            {
                datas1.Add(new DataPoint(i, random.Next(-3, 3)));
            }

            UpdateData();
            return(sfChart);
        }
       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;
        }
        private void GetMeterDevationChart(Context context)
        {
            meterDevitionChart                = new SfChart(context);
            meterDevitionChart.Title.Text     = "Distance Measurement";
            meterDevitionChart.Title.TextSize = 15;
            meterDevitionChart.SetBackgroundColor(Color.White);

            meterDevitionChart.ColorModel.ColorPalette = ChartColorPalette.Natural;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.LineStyle.StrokeWidth   = 0;
            numericalaxis.MajorTickStyle.TickSize = 0;
            numericalaxis.Title.Text         = "Meters";
            meterDevitionChart.SecondaryAxis = numericalaxis;

            NumericalAxis primaryAxis = new NumericalAxis();

            primaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Center;
            primaryAxis.ShowMajorGridLines    = false;
            primaryAxis.Title.Text            = "Seconds";
            primaryAxis.ShowMinorGridLines    = false;
            meterDevitionChart.PrimaryAxis    = primaryAxis;

            splineSeries2              = new ColumnSeries();
            splineSeries2.ItemsSource  = MainPage.GetPowerTrendlineDataSource();
            splineSeries2.XBindingPath = "XValue";
            splineSeries2.YBindingPath = "YValue";
            splineSeries2.Label        = "Rupees";
            splineSeries2.LegendIcon   = ChartLegendIcon.SeriesType;
            meterDevitionChart.Series.Add(splineSeries2);

            powerTrendline = new ChartTrendline()
            {
                Type               = ChartTrendlineType.Power,
                StrokeColor        = new Color(64, 64, 65),
                LegendIcon         = ChartLegendIcon.SeriesType,
                VisibilityOnLegend = Visibility.Visible,
                Label              = "Power",
            };

            splineSeries2.Trendlines = new ChartTrendlineCollection()
            {
                powerTrendline
            };
        }
        private void GetSalseDevationChart(Context context)
        {
            salesDeviationChart                = new SfChart(context);
            salesDeviationChart.Title.Text     = "Average Sales Comparison";
            salesDeviationChart.Title.TextSize = 15;
            salesDeviationChart.SetBackgroundColor(Color.White);
            salesDeviationChart.ColorModel.ColorPalette = ChartColorPalette.Natural;
            DateTimeAxis primaryAxis = new DateTimeAxis();

            primaryAxis.Title.Text                 = "Months";
            primaryAxis.ShowMinorGridLines         = false;
            primaryAxis.ShowMinorGridLines         = false;
            primaryAxis.IntervalType               = DateTimeIntervalType.Months;
            primaryAxis.Interval                   = 1;
            primaryAxis.MajorTickStyle.StrokeWidth = 0;
            primaryAxis.LabelStyle.LabelFormat     = "MMM";
            salesDeviationChart.PrimaryAxis        = primaryAxis;

            numericalaxis = new NumericalAxis();
            numericalaxis.LineStyle.StrokeWidth   = 0;
            numericalaxis.MajorTickStyle.TickSize = 0;
            numericalaxis.Title.Text            = "Number of Customer";
            numericalaxis.LineStyle.StrokeColor = Color.Transparent;
            salesDeviationChart.SecondaryAxis   = numericalaxis;

            salesColumnSeries = new ColumnSeries();
            salesColumnSeries.XBindingPath = "Date";
            salesColumnSeries.YBindingPath = "YValue";
            salesColumnSeries.ItemsSource  = MainPage.GetTrendlineDataSource("Linear");
            salesColumnSeries.Label        = "Sales";
            salesColumnSeries.LegendIcon   = ChartLegendIcon.SeriesType;
            salesDeviationChart.Series.Add(salesColumnSeries);

            linearTrendline = new ChartTrendline()
            {
                Type        = ChartTrendlineType.Linear,
                StrokeColor = new Color(64, 64, 65),
                Label       = "Linear",
            };

            salesColumnSeries.Trendlines = new ChartTrendlineCollection()
            {
                linearTrendline
            };
        }
       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;
        }
Exemple #34
0
        public override View GetSampleContent(Context context)
        {
            SfChart chart = new SfChart(context);

            chart.Title.Text     = "Examination Result";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);

            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;

            NumericalAxis categoryaxis = new NumericalAxis();

            categoryaxis.Title.Text            = "Score of Final Examination";
            categoryaxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            categoryaxis.ShowMajorGridLines    = false;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Title.Text              = "Number of Students";
            numericalaxis.ShowMajorGridLines      = true;
            numericalaxis.LineStyle.StrokeWidth   = 0;
            numericalaxis.MajorTickStyle.TickSize = 0;
            chart.SecondaryAxis = numericalaxis;

            HistogramSeries histogramSeries = new HistogramSeries();

            histogramSeries.ItemsSource          = MainPage.GetHistogramData();
            histogramSeries.XBindingPath         = "YValue";
            histogramSeries.YBindingPath         = "XValue";
            histogramSeries.Interval             = 20;
            histogramSeries.TooltipEnabled       = true;
            histogramSeries.EnableAnimation      = true;
            histogramSeries.StrokeColor          = Color.White;
            histogramSeries.StrokeWidth          = 1;
            histogramSeries.DataMarker.ShowLabel = true;
            histogramSeries.DataMarker.LabelStyle.LabelPosition   = DataMarkerLabelPosition.Inner;
            histogramSeries.DataMarker.LabelStyle.BackgroundColor = Color.Transparent;
            histogramSeries.DataMarker.LabelStyle.TextColor       = Color.White;

            chart.Series.Add(histogramSeries);

            return(chart);
        }
        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;
        }
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.ToggleSeriesVisibility = true;

            var xAxis = new NumericalAxis {Interval = 1};
            xAxis.Title.Text = "X Axis";
            chart.PrimaryAxis = xAxis;

            var yAxis = new NumericalAxis();
            yAxis.Title.Text = "Y Axis";
            chart.SecondaryAxis = yAxis;
            chart.Series.Clear();

            chart.Series.Add(new ColumnSeries()
            {
                Label = "Column Series",
                DataSource = MainPage.GetNumericalData(),
            });
            return chart;
        }
        public override View GetSampleContent(Context context)
        {
            LoadData();

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

            var axis = new NumericalAxis {Minimum = -1.5, Maximum = 1.5};
            chart.SecondaryAxis = axis;
            axis.LabelStyle.LabelsPosition = AxisElementPosition.Outside;
            axis.TickPosition = AxisElementPosition.Outside;

            var lineSeries = new FastLineSeries {DataSource = data};

            chart.Series.Add(lineSeries);

            UpdateData();

            AddSeries();

            return chart;
        }
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.ToggleSeriesVisibility = true;
            chart.Legend.Visibility = Visibility.Visible;

            var primary = new CategoryAxis();
            primary.Title.Text = "Years";
            primary.Title.TextColor = Color.Black;
            primary.LabelPlacement = LabelPlacement.BetweenTicks;
            chart.PrimaryAxis = primary;

            var secondaryAxis = new NumericalAxis()
            {
                Minimum = 6200,
                Maximum = 8800,
                Interval = 200,
                ShowMajorGridLines = false
            };

            secondaryAxis.Title.Text = "Revenue";
            secondaryAxis.LabelStyle.LabelFormat = "$####";
            chart.SecondaryAxis = secondaryAxis;

            var datas = new ObservableArrayList();
            datas.Add(new ChartDataPoint("2010", 8000));
            datas.Add(new ChartDataPoint("2011", 8100));
            datas.Add(new ChartDataPoint("2012", 8250));
            datas.Add(new ChartDataPoint("2013", 8600));
            datas.Add(new ChartDataPoint("2014", 8700));

            var datas1 = new ObservableArrayList();
            datas1.Add(new ChartDataPoint("2010", 6));
            datas1.Add(new ChartDataPoint("2011", 15));
            datas1.Add(new ChartDataPoint("2012", 35));
            datas1.Add(new ChartDataPoint("2013", 65));
            datas1.Add(new ChartDataPoint("2014", 75));

            chart.Series.Add(new ColumnSeries()
            {
                Label = "Revenue",
                DataSource = datas
            });

            var lineSeries = new FastLineSeries()
            {
                Label = "Customers",
                DataSource = datas1,
                StrokeWidth = 7,
                YAxis = new NumericalAxis()
                {
                    OpposedPosition = true,
                    Minimum = 0,
                    Maximum = 80,
                    Interval = 5,
                    ShowMajorGridLines = false,
                }
            };
            chart.Series.Add(lineSeries);
            lineSeries.YAxis.Title.Text = "Number of Customers";
            return chart;
        }
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.ToggleSeriesVisibility = true;

            var categoryAxis = new CategoryAxis {LabelPlacement = LabelPlacement.BetweenTicks};
            categoryAxis.Title.Text = "Category Axis";

            chart.PrimaryAxis = categoryAxis;

            var numericalAxis = new NumericalAxis();
            numericalAxis.Title.Text = "Numerical Axis";
            chart.SecondaryAxis = numericalAxis;

            chart.SecondaryAxis = numericalAxis;
            chart.Series = new ChartSeriesCollection();

            chart.Series.Add(new ColumnSeries()
            {
                Label = "Column Series",
                DataSource = MainPage.GetCategoryData()
            });
            return chart;
        }