Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
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);
        }
       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;
        }
       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;
        }
Пример #6
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text              = "Product X Growth [1995-2005]";
            chart.Title.TextSize          = 15;
            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;

            CategoryAxis categoryAxis = new CategoryAxis();

            categoryAxis.AxisLineOffset             = 10;
            categoryAxis.PlotOffset                 = 10;
            categoryAxis.Title.Text                 = "Year";
            chart.PrimaryAxis                       = categoryAxis;
            chart.PrimaryAxis.Interval              = 2;
            chart.PrimaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;

            LogarithmicAxis logAxis = new LogarithmicAxis();

            logAxis.ShowMinorGridLines     = true;
            logAxis.MinorTicksPerInterval  = 5;
            logAxis.Title.Text             = "Profit";
            logAxis.LabelStyle.LabelFormat = "$##.##";
            chart.SecondaryAxis            = logAxis;

            LineSeries lineSeries = new LineSeries();

            lineSeries.EnableAnimation              = true;
            lineSeries.ItemsSource                  = MainPage.GetLogarithmicData();
            lineSeries.XBindingPath                 = "XValue";
            lineSeries.YBindingPath                 = "YValue";
            lineSeries.DataMarker.ShowLabel         = false;
            lineSeries.DataMarker.ShowMarker        = true;
            lineSeries.DataMarker.MarkerHeight      = 10;
            lineSeries.DataMarker.MarkerWidth       = 10;
            lineSeries.DataMarker.MarkerStrokeWidth = 2;
            lineSeries.DataMarker.MarkerStrokeColor = Color.ParseColor("#00bdae");
            lineSeries.DataMarker.MarkerColor       = Color.White;
            chart.Series.Add(lineSeries);

            lineSeries.TooltipEnabled = true;
            return(chart);
        }
Пример #7
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text     = "Internet Users - 2016";
            chart.Title.TextSize = 15;

            CategoryAxis dateTimeAxis = new CategoryAxis();

            dateTimeAxis.LabelPlacement     = LabelPlacement.BetweenTicks;
            dateTimeAxis.ShowMajorGridLines = false;
            dateTimeAxis.LabelStyle.WrappedLabelAlignment = ChartAxisLabelAlignment.Center;
            dateTimeAxis.LabelStyle.MaxWidth  = 40;
            dateTimeAxis.LabelStyle.TextColor = Color.Black;
            chart.PrimaryAxis = dateTimeAxis;

            var numericalAxis = new NumericalAxis();

            numericalAxis.Minimum            = 0;
            numericalAxis.Maximum            = 70;
            numericalAxis.Visibility         = Visibility.Gone;
            numericalAxis.ShowMajorGridLines = false;
            numericalAxis.ShowMinorGridLines = false;
            chart.SecondaryAxis = numericalAxis;

            ColumnSeries columnSeries = new ColumnSeries();

            columnSeries.EnableAnimation                     = true;
            columnSeries.ColorModel.ColorPalette             = ChartColorPalette.Natural;
            columnSeries.ItemsSource                         = Data.GetCategoryData();
            columnSeries.XBindingPath                        = "XValue";
            columnSeries.YBindingPath                        = "YValue";
            columnSeries.DataMarker.ShowLabel                = true;
            columnSeries.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Outer;
            columnSeries.DataMarker.LabelStyle.LabelFormat   = "#.#'M'";
            chart.Series.Add(columnSeries);

            return(chart);
        }
Пример #8
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Pipeline Volume";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);

            CategoryAxis categoryaxis = new CategoryAxis();

            categoryaxis.ShowMajorGridLines      = false;
            categoryaxis.LabelStyle.TextColor    = Color.Black;
            categoryaxis.LineStyle.StrokeWidth   = 0;
            categoryaxis.LabelStyle.TextSize     = 11;
            categoryaxis.MajorTickStyle.TickSize = 0;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Visibility              = Visibility.Gone;
            numericalaxis.ShowMajorGridLines      = false;
            numericalaxis.LineStyle.StrokeWidth   = 0;
            numericalaxis.MajorTickStyle.TickSize = 0;
            numericalaxis.LabelStyle.LabelFormat  = "$#,###";
            chart.SecondaryAxis = numericalaxis;

            RangeColumnSeries rangeColumnSeries = new RangeColumnSeries();

            rangeColumnSeries.ItemsSource          = MainPage.GetRangeBarData();
            rangeColumnSeries.XBindingPath         = "XValue";
            rangeColumnSeries.High                 = "YValue";
            rangeColumnSeries.Low                  = string.Empty;
            rangeColumnSeries.Transposed           = true;
            rangeColumnSeries.DataMarker.ShowLabel = true;
            rangeColumnSeries.DataMarker.LabelStyle.LabelFormat = "$#,###";
            rangeColumnSeries.ColorModel.ColorPalette           = ChartColorPalette.Natural;

            chart.Series.Add(rangeColumnSeries);
            return(chart);
        }
Пример #9
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Employee Age Group in Various Department";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);

            CategoryAxis categoryAxis = new CategoryAxis();

            categoryAxis.LabelPlacement     = LabelPlacement.BetweenTicks;
            categoryAxis.ShowMajorGridLines = false;
            categoryAxis.Title.Text         = "Department";
            chart.PrimaryAxis = categoryAxis;

            NumericalAxis numericalAxis = new NumericalAxis();

            numericalAxis.Title.Text              = "Age";
            numericalAxis.Maximum                 = 60;
            numericalAxis.Minimum                 = 20;
            numericalAxis.Interval                = 5;
            numericalAxis.ShowMinorGridLines      = false;
            numericalAxis.LineStyle.StrokeWidth   = 0;
            numericalAxis.MajorTickStyle.TickSize = 0;
            chart.SecondaryAxis = numericalAxis;

            boxPlotSeries                         = new BoxAndWhiskerSeries();
            boxPlotSeries.ItemsSource             = MainPage.BoxAndWhiskerData();
            boxPlotSeries.XBindingPath            = "Department";
            boxPlotSeries.YBindingPath            = "EmployeeAges";
            boxPlotSeries.Width                   = 0.5;
            boxPlotSeries.ColorModel.ColorPalette = ChartColorPalette.Natural;
            boxPlotSeries.TooltipEnabled          = true;
            boxPlotSeries.EnableAnimation         = true;
            boxPlotSeries.ShowMedian              = true;


            chart.Series.Add(boxPlotSeries);
            return(chart);
        }
Пример #10
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text     = "Internet Users - 2016";
            chart.Title.TextSize = 15;

            CategoryAxis dateTimeAxis = new CategoryAxis();

            dateTimeAxis.Title.Text         = "Country";
            dateTimeAxis.LabelPlacement     = LabelPlacement.BetweenTicks;
            dateTimeAxis.ShowMajorGridLines = false;
            chart.PrimaryAxis = dateTimeAxis;

            var numericalAxis = new NumericalAxis();

            numericalAxis.Title.Text         = "Usage (%)";
            numericalAxis.Minimum            = 0;
            numericalAxis.Maximum            = 100;
            numericalAxis.Interval           = 10;
            numericalAxis.Visibility         = Visibility.Gone;
            numericalAxis.ShowMajorGridLines = false;
            numericalAxis.ShowMinorGridLines = false;
            chart.SecondaryAxis = numericalAxis;

            ColumnSeries columnSeries = new ColumnSeries();

            columnSeries.EnableAnimation         = true;
            columnSeries.ColorModel.ColorPalette = ChartColorPalette.Natural;
            columnSeries.ItemsSource             = Data.GetCategoryData();
            columnSeries.XBindingPath            = "XValue";
            columnSeries.YBindingPath            = "YValue";
            columnSeries.TooltipEnabled          = true;
            chart.Series.Add(columnSeries);

            return(chart);
        }
Пример #11
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Inflation - Consumer Price";
            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.ShowMajorGridLines      = false;
            categoryaxis.AxisLineOffset          = 10;
            categoryaxis.PlotOffset              = 10;
            categoryaxis.MajorTickStyle.TickSize = 10;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Minimum  = 0;
            numericalaxis.Maximum  = 100;
            numericalaxis.Interval = 20;
            numericalaxis.LineStyle.StrokeWidth   = 0;
            numericalaxis.MajorTickStyle.TickSize = 0;
            numericalaxis.LabelStyle.LabelFormat  = "#'%'";
            chart.SecondaryAxis = numericalaxis;

            LineSeries lineSeries1 = new LineSeries();

            lineSeries1.ItemsSource                  = MainPage.GetLineData1();
            lineSeries1.XBindingPath                 = "XValue";
            lineSeries1.YBindingPath                 = "YValue";
            lineSeries1.DataMarker.ShowMarker        = true;
            lineSeries1.DataMarker.MarkerColor       = Color.White;
            lineSeries1.DataMarker.MarkerWidth       = 10;
            lineSeries1.DataMarker.MarkerHeight      = 10;
            lineSeries1.DataMarker.MarkerStrokeColor = Color.ParseColor("#00bdae");
            lineSeries1.DataMarker.MarkerStrokeWidth = 2;
            lineSeries1.Label          = "Germany";
            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.DataMarker.MarkerColor       = Color.White;
            lineSeries2.DataMarker.MarkerWidth       = 10;
            lineSeries2.DataMarker.MarkerHeight      = 10;
            lineSeries2.DataMarker.MarkerStrokeColor = Color.ParseColor("#404041");
            lineSeries2.DataMarker.MarkerStrokeWidth = 2;
            lineSeries2.StrokeWidth                  = 3;
            lineSeries2.TooltipEnabled               = true;

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

            chart.Series.Add(lineSeries1);
            chart.Series.Add(lineSeries2);
            return(chart);
        }
Пример #12
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;

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

            var primary = new CategoryAxis();

            primary.Title.Text      = "Year";
            primary.Title.TextColor = Color.Black;
            primary.LabelPlacement  = LabelPlacement.BetweenTicks;
            chart.PrimaryAxis       = primary;

            var secondaryAxis = new NumericalAxis()
            {
                Interval           = 2,
                ShowMajorGridLines = false
            };

            secondaryAxis.Title.Text             = "Revenue (in millions)";
            secondaryAxis.LabelStyle.LabelFormat = "$####";
            chart.SecondaryAxis = secondaryAxis;

            var datas = new List <DataPoint>();

            datas.Add(new DataPoint("2010", 20));
            datas.Add(new DataPoint("2011", 21));
            datas.Add(new DataPoint("2012", 22.5));
            datas.Add(new DataPoint("2013", 26));
            datas.Add(new DataPoint("2014", 27));

            var datas1 = new List <DataPoint>();

            datas1.Add(new DataPoint("2010", 6));
            datas1.Add(new DataPoint("2011", 15));
            datas1.Add(new DataPoint("2012", 35));
            datas1.Add(new DataPoint("2013", 65));
            datas1.Add(new DataPoint("2014", 75));

            chart.Series.Add(new ColumnSeries()
            {
                Label           = "Revenue",
                ItemsSource     = datas,
                XBindingPath    = "XValue",
                YBindingPath    = "YValue",
                TooltipEnabled  = true,
                EnableAnimation = true,
            });

            var lineSeries = new FastLineSeries()
            {
                Label           = "Customers",
                ItemsSource     = datas1,
                XBindingPath    = "XValue",
                YBindingPath    = "YValue",
                EnableAnimation = true,
                YAxis           = new NumericalAxis()
                {
                    OpposedPosition    = true,
                    Minimum            = 0,
                    Maximum            = 80,
                    Interval           = 5,
                    ShowMajorGridLines = false,
                }
            };

            chart.Series.Add(lineSeries);
            lineSeries.YAxis.Title.Text = "Number of Customers";
            lineSeries.TooltipEnabled   = true;
            return(chart);
        }
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.Title.Text     = "Gross Domestic Product Growth";
            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 PrimaryAxis = new CategoryAxis();

            PrimaryAxis.ShowMajorGridLines    = false;
            PrimaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            PrimaryAxis.LabelPlacement        = LabelPlacement.BetweenTicks;
            chart.PrimaryAxis = PrimaryAxis;

            NumericalAxis numericalAxis = new NumericalAxis();

            numericalAxis.Title.Text              = "GDP (%) Per Annum";
            numericalAxis.Minimum                 = 0;
            numericalAxis.Maximum                 = 100;
            numericalAxis.Interval                = 10;
            numericalAxis.LineStyle.StrokeWidth   = 0;
            numericalAxis.MajorTickStyle.TickSize = 0;
            numericalAxis.LabelStyle.LabelFormat  = "#'%' ";
            chart.SecondaryAxis = numericalAxis;

            StackingColumn100Series stackingColumn100Series1 = new StackingColumn100Series();

            stackingColumn100Series1.EnableAnimation = true;
            stackingColumn100Series1.Label           = "UK";
            stackingColumn100Series1.ItemsSource     = MainPage.GetStackedColumn100Data1();
            stackingColumn100Series1.XBindingPath    = "XValue";
            stackingColumn100Series1.YBindingPath    = "YValue";
            stackingColumn100Series1.LegendIcon      = ChartLegendIcon.SeriesType;

            StackingColumn100Series stackingColumn100Series2 = new StackingColumn100Series();

            stackingColumn100Series2.EnableAnimation = true;
            stackingColumn100Series2.Label           = "Germany";
            stackingColumn100Series2.ItemsSource     = MainPage.GetStackedColumn100Data2();
            stackingColumn100Series2.XBindingPath    = "XValue";
            stackingColumn100Series2.YBindingPath    = "YValue";
            stackingColumn100Series2.LegendIcon      = ChartLegendIcon.SeriesType;

            StackingColumn100Series stackingColumn100Series3 = new StackingColumn100Series();

            stackingColumn100Series3.EnableAnimation = true;
            stackingColumn100Series3.Label           = "France";
            stackingColumn100Series3.ItemsSource     = MainPage.GetStackedColumn100Data3();
            stackingColumn100Series3.XBindingPath    = "XValue";
            stackingColumn100Series3.YBindingPath    = "YValue";
            stackingColumn100Series3.LegendIcon      = ChartLegendIcon.SeriesType;

            StackingColumn100Series stackingColumn100Series4 = new StackingColumn100Series();

            stackingColumn100Series4.EnableAnimation = true;
            stackingColumn100Series4.Label           = "Italy";
            stackingColumn100Series4.ItemsSource     = MainPage.GetStackedColumn100Data4();
            stackingColumn100Series4.XBindingPath    = "XValue";
            stackingColumn100Series4.YBindingPath    = "YValue";
            stackingColumn100Series4.LegendIcon      = ChartLegendIcon.SeriesType;

            chart.Series.Add(stackingColumn100Series1);
            chart.Series.Add(stackingColumn100Series2);
            chart.Series.Add(stackingColumn100Series3);
            chart.Series.Add(stackingColumn100Series4);

            stackingColumn100Series1.TooltipEnabled = true;
            stackingColumn100Series2.TooltipEnabled = true;
            stackingColumn100Series3.TooltipEnabled = true;
            stackingColumn100Series4.TooltipEnabled = true;

            stackingColumn100Series1.EnableAnimation = true;
            stackingColumn100Series2.EnableAnimation = true;
            stackingColumn100Series3.EnableAnimation = true;
            stackingColumn100Series4.EnableAnimation = true;

            return(chart);
        }
Пример #14
0
        public override View GetSampleContent(Context context)
        {
            chart            = new SfChart(context);
            chart.Title.Text = "Population of India (2013 - 2016)";
            chart.SetBackgroundColor(Color.White);
            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;

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

            categoryaxis.ShowMajorGridLines    = false;
            categoryaxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            categoryaxis.PlotOffset            = 30;
            categoryaxis.AxisLineOffset        = 30;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Minimum  = 900;
            numericalaxis.Maximum  = 1300;
            numericalaxis.Interval = 80;
            numericalaxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            numericalaxis.Title.Text            = "Population";
            chart.SecondaryAxis = numericalaxis;

            lineSeries1                         = new LineSeries();
            lineSeries1.ItemsSource             = MainPage.GetDataMarkerData1();
            lineSeries1.XBindingPath            = "XValue";
            lineSeries1.YBindingPath            = "YValue";
            lineSeries1.EnableAnimation         = true;
            lineSeries1.Label                   = "Male";
            lineSeries1.DataMarker.ShowLabel    = true;
            lineSeries1.DataMarkerLabelCreated += LineSeries1_DataMarkerLabelCreated;
            lineSeries1.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Center;
            lineSeries1.DataMarker.LabelStyle.OffsetY       = -18;
            lineSeries1.DataMarker.ShowMarker        = true;
            lineSeries1.DataMarker.MarkerColor       = Color.White;
            lineSeries1.DataMarker.MarkerHeight      = 6;
            lineSeries1.DataMarker.MarkerWidth       = 6;
            lineSeries1.DataMarker.MarkerStrokeWidth = 2;
            lineSeries1.DataMarker.MarkerStrokeColor = Color.ParseColor("#00BDAE");
            chart.Series.Add(lineSeries1);

            lineSeries2                         = new LineSeries();
            lineSeries2.ItemsSource             = MainPage.GetDataMarkerData2();
            lineSeries2.XBindingPath            = "XValue";
            lineSeries2.YBindingPath            = "YValue";
            lineSeries2.EnableAnimation         = true;
            lineSeries2.Label                   = "Female";
            lineSeries2.DataMarker.ShowLabel    = true;
            lineSeries2.DataMarkerLabelCreated += LineSeries2_DataMarkerLabelCreated;
            lineSeries2.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Center;
            lineSeries2.DataMarker.LabelStyle.OffsetY       = 18;
            lineSeries2.DataMarker.ShowMarker        = true;
            lineSeries2.DataMarker.MarkerColor       = Color.White;
            lineSeries2.DataMarker.MarkerHeight      = 6;
            lineSeries2.DataMarker.MarkerWidth       = 6;
            lineSeries2.DataMarker.MarkerStrokeWidth = 2;
            lineSeries2.DataMarker.MarkerStrokeColor = Color.ParseColor("#404041");
            chart.Series.Add(lineSeries2);

            return(chart);
        }
Пример #15
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text     = "Sales by year";
            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.Title.Text            = "Year";
            categoryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            chart.PrimaryAxis = categoryAxis;

            NumericalAxis numericalAxis = new NumericalAxis();

            numericalAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            numericalAxis.Title.Text            = "Sales Percentage (%)";
            numericalAxis.Minimum  = 0;
            numericalAxis.Maximum  = 100;
            numericalAxis.Interval = 10;
            chart.SecondaryAxis    = numericalAxis;

            StackingBar100Series stackingBar100Series = new StackingBar100Series();

            stackingBar100Series.EnableAnimation = true;
            stackingBar100Series.Label           = "John";
            stackingBar100Series.ItemsSource     = MainPage.GetStackedBar100Data1();
            stackingBar100Series.XBindingPath    = "XValue";
            stackingBar100Series.YBindingPath    = "YValue";

            StackingBar100Series stackingBar100Series1 = new StackingBar100Series();

            stackingBar100Series1.EnableAnimation = true;
            stackingBar100Series1.Label           = "Andrew";
            stackingBar100Series1.ItemsSource     = MainPage.GetStackedBar100Data2();
            stackingBar100Series1.XBindingPath    = "XValue";
            stackingBar100Series1.YBindingPath    = "YValue";

            StackingBar100Series stackingBar100Series2 = new StackingBar100Series();

            stackingBar100Series2.EnableAnimation = true;
            stackingBar100Series2.Label           = "Thomas";
            stackingBar100Series2.ItemsSource     = MainPage.GetStackedBar100Data3();
            stackingBar100Series2.XBindingPath    = "XValue";
            stackingBar100Series2.YBindingPath    = "YValue";

            StackingBar100Series stackingBar100Series3 = new StackingBar100Series();

            stackingBar100Series3.EnableAnimation = true;
            stackingBar100Series3.Label           = "Hendry";
            stackingBar100Series3.ItemsSource     = MainPage.GetStackedBar100Data4();
            stackingBar100Series3.XBindingPath    = "XValue";
            stackingBar100Series3.YBindingPath    = "YValue";

            chart.Series.Add(stackingBar100Series);
            chart.Series.Add(stackingBar100Series1);
            chart.Series.Add(stackingBar100Series2);
            chart.Series.Add(stackingBar100Series3);

            stackingBar100Series.TooltipEnabled  = true;
            stackingBar100Series1.TooltipEnabled = true;
            stackingBar100Series2.TooltipEnabled = true;
            stackingBar100Series3.TooltipEnabled = true;

            stackingBar100Series.EnableAnimation  = true;
            stackingBar100Series1.EnableAnimation = true;
            stackingBar100Series2.EnableAnimation = true;
            stackingBar100Series3.EnableAnimation = true;
            return(chart);
        }
Пример #16
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.SetBackgroundColor(Color.White);
            chart.Legend.ToggleSeriesVisibility = true;
            chart.Title.Text              = "Weather Condition JPN vs DEU";
            chart.Legend.Visibility       = Visibility.Visible;
            chart.Legend.IconHeight       = 14;
            chart.Legend.IconWidth        = 14;
            chart.Legend.DockPosition     = ChartDock.Bottom;
            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;

            var primary = new CategoryAxis();

            primary.Title.Text         = "Year";
            primary.Title.TextColor    = Color.Black;
            primary.LabelPlacement     = LabelPlacement.BetweenTicks;
            primary.ShowMajorGridLines = false;
            chart.PrimaryAxis          = primary;

            var secondaryAxis = new NumericalAxis()
            {
                Interval           = 2,
                ShowMajorGridLines = false
            };

            secondaryAxis.LabelStyle.LabelFormat = "##.##�F";
            secondaryAxis.Maximum  = 100;
            secondaryAxis.Minimum  = 0;
            secondaryAxis.Interval = 20;
            chart.SecondaryAxis    = secondaryAxis;

            var datas = new List <DataPoint>();

            datas.Add(new DataPoint("Sun", 35));
            datas.Add(new DataPoint("Mon", 40));
            datas.Add(new DataPoint("Tue", 80));
            datas.Add(new DataPoint("Wed", 70));
            datas.Add(new DataPoint("Thu", 65));
            datas.Add(new DataPoint("Fri", 55));
            datas.Add(new DataPoint("Sat", 50));

            var datas1 = new List <DataPoint>();

            datas1.Add(new DataPoint("Sun", 30));
            datas1.Add(new DataPoint("Mon", 28));
            datas1.Add(new DataPoint("Tue", 29));
            datas1.Add(new DataPoint("Wed", 30));
            datas1.Add(new DataPoint("Thu", 33));
            datas1.Add(new DataPoint("Fri", 32));
            datas1.Add(new DataPoint("Sat", 34));

            chart.Series.Add(new ColumnSeries()
            {
                Label           = "Germany",
                ItemsSource     = datas,
                XBindingPath    = "XValue",
                YBindingPath    = "YValue",
                TooltipEnabled  = true,
                EnableAnimation = true,
            });

            var lineSeries = new FastLineSeries()
            {
                Label           = "Japan",
                ItemsSource     = datas1,
                XBindingPath    = "XValue",
                YBindingPath    = "YValue",
                EnableAnimation = true,
                YAxis           = new NumericalAxis()
                {
                    OpposedPosition    = true,
                    Minimum            = 24,
                    Maximum            = 36,
                    Interval           = 2,
                    ShowMajorGridLines = false,
                }
            };

            lineSeries.DataMarker.ShowLabel         = false;
            lineSeries.DataMarker.ShowMarker        = true;
            lineSeries.DataMarker.MarkerColor       = Color.White;
            lineSeries.DataMarker.MarkerWidth       = 10;
            lineSeries.DataMarker.MarkerHeight      = 10;
            lineSeries.DataMarker.MarkerStrokeColor = Color.ParseColor("#F8AB1D");
            lineSeries.DataMarker.MarkerStrokeWidth = 2;
            lineSeries.YAxis.LabelStyle.LabelFormat = "##.##�C";
            chart.Series.Add(lineSeries);
            lineSeries.TooltipEnabled = true;
            return(chart);
        }
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.Title.Text = "Product Sale 2016";
            chart.SetBackgroundColor(Color.White);

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

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

            var secondaryAxis = new NumericalAxis();

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

            var columnSeries = new ColumnSeries
            {
                ItemsSource               = MainPage.GetSelectionData(),
                XBindingPath              = "XValue",
                YBindingPath              = "YValue",
                Color                     = Color.ParseColor("#7F00BDAE"),
                SelectedDataPointColor    = Color.ParseColor("#FF00BDAE"),
                DataPointSelectionEnabled = true,
                EnableAnimation           = true,
            };

            chart.Series.Add(columnSeries);

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

            label = new TextView(context)
            {
                TextSize = 20
            };
            label.Text = "Tap on a bar segment to select a data point.";
            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);
        }
Пример #18
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

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

            CategoryAxis categoryaxis = new CategoryAxis();

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

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Minimum    = 0;
            numericalaxis.Maximum    = 4.5;
            numericalaxis.Interval   = 0.5;
            numericalaxis.Title.Text = "Rate (%)";
            chart.SecondaryAxis      = numericalaxis;

            var areaSeries1 = new SplineAreaSeries
            {
                Label           = "US",
                Alpha           = 0.5f,
                EnableAnimation = true,
                ItemsSource     = MainPage.GetSplineAreaData1(),
                XBindingPath    = "XValue",
                YBindingPath    = "YValue"
            };
            var areaSeries2 = new SplineAreaSeries
            {
                Alpha           = 0.5f,
                Label           = "France",
                EnableAnimation = true,
                ItemsSource     = MainPage.GetSplineAreaData2(),
                XBindingPath    = "XValue",
                YBindingPath    = "YValue"
            };
            var areaSeries3 = new SplineAreaSeries
            {
                Alpha           = 0.5f,
                Label           = "Germany",
                EnableAnimation = true,
                ItemsSource     = MainPage.GetSplineAreaData3(),
                XBindingPath    = "XValue",
                YBindingPath    = "YValue"
            };

            chart.Series.Add(areaSeries1);
            chart.Series.Add(areaSeries2);
            chart.Series.Add(areaSeries3);

            areaSeries1.TooltipEnabled = true;
            areaSeries2.TooltipEnabled = true;
            areaSeries3.TooltipEnabled = true;

            areaSeries1.EnableAnimation = true;
            areaSeries2.EnableAnimation = true;
            areaSeries3.EnableAnimation = true;

            return(chart);
        }
Пример #19
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);;
            chart.Title.Text     = "Annual Temperature Comparison";
            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 PrimaryAxis = new CategoryAxis();

            PrimaryAxis.Title.Text            = "Year";
            PrimaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            chart.PrimaryAxis = PrimaryAxis;

            NumericalAxis numericalAxis = new NumericalAxis();

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

            StackingArea100Series stackingArea100Series1 = new StackingArea100Series();

            stackingArea100Series1.EnableAnimation = true;
            stackingArea100Series1.ItemsSource     = MainPage.GetStackedArea100Data1();
            stackingArea100Series1.XBindingPath    = "XValue";
            stackingArea100Series1.YBindingPath    = "YValue";
            stackingArea100Series1.Label           = "USA";
            chart.Series.Add(stackingArea100Series1);

            StackingArea100Series stackingArea100Series2 = new StackingArea100Series();

            stackingArea100Series2.EnableAnimation = true;
            stackingArea100Series2.ItemsSource     = MainPage.GetStackedArea100Data2();
            stackingArea100Series2.XBindingPath    = "XValue";
            stackingArea100Series2.YBindingPath    = "YValue";
            stackingArea100Series2.Label           = "India";
            chart.Series.Add(stackingArea100Series2);

            StackingArea100Series stackingArea100Series3 = new StackingArea100Series();

            stackingArea100Series3.EnableAnimation = true;
            stackingArea100Series3.ItemsSource     = MainPage.GetStackedArea100Data3();
            stackingArea100Series3.XBindingPath    = "XValue";
            stackingArea100Series3.YBindingPath    = "YValue";
            stackingArea100Series3.Label           = "Canada";
            chart.Series.Add(stackingArea100Series3);

            StackingArea100Series stackingArea100Series4 = new StackingArea100Series();

            stackingArea100Series4.EnableAnimation = true;
            stackingArea100Series4.ItemsSource     = MainPage.GetStackedArea100Data4();
            stackingArea100Series4.XBindingPath    = "XValue";
            stackingArea100Series4.YBindingPath    = "YValue";
            stackingArea100Series4.Label           = "China";
            chart.Series.Add(stackingArea100Series4);

            stackingArea100Series1.TooltipEnabled = true;
            stackingArea100Series2.TooltipEnabled = true;
            stackingArea100Series3.TooltipEnabled = true;
            stackingArea100Series4.TooltipEnabled = true;

            stackingArea100Series1.EnableAnimation = true;
            stackingArea100Series2.EnableAnimation = true;
            stackingArea100Series3.EnableAnimation = true;
            stackingArea100Series4.EnableAnimation = true;

            return(chart);
        }
Пример #20
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "CO-2 Intensity Analysis";
            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    = 390;
            numericalaxis.Maximum    = 600;
            numericalaxis.Interval   = 30;
            numericalaxis.Title.Text = "Intensity (g/KWh)";
            chart.SecondaryAxis      = numericalaxis;

            StepLineSeries stepLineSeries1 = new StepLineSeries();

            stepLineSeries1.ItemsSource           = MainPage.GetStepLineData1();
            stepLineSeries1.XBindingPath          = "XValue";
            stepLineSeries1.YBindingPath          = "YValue";
            stepLineSeries1.Label                 = "US";
            stepLineSeries1.DataMarker.ShowMarker = true;
            stepLineSeries1.LegendIcon            = ChartLegendIcon.Circle;
            stepLineSeries1.StrokeWidth           = 3;
            stepLineSeries1.TooltipEnabled        = true;

            StepLineSeries stepLineSeries2 = new StepLineSeries();

            stepLineSeries2.ItemsSource           = MainPage.GetStepLineData2();
            stepLineSeries2.XBindingPath          = "XValue";
            stepLineSeries2.YBindingPath          = "YValue";
            stepLineSeries2.Label                 = "Korea";
            stepLineSeries2.DataMarker.ShowMarker = true;
            stepLineSeries2.LegendIcon            = ChartLegendIcon.Circle;
            stepLineSeries2.StrokeWidth           = 3;
            stepLineSeries2.TooltipEnabled        = true;

            StepLineSeries stepLineSeries3 = new StepLineSeries();

            stepLineSeries3.ItemsSource           = MainPage.GetStepLineData3();
            stepLineSeries3.XBindingPath          = "XValue";
            stepLineSeries3.YBindingPath          = "YValue";
            stepLineSeries3.Label                 = "Japan";
            stepLineSeries3.DataMarker.ShowMarker = true;
            stepLineSeries3.LegendIcon            = ChartLegendIcon.Circle;
            stepLineSeries3.StrokeWidth           = 3;
            stepLineSeries3.TooltipEnabled        = true;

            stepLineSeries1.EnableAnimation = true;
            stepLineSeries2.EnableAnimation = true;
            stepLineSeries3.EnableAnimation = true;

            chart.Series.Add(stepLineSeries1);
            chart.Series.Add(stepLineSeries2);
            chart.Series.Add(stepLineSeries3);
            return(chart);
        }
Пример #21
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;

            chart.Title.Text = "Most Popular Search Engines";
            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 PrimaryAxis = new CategoryAxis();

            PrimaryAxis.Title.Text     = "Month";
            PrimaryAxis.LabelPlacement = LabelPlacement.BetweenTicks;
            chart.PrimaryAxis          = PrimaryAxis;

            NumericalAxis numericalAxis = new NumericalAxis();

            numericalAxis.Title.Text = "Number of visitors in Millions";
            numericalAxis.Minimum    = 0;
            numericalAxis.Maximum    = 1800;
            numericalAxis.Interval   = 200;
            chart.SecondaryAxis      = numericalAxis;

            StackingColumnSeries stackingColumnSeries = new StackingColumnSeries();

            stackingColumnSeries.EnableAnimation = true;
            stackingColumnSeries.Label           = "Google";
            stackingColumnSeries.ItemsSource     = MainPage.GetStackedColumnData1();
            stackingColumnSeries.XBindingPath    = "XValue";
            stackingColumnSeries.YBindingPath    = "YValue";

            StackingColumnSeries stackingColumnSeries1 = new StackingColumnSeries();

            stackingColumnSeries1.EnableAnimation = true;
            stackingColumnSeries1.Label           = "Bing";
            stackingColumnSeries1.ItemsSource     = MainPage.GetStackedColumnData2();
            stackingColumnSeries1.XBindingPath    = "XValue";
            stackingColumnSeries1.YBindingPath    = "YValue";

            StackingColumnSeries stackingColumnSeries2 = new StackingColumnSeries();

            stackingColumnSeries2.EnableAnimation = true;
            stackingColumnSeries2.Label           = "Yahoo";
            stackingColumnSeries2.ItemsSource     = MainPage.GetStackedColumnData3();
            stackingColumnSeries2.XBindingPath    = "XValue";
            stackingColumnSeries2.YBindingPath    = "YValue";

            StackingColumnSeries stackingColumnSeries3 = new StackingColumnSeries();

            stackingColumnSeries3.EnableAnimation = true;
            stackingColumnSeries3.Label           = "Ask";
            stackingColumnSeries3.ItemsSource     = MainPage.GetStackedColumnData4();
            stackingColumnSeries3.XBindingPath    = "XValue";
            stackingColumnSeries3.YBindingPath    = "YValue";


            chart.Series.Add(stackingColumnSeries);
            chart.Series.Add(stackingColumnSeries1);
            chart.Series.Add(stackingColumnSeries2);
            chart.Series.Add(stackingColumnSeries3);

            stackingColumnSeries.TooltipEnabled  = true;
            stackingColumnSeries1.TooltipEnabled = true;
            stackingColumnSeries2.TooltipEnabled = true;
            stackingColumnSeries3.TooltipEnabled = true;

            stackingColumnSeries.EnableAnimation  = true;
            stackingColumnSeries1.EnableAnimation = true;
            stackingColumnSeries2.EnableAnimation = true;
            stackingColumnSeries3.EnableAnimation = true;

            return(chart);
        }
Пример #22
0
        public override View GetSampleContent(Context context)
        {
            chart            = new SfChart(context);
            chart.Title.Text = "Product Sale 2016";
            chart.SetBackgroundColor(Color.White);

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

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

            var secondaryAxis = new NumericalAxis();

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

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

            chart.Series.Add(columnSeries);

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

            chart.Series.Add(columnSeries1);

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

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

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

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

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

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

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

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

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

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

            return(layout);
        }
Пример #23
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Trend in Sales of Ethical Produce";
            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 primaryAxis = new CategoryAxis();

            primaryAxis.Interval = 2;
            primaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            primaryAxis.ShowMajorGridLines    = false;
            chart.PrimaryAxis = primaryAxis;

            NumericalAxis numericalAxis = new NumericalAxis();

            numericalAxis.Minimum                 = 0;
            numericalAxis.Maximum                 = 7;
            numericalAxis.Interval                = 1;
            numericalAxis.Title.Text              = "Spends";
            numericalAxis.LineStyle.StrokeWidth   = 0;
            numericalAxis.MajorTickStyle.TickSize = 0;
            numericalAxis.LabelStyle.LabelFormat  = "##.##B ";
            chart.SecondaryAxis = numericalAxis;

            StackingAreaSeries stackingAreaSeries = new StackingAreaSeries();

            stackingAreaSeries.EnableAnimation = true;
            stackingAreaSeries.ItemsSource     = MainPage.GetStackedAreaData1();
            stackingAreaSeries.XBindingPath    = "XValue";
            stackingAreaSeries.YBindingPath    = "YValue";
            stackingAreaSeries.Label           = "Organic";
            stackingAreaSeries.LegendIcon      = ChartLegendIcon.SeriesType;
            chart.Series.Add(stackingAreaSeries);

            StackingAreaSeries stackingAreaSeries1 = new StackingAreaSeries();

            stackingAreaSeries1.EnableAnimation = true;
            stackingAreaSeries1.ItemsSource     = MainPage.GetStackedAreaData2();
            stackingAreaSeries1.XBindingPath    = "XValue";
            stackingAreaSeries1.YBindingPath    = "YValue";
            stackingAreaSeries1.Label           = "Fair-trade";
            stackingAreaSeries1.LegendIcon      = ChartLegendIcon.SeriesType;
            chart.Series.Add(stackingAreaSeries1);

            StackingAreaSeries stackingAreaSeries2 = new StackingAreaSeries();

            stackingAreaSeries2.EnableAnimation = true;
            stackingAreaSeries2.ItemsSource     = MainPage.GetStackedAreaData3();
            stackingAreaSeries2.XBindingPath    = "XValue";
            stackingAreaSeries2.YBindingPath    = "YValue";
            stackingAreaSeries2.Label           = "Veg Alternatives";
            stackingAreaSeries2.LegendIcon      = ChartLegendIcon.SeriesType;
            chart.Series.Add(stackingAreaSeries2);

            StackingAreaSeries stackingAreaSeries3 = new StackingAreaSeries();

            stackingAreaSeries3.EnableAnimation = true;
            stackingAreaSeries3.ItemsSource     = MainPage.GetStackedAreaData4();
            stackingAreaSeries3.XBindingPath    = "XValue";
            stackingAreaSeries3.YBindingPath    = "YValue";
            stackingAreaSeries3.Label           = "Others";
            stackingAreaSeries3.LegendIcon      = ChartLegendIcon.SeriesType;
            chart.Series.Add(stackingAreaSeries3);

            stackingAreaSeries.TooltipEnabled  = true;
            stackingAreaSeries1.TooltipEnabled = true;
            stackingAreaSeries2.TooltipEnabled = true;
            stackingAreaSeries3.TooltipEnabled = true;

            stackingAreaSeries.EnableAnimation  = true;
            stackingAreaSeries1.EnableAnimation = true;
            stackingAreaSeries2.EnableAnimation = true;
            stackingAreaSeries3.EnableAnimation = true;

            return(chart);
        }
Пример #24
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Monthly Expenses of a Family";
            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.ShowMajorGridLines      = false;
            categoryaxis.AxisLineOffset          = 10;
            categoryaxis.PlotOffset              = 10;
            categoryaxis.MajorTickStyle.TickSize = 10;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Minimum  = 0;
            numericalaxis.Maximum  = 200;
            numericalaxis.Interval = 20;
            numericalaxis.LineStyle.StrokeWidth   = 0;
            numericalaxis.MajorTickStyle.TickSize = 0;
            numericalaxis.LabelStyle.LabelFormat  = "'$'#";
            chart.SecondaryAxis = numericalaxis;

            StackingLineSeries stackingline1 = new StackingLineSeries();

            stackingline1.ItemsSource                  = MainPage.GetStackingLineData1();
            stackingline1.XBindingPath                 = "XValue";
            stackingline1.YBindingPath                 = "YValue";
            stackingline1.DataMarker.ShowMarker        = true;
            stackingline1.DataMarker.MarkerColor       = Color.White;
            stackingline1.DataMarker.MarkerWidth       = 10;
            stackingline1.DataMarker.MarkerHeight      = 10;
            stackingline1.DataMarker.MarkerStrokeColor = Color.ParseColor("#00bdae");
            stackingline1.DataMarker.MarkerStrokeWidth = 2;
            stackingline1.Label          = "Daughter";
            stackingline1.StrokeWidth    = 3;
            stackingline1.TooltipEnabled = true;

            StackingLineSeries stackingline2 = new StackingLineSeries();

            stackingline2.ItemsSource                  = MainPage.GetStackingLineData2();
            stackingline2.XBindingPath                 = "XValue";
            stackingline2.YBindingPath                 = "YValue";
            stackingline2.Label                        = "Son";
            stackingline2.DataMarker.ShowMarker        = true;
            stackingline2.DataMarker.MarkerColor       = Color.White;
            stackingline2.DataMarker.MarkerWidth       = 10;
            stackingline2.DataMarker.MarkerHeight      = 10;
            stackingline2.DataMarker.MarkerStrokeColor = Color.ParseColor("#404041");
            stackingline2.DataMarker.MarkerStrokeWidth = 2;
            stackingline2.StrokeWidth                  = 3;
            stackingline2.TooltipEnabled               = true;

            StackingLineSeries stackingline3 = new StackingLineSeries();

            stackingline3.ItemsSource                  = MainPage.GetStackingLineData3();
            stackingline3.XBindingPath                 = "XValue";
            stackingline3.YBindingPath                 = "YValue";
            stackingline3.DataMarker.ShowMarker        = true;
            stackingline3.DataMarker.MarkerColor       = Color.White;
            stackingline3.DataMarker.MarkerWidth       = 10;
            stackingline3.DataMarker.MarkerHeight      = 10;
            stackingline3.DataMarker.MarkerStrokeColor = Color.ParseColor("#357cd2");
            stackingline3.DataMarker.MarkerStrokeWidth = 2;
            stackingline3.Label          = "Mother";
            stackingline3.StrokeWidth    = 3;
            stackingline3.TooltipEnabled = true;

            StackingLineSeries stackingline4 = new StackingLineSeries();

            stackingline4.ItemsSource                  = MainPage.GetStackingLineData4();
            stackingline4.XBindingPath                 = "XValue";
            stackingline4.YBindingPath                 = "YValue";
            stackingline4.Label                        = "Father";
            stackingline4.DataMarker.ShowMarker        = true;
            stackingline4.DataMarker.MarkerColor       = Color.White;
            stackingline4.DataMarker.MarkerWidth       = 10;
            stackingline4.DataMarker.MarkerHeight      = 10;
            stackingline4.DataMarker.MarkerStrokeColor = Color.ParseColor("#e56590");
            stackingline4.DataMarker.MarkerStrokeWidth = 2;
            stackingline4.StrokeWidth                  = 3;
            stackingline4.TooltipEnabled               = true;

            stackingline1.EnableAnimation = true;
            stackingline2.EnableAnimation = true;
            stackingline3.EnableAnimation = true;
            stackingline4.EnableAnimation = true;

            chart.Series.Add(stackingline1);
            chart.Series.Add(stackingline2);
            chart.Series.Add(stackingline3);
            chart.Series.Add(stackingline4);

            return(chart);
        }
Пример #25
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);;
            chart.Title.Text     = "Industrial Production Growth";
            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 PrimaryAxis = new CategoryAxis();

            PrimaryAxis.Title.Text            = "Year";
            PrimaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            PrimaryAxis.ShowMajorGridLines    = false;
            chart.PrimaryAxis = PrimaryAxis;

            NumericalAxis numericalAxis = new NumericalAxis();

            numericalAxis.Title.Text = "Production (%)";
            numericalAxis.Minimum    = 0;
            numericalAxis.Maximum    = 30;
            numericalAxis.Interval   = 5;
            chart.SecondaryAxis      = numericalAxis;

            StackingAreaSeries stackingAreaSeries = new StackingAreaSeries();

            stackingAreaSeries.EnableAnimation = true;
            stackingAreaSeries.ItemsSource     = MainPage.GetStackedAreaData1();
            stackingAreaSeries.XBindingPath    = "XValue";
            stackingAreaSeries.YBindingPath    = "YValue";
            stackingAreaSeries.Label           = "US";
            chart.Series.Add(stackingAreaSeries);

            StackingAreaSeries stackingAreaSeries1 = new StackingAreaSeries();

            stackingAreaSeries1.EnableAnimation = true;
            stackingAreaSeries1.ItemsSource     = MainPage.GetStackedAreaData2();
            stackingAreaSeries1.XBindingPath    = "XValue";
            stackingAreaSeries1.YBindingPath    = "YValue";
            stackingAreaSeries1.Label           = "Indonesia";
            chart.Series.Add(stackingAreaSeries1);

            StackingAreaSeries stackingAreaSeries2 = new StackingAreaSeries();

            stackingAreaSeries2.EnableAnimation = true;
            stackingAreaSeries2.ItemsSource     = MainPage.GetStackedAreaData3();
            stackingAreaSeries2.XBindingPath    = "XValue";
            stackingAreaSeries2.YBindingPath    = "YValue";
            stackingAreaSeries2.Label           = "Russia";
            chart.Series.Add(stackingAreaSeries2);

            StackingAreaSeries stackingAreaSeries3 = new StackingAreaSeries();

            stackingAreaSeries3.EnableAnimation = true;
            stackingAreaSeries3.ItemsSource     = MainPage.GetStackedAreaData4();
            stackingAreaSeries3.XBindingPath    = "XValue";
            stackingAreaSeries3.YBindingPath    = "YValue";
            stackingAreaSeries3.Label           = "Bangladesh";
            chart.Series.Add(stackingAreaSeries3);

            stackingAreaSeries.TooltipEnabled  = true;
            stackingAreaSeries1.TooltipEnabled = true;
            stackingAreaSeries2.TooltipEnabled = true;
            stackingAreaSeries3.TooltipEnabled = true;

            stackingAreaSeries.EnableAnimation  = true;
            stackingAreaSeries1.EnableAnimation = true;
            stackingAreaSeries2.EnableAnimation = true;
            stackingAreaSeries3.EnableAnimation = true;

            return(chart);
        }
Пример #26
0
        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);
        }
Пример #27
0
       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;
        }
Пример #28
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.Title.Text     = "Sales Comparison";
            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 PrimaryAxis = new CategoryAxis();

            PrimaryAxis.ShowMajorGridLines    = false;
            PrimaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            PrimaryAxis.LabelPlacement        = LabelPlacement.BetweenTicks;
            chart.PrimaryAxis = PrimaryAxis;

            NumericalAxis numericalAxis = new NumericalAxis();

            numericalAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            numericalAxis.Minimum  = -20;
            numericalAxis.Maximum  = 60;
            numericalAxis.Interval = 20;
            numericalAxis.LineStyle.StrokeWidth   = 0;
            numericalAxis.MajorTickStyle.TickSize = 0;
            numericalAxis.LabelStyle.LabelFormat  = "#'%'";
            chart.SecondaryAxis = numericalAxis;

            StackingBarSeries stackingBarSeries = new StackingBarSeries();

            stackingBarSeries.EnableAnimation = true;
            stackingBarSeries.Label           = "Apple";
            stackingBarSeries.ItemsSource     = MainPage.GetStackedBarData1();
            stackingBarSeries.XBindingPath    = "XValue";
            stackingBarSeries.YBindingPath    = "YValue";
            stackingBarSeries.LegendIcon      = ChartLegendIcon.SeriesType;

            StackingBarSeries stackingBarSeries1 = new StackingBarSeries();

            stackingBarSeries1.EnableAnimation = true;
            stackingBarSeries1.Label           = "Orange";
            stackingBarSeries1.ItemsSource     = MainPage.GetStackedBarData2();
            stackingBarSeries1.XBindingPath    = "XValue";
            stackingBarSeries1.YBindingPath    = "YValue";
            stackingBarSeries1.LegendIcon      = ChartLegendIcon.SeriesType;

            StackingBarSeries stackingBarSeries2 = new StackingBarSeries();

            stackingBarSeries2.EnableAnimation = true;
            stackingBarSeries2.Label           = "Wastage";
            stackingBarSeries2.ItemsSource     = MainPage.GetStackedBarData3();
            stackingBarSeries2.XBindingPath    = "XValue";
            stackingBarSeries2.YBindingPath    = "YValue";
            stackingBarSeries2.LegendIcon      = ChartLegendIcon.SeriesType;

            chart.Series.Add(stackingBarSeries);
            chart.Series.Add(stackingBarSeries1);
            chart.Series.Add(stackingBarSeries2);

            stackingBarSeries.TooltipEnabled  = true;
            stackingBarSeries1.TooltipEnabled = true;
            stackingBarSeries2.TooltipEnabled = true;

            stackingBarSeries.EnableAnimation  = true;
            stackingBarSeries1.EnableAnimation = true;
            stackingBarSeries2.EnableAnimation = true;

            return(chart);
        }
Пример #29
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Olympic Medal Counts - RIO";
            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";
            categoryaxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            categoryaxis.ShowMajorGridLines    = false;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Title.Text         = "Medals";
            numericalaxis.Visibility         = Visibility.Gone;
            numericalaxis.ShowMajorGridLines = false;
            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;
            columnSeries1.LegendIcon           = ChartLegendIcon.SeriesType;
            columnSeries1.DataMarker.ShowLabel = true;
            columnSeries1.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Inner;

            columnSeries2                      = new ColumnSeries();
            columnSeries2.Label                = "Silver";
            columnSeries2.ItemsSource          = MainPage.GetColumnData2();
            columnSeries2.XBindingPath         = "XValue";
            columnSeries2.YBindingPath         = "YValue";
            columnSeries2.TooltipEnabled       = true;
            columnSeries2.EnableAnimation      = true;
            columnSeries2.LegendIcon           = ChartLegendIcon.SeriesType;
            columnSeries2.DataMarker.ShowLabel = true;
            columnSeries2.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Inner;

            columnSeries3                      = new ColumnSeries();
            columnSeries3.Label                = "Bronze";
            columnSeries3.ItemsSource          = MainPage.GetColumnData3();
            columnSeries3.XBindingPath         = "XValue";
            columnSeries3.YBindingPath         = "YValue";
            columnSeries3.TooltipEnabled       = true;
            columnSeries3.EnableAnimation      = true;
            columnSeries3.LegendIcon           = ChartLegendIcon.SeriesType;
            columnSeries3.DataMarker.ShowLabel = true;
            columnSeries3.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Inner;

            chart.Series.Add(columnSeries1);
            chart.Series.Add(columnSeries2);
            chart.Series.Add(columnSeries3);

            return(chart);
        }
Пример #30
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text     = "NC Weather Report";
            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.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Minimum  = 0;
            numericalaxis.Maximum  = 40;
            numericalaxis.Interval = 10;
            numericalaxis.LineStyle.StrokeWidth   = 0;
            numericalaxis.MajorTickStyle.TickSize = 0;
            numericalaxis.LabelStyle.LabelFormat  = "##.##�C";
            chart.SecondaryAxis = numericalaxis;

            SplineSeries splineSeries1 = new SplineSeries();

            splineSeries1.ItemsSource                  = MainPage.GetSplineData1();
            splineSeries1.XBindingPath                 = "XValue";
            splineSeries1.YBindingPath                 = "YValue";
            splineSeries1.Label                        = "Max Temp";
            splineSeries1.DataMarker.ShowMarker        = true;
            splineSeries1.DataMarker.MarkerWidth       = 10;
            splineSeries1.DataMarker.MarkerHeight      = 10;
            splineSeries1.DataMarker.MarkerColor       = Color.White;
            splineSeries1.DataMarker.MarkerStrokeColor = Color.ParseColor("#00bdae");
            splineSeries1.DataMarker.MarkerStrokeWidth = 2;
            splineSeries1.LegendIcon                   = ChartLegendIcon.SeriesType;
            splineSeries1.TooltipEnabled               = true;
            splineSeries1.StrokeWidth                  = 3;

            SplineSeries splineSeries2 = new SplineSeries();

            splineSeries2.ItemsSource                  = MainPage.GetSplineData2();
            splineSeries2.XBindingPath                 = "XValue";
            splineSeries2.YBindingPath                 = "YValue";
            splineSeries2.Label                        = "Avg Temp";
            splineSeries2.DataMarker.ShowMarker        = true;
            splineSeries2.DataMarker.MarkerWidth       = 10;
            splineSeries2.DataMarker.MarkerHeight      = 10;
            splineSeries2.DataMarker.MarkerColor       = Color.White;
            splineSeries2.DataMarker.MarkerStrokeColor = Color.ParseColor("#404041");
            splineSeries2.DataMarker.MarkerStrokeWidth = 2;
            splineSeries2.LegendIcon                   = ChartLegendIcon.SeriesType;
            splineSeries2.TooltipEnabled               = true;
            splineSeries2.StrokeWidth                  = 3;

            SplineSeries splineSeries3 = new SplineSeries();

            splineSeries3.ItemsSource                  = MainPage.GetSplineData3();
            splineSeries3.XBindingPath                 = "XValue";
            splineSeries3.YBindingPath                 = "YValue";
            splineSeries3.Label                        = "Min Temp";
            splineSeries3.DataMarker.ShowMarker        = true;
            splineSeries3.DataMarker.MarkerWidth       = 10;
            splineSeries3.DataMarker.MarkerHeight      = 10;
            splineSeries3.DataMarker.MarkerColor       = Color.White;
            splineSeries3.DataMarker.MarkerStrokeColor = Color.ParseColor("#357CD2");
            splineSeries3.DataMarker.MarkerStrokeWidth = 2;
            splineSeries3.LegendIcon                   = ChartLegendIcon.SeriesType;
            splineSeries3.TooltipEnabled               = true;
            splineSeries3.StrokeWidth                  = 3;

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

            chart.Series.Add(splineSeries1);
            chart.Series.Add(splineSeries2);
            chart.Series.Add(splineSeries3);
            return(chart);
        }
Пример #31
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;

            chart.Title.Text     = "Gross Domestic Product Growth";
            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 PrimaryAxis = new CategoryAxis();

            PrimaryAxis.Title.Text     = "Month";
            PrimaryAxis.LabelPlacement = LabelPlacement.BetweenTicks;
            chart.PrimaryAxis          = PrimaryAxis;

            NumericalAxis numericalAxis = new NumericalAxis();

            numericalAxis.Title.Text = "GDP (%) Per Annum";
            numericalAxis.Minimum    = 0;
            numericalAxis.Maximum    = 100;
            numericalAxis.Interval   = 10;
            chart.SecondaryAxis      = numericalAxis;

            StackingColumn100Series stackingColumn100Series1 = new StackingColumn100Series();

            stackingColumn100Series1.EnableAnimation = true;
            stackingColumn100Series1.Label           = "US";
            stackingColumn100Series1.ItemsSource     = MainPage.GetStackedColumnData1();
            stackingColumn100Series1.XBindingPath    = "XValue";
            stackingColumn100Series1.YBindingPath    = "YValue";

            StackingColumn100Series stackingColumn100Series2 = new StackingColumn100Series();

            stackingColumn100Series2.EnableAnimation = true;
            stackingColumn100Series2.Label           = "India";
            stackingColumn100Series2.ItemsSource     = MainPage.GetStackedColumnData2();
            stackingColumn100Series2.XBindingPath    = "XValue";
            stackingColumn100Series2.YBindingPath    = "YValue";

            StackingColumn100Series stackingColumn100Series3 = new StackingColumn100Series();

            stackingColumn100Series3.EnableAnimation = true;
            stackingColumn100Series3.Label           = "China";
            stackingColumn100Series3.ItemsSource     = MainPage.GetStackedColumnData3();
            stackingColumn100Series3.XBindingPath    = "XValue";
            stackingColumn100Series3.YBindingPath    = "YValue";

            StackingColumn100Series stackingColumn100Series4 = new StackingColumn100Series();

            stackingColumn100Series4.EnableAnimation = true;
            stackingColumn100Series4.Label           = "Canada";
            stackingColumn100Series4.ItemsSource     = MainPage.GetStackedColumnData4();
            stackingColumn100Series4.XBindingPath    = "XValue";
            stackingColumn100Series4.YBindingPath    = "YValue";

            chart.Series.Add(stackingColumn100Series1);
            chart.Series.Add(stackingColumn100Series2);
            chart.Series.Add(stackingColumn100Series3);
            chart.Series.Add(stackingColumn100Series4);

            stackingColumn100Series1.TooltipEnabled = true;
            stackingColumn100Series2.TooltipEnabled = true;
            stackingColumn100Series3.TooltipEnabled = true;
            stackingColumn100Series4.TooltipEnabled = true;

            stackingColumn100Series1.EnableAnimation = true;
            stackingColumn100Series2.EnableAnimation = true;
            stackingColumn100Series3.EnableAnimation = true;
            stackingColumn100Series4.EnableAnimation = true;

            return(chart);
        }
Пример #32
-1
       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;
        }