示例#1
0
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);

            chart.PrimaryAxis = new CategoryAxis {PlotOffset = 50};
            chart.SecondaryAxis = new NumericalAxis();

            var bubble = new BubbleSeries();
           
            bubble.ColorModel.ColorPalette = ChartColorPalette.Metro;
            bubble.DataMarker.ShowLabel = true;
            bubble.DataMarker.UseSeriesPalette = false;
            bubble.DataMarker.LabelStyle.TextColor = Color.White;

            var datas = new ObservableArrayList();
            datas.Add(new ChartDataPoint("2010", 45, 30));
            datas.Add(new ChartDataPoint("2011", 86, 20));
            datas.Add(new ChartDataPoint("2012", 23, 15));
            datas.Add(new ChartDataPoint("2013", 43, 25));
            datas.Add(new ChartDataPoint("2014", 54, 20));

            bubble.DataSource = datas;
            chart.Series.Add(bubble);
            return chart;
        }
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);
            chart.PrimaryAxis = new CategoryAxis {LabelPlacement = LabelPlacement.BetweenTicks};
            chart.SecondaryAxis = new NumericalAxis {ShowMajorGridLines = false,EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift};

            var series = new StackingBarSeries
            {
                DataMarkerPosition = DataMarkerPosition.Center,
                DataSource = MainPage.GetData1(),
            };
            series.DataMarker.ShowLabel = true;
            series.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Center;
            chart.Series.Add(series);

            series = new StackingBarSeries
            {
                DataMarkerPosition = DataMarkerPosition.Center,
                DataSource = MainPage.GetData2(),
            };
            series.DataMarker.ShowLabel = true;
            series.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Center;
            chart.Series.Add(series);

            series = new StackingBarSeries
            {
                DataMarkerPosition = DataMarkerPosition.Center,
                DataSource = MainPage.GetData3(),
            };
            series.DataMarker.ShowLabel = true;
            series.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Center;
            chart.Series.Add(series);
            return chart;
        }
示例#3
0
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.ToggleSeriesVisibility = true;

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

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

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

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

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

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

            var datas = new ObservableArrayList();
            datas.Add(new ChartDataPoint("Jan", 35, 17));
            datas.Add(new ChartDataPoint("Feb", 42, -11));
            datas.Add(new ChartDataPoint("Mar", 25, 5));
            datas.Add(new ChartDataPoint("Apr", 32, 10));
            datas.Add(new ChartDataPoint("May", 20, 3));
            datas.Add(new ChartDataPoint("Jun", 41, 30));

            var series = new RangeColumnSeries
            {
                DataSource = datas,
            };

            series.DataMarker.ShowLabel = true;
            chart.Series.Add(series);

            return chart;
        }
示例#5
0
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);

            chart.PrimaryAxis = new CategoryAxis { ShowMajorGridLines = false, PlotOffset = 20 };
            chart.SecondaryAxis = new NumericalAxis() { ShowMajorGridLines = false, PlotOffset = 20 };

            var datas = new ObservableArrayList();
            datas.Add(new ChartDataPoint("2005", 54));
            datas.Add(new ChartDataPoint("2006", 34));
            datas.Add(new ChartDataPoint("2007", 53));
            datas.Add(new ChartDataPoint("2008", 63));
            datas.Add(new ChartDataPoint("2009", 35));
            datas.Add(new ChartDataPoint("2010", 27));
            datas.Add(new ChartDataPoint("2011", 13));
            datas.Add(new ChartDataPoint("2012", 40));
            datas.Add(new ChartDataPoint("2013", 25));

            var scatterSeries = new ScatterSeries
            {
                DataSource = datas,
                ScatterHeight = 20,
                ScatterWidth = 20
            };
            
            scatterSeries.DataMarker.ShowLabel = true;
            chart.Series.Add(scatterSeries);

            return chart;
       }    
示例#6
0
        public override View GetSampleContent(Context context)
        {
            chart = new SfChart(context);
            chart.SetBackgroundColor(Color.White);
            chart.Legend.Visibility = Visibility.Visible;

            var funnelSeries = new FunnelSeries { DataSource = MainPage.GetTriangularData() };

            funnelSeries.DataMarker.ShowLabel = true;

            chart.Series.Add(funnelSeries);
            return chart;
        }
示例#7
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);
            chart.PrimaryAxis = new CategoryAxis();
            chart.SecondaryAxis = new NumericalAxis();

            chart.Series.Add(new HiLoOpenCloseSeries
            {
                StrokeWidth = 5,
                DataSource = MainPage.GetFinancialData(),
            });
            return chart;
        }
示例#8
0
 public override View GetSampleContent(Context context)
  {
      var chart = new SfChart(context);;
      chart.SetBackgroundColor(Color.White);
      chart.PrimaryAxis = new CategoryAxis();
      chart.SecondaryAxis = new NumericalAxis {Interval = 20, EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift};
      var series = new BarSeries
      {
          DataSource = MainPage.GetData1(),
      };
      series.DataMarker.ShowLabel = true;
      chart.Series.Add(series);
      return chart;
  }
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context); ;
            chart.SetBackgroundColor(Color.White);
            chart.Title.Text = "Average temperature for the year 2014";
            chart.Title.SetPadding(0, 0, 0, 15);
            
            NumericalStripLine numericalStripLines1 = new NumericalStripLine();
            numericalStripLines1.Start = 28;
            numericalStripLines1.Width = 8;
            numericalStripLines1.Text = "Low Temperature";
            numericalStripLines1.FillColor = Color.ParseColor("#C8D16D");
            numericalStripLines1.LabelStyle.TextSize = 20;

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

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

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

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

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

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

            chart.Series.Add(areaSeries);
            return chart;
        }
示例#10
0
        public override View GetSampleContent(Context context)
        {
            chart = new SfChart(context); ;
            chart.SetBackgroundColor(Color.White);

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

            var series = new LineSeries
            {
                DataSource = MainPage.GetSeriesData1(),
            };
            chart.Series.Add(series);

            series = new LineSeries
            {
                DataSource = MainPage.GetSeriesData2(),
            };
            chart.Series.Add(series);

            series = new LineSeries
            {
                DataSource = MainPage.GetSeriesData3(),
            };        
            chart.Series.Add(series);

            chart.Behaviors.Add(new ChartTrackballBehavior());

            var label = new TextView(context);;
            label.SetPadding(5, 5, 5, 5);
            label.Text = "Press and hold to enable trackball.";

            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;
        }
示例#11
0
        public override View GetSampleContent(Context context)
        {
            chart = new SfChart(context);
            chart.SetBackgroundColor(Color.White);

            chart.PrimaryAxis = new CategoryAxis { PlotOffset = 20 };
            chart.SecondaryAxis = new NumericalAxis();
            var lineSeries = new LineSeries { DataSource = MainPage.GetLineData() };

            lineSeries.DataMarker.ShowLabel = true;
            lineSeries.StrokeWidth = 3;
            lineSeries.DataMarker.LabelStyle.Angle = -45;

            chart.Series.Add(lineSeries);
            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;
        }
示例#14
0
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);

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

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

            series.DataMarker.ShowLabel = true;
            chart.Series.Add(series);
            
            return chart;
        }
示例#15
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);
            chart.PrimaryAxis = new CategoryAxis {PlotOffset = 20};
            chart.SecondaryAxis = new NumericalAxis();

            var series = new SplineSeries
            {
                DataSource = MainPage.GetData1(),
                StrokeWidth = 3,
            };

            series.DataMarker.ShowLabel = true;
            chart.Series.Add(series);

            return chart;
        }
示例#16
0
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);
            chart.PrimaryAxis = new CategoryAxis {PlotOffset = 20};
            chart.SecondaryAxis = new NumericalAxis();

            var areaSeries = new AreaSeries
            {
                StrokeWidth = 5,
                Color = MainPage.ConvertHexaToColor(0x90FEBE17),
                Alpha = 0.5f,
                StrokeColor = MainPage.ConvertHexaToColor(0xFFFEBE17),
                DataSource = MainPage.GetAreaData(),
            };

            chart.Series.Add(areaSeries);
            return chart;
        }
        public override View GetSampleContent(Context context)
        {
            random = new System.Random();
            LoadData();

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

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

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

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

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

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

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

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

            layout.AddView(layoutLabel);
            layout.AddView(chart);
            return layout;
        }
示例#18
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context); ;
            chart.SetBackgroundColor(Color.White);
            chart.PrimaryAxis = new CategoryAxis() { EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift};
            chart.SecondaryAxis = new NumericalAxis();

            var areaSeries = new SplineAreaSeries
            {
				StrokeWidth = 5,
                Color = MainPage.ConvertHexaToColor(0x90FEBE17),
                Alpha = 0.5f,
                StrokeColor = MainPage.ConvertHexaToColor(0xFFFEBE17),
                DataSource = MainPage.GetData2(),
            };

            chart.Series.Add(areaSeries);
            return chart;
        }
示例#19
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);
            chart.SetBackgroundColor(Color.White);
            chart.Title.Text = "Products Growth - 2015";
            chart.Legend.Visibility = Visibility.Visible;

            if (context.Resources.DisplayMetrics.HeightPixels > context.Resources.DisplayMetrics.WidthPixels)
            {
                int padding = (context.Resources.DisplayMetrics.HeightPixels -
                        context.Resources.DisplayMetrics.WidthPixels) / 2;
                chart.SetPadding(0, padding / 2, 0, padding);
                chart.Legend.DockPosition = ChartDock.Bottom;
            }
            else
            {
                int padding = (context.Resources.DisplayMetrics.WidthPixels -
                        context.Resources.DisplayMetrics.HeightPixels) / 2;
                chart.SetPadding(padding, 0, padding, 0);
                chart.Legend.ItemMarginRight = padding / 6;
                chart.Legend.DockPosition = ChartDock.Right;
            }

            var datas = new ObservableArrayList();
            datas.Add(new ChartDataPoint("Product A", 14));
            datas.Add(new ChartDataPoint("Product B", 54));
            datas.Add(new ChartDataPoint("Product C", 23));
            datas.Add(new ChartDataPoint("Product D", 53));
            
            var pieSeries = new PieSeries
            {
                DataSource = datas,
                StartAngle = 180,
                EndAngle = 360,
            };
            pieSeries.DataMarker.ShowLabel = true;
            pieSeries.DataMarker.LabelContent = LabelContent.Percentage;
            pieSeries.DataMarkerPosition = CircularSeriesDataMarkerPosition.Outside;
            chart.Series.Add(pieSeries);
            return chart;
        }
示例#20
0
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.ToggleSeriesVisibility = true;

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

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

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

            chart.PrimaryAxis = new CategoryAxis() { EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift};
            chart.SecondaryAxis = new NumericalAxis {Minimum = 0, Maximum = 170};

            var stackingAreaSeries = new StackingAreaSeries
            {
                StrokeWidth = 5,
                Alpha = 0.5f,
                Color = MainPage.ConvertHexaToColor(0x90FEBE17),
                StrokeColor = MainPage.ConvertHexaToColor(0xFFFEBE17),
                DataSource = MainPage.GetData1(),

            };
            chart.Series.Add(stackingAreaSeries);

            stackingAreaSeries = new StackingAreaSeries
            {
                StrokeWidth = 5,
                Alpha = 0.5f,
                Color = MainPage.ConvertHexaToColor(0x994F4838),
                StrokeColor = MainPage.ConvertHexaToColor(0xFF4F4838),
            };
            chart.Series.Add(stackingAreaSeries);

            stackingAreaSeries = new StackingAreaSeries
            {
                StrokeWidth = 5,
                Alpha = 0.5f,
                Color = MainPage.ConvertHexaToColor(0x99C15146),
                StrokeColor = MainPage.ConvertHexaToColor(0xFFC15146),
            };
            chart.Series.Add(stackingAreaSeries);
            UpdateData();
            return chart;
        }
示例#22
0
        public override View GetSampleContent(Context context)
        {
            LoadData();

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

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

            var lineSeries = new FastLineSeries {DataSource = data};

            chart.Series.Add(lineSeries);

            UpdateData();

            AddSeries();

            return chart;
        }
示例#23
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);
        }
示例#24
0
        public override View GetSampleContent(Context context)
        {
            chart            = new SfChart(context);
            chart.Title.Text = "Oxygen Level";
            chart.SetBackgroundColor(Color.White);

            chart.ColorModel.ColorPalette = ChartColorPalette.Custom;

            ChartGradientColor gradientColor = new ChartGradientColor()
            {
                StartPoint = new PointF(0.5f, 1), EndPoint = new PointF(0.5f, 0)
            };
            ChartGradientStop stopColor1 = new ChartGradientStop()
            {
                Color = Color.White, Offset = 0
            };
            ChartGradientStop stopColor2 = new ChartGradientStop()
            {
                Color = Color.ParseColor("#FF0080DF"), Offset = 1
            };

            gradientColor.GradientStops.Add(stopColor1);
            gradientColor.GradientStops.Add(stopColor2);

            ChartGradientColorCollection gradientColorsCollection = new ChartGradientColorCollection()
            {
                gradientColor
            };

            chart.ColorModel.CustomGradientColors = gradientColorsCollection;

            DateTimeAxis primaryAxis = new DateTimeAxis();

            primaryAxis.PlotOffset             = 6;
            primaryAxis.EdgeLabelsDrawingMode  = EdgeLabelsDrawingMode.Shift;
            primaryAxis.ShowMinorGridLines     = false;
            primaryAxis.ShowMajorGridLines     = false;
            primaryAxis.LabelStyle.LabelFormat = "MMM dd";
            chart.PrimaryAxis = primaryAxis;

            NumericalAxis numericalAxis = new NumericalAxis();

            numericalAxis.Maximum  = 50;
            numericalAxis.Interval = 5;
            numericalAxis.LabelStyle.LabelFormat = "#'%'";
            chart.SecondaryAxis = numericalAxis;

            SplineAreaSeries splineAreaSeries = new SplineAreaSeries();

            splineAreaSeries.ItemsSource                           = MainPage.GetGradientData();
            splineAreaSeries.XBindingPath                          = "Date";
            splineAreaSeries.YBindingPath                          = "High";
            splineAreaSeries.StrokeColor                           = Color.ParseColor("#FF0080DF");
            splineAreaSeries.StrokeWidth                           = 2;
            splineAreaSeries.DataMarker.ShowLabel                  = true;
            splineAreaSeries.DataMarker.MarkerWidth                = 8;
            splineAreaSeries.DataMarker.MarkerHeight               = 8;
            splineAreaSeries.DataMarker.MarkerColor                = Color.White;
            splineAreaSeries.DataMarker.MarkerStrokeColor          = Color.ParseColor("#FF0080DF");
            splineAreaSeries.DataMarker.MarkerStrokeWidth          = 2;
            splineAreaSeries.DataMarker.ShowMarker                 = true;
            splineAreaSeries.DataMarker.LabelStyle.OffsetY         = -10;
            splineAreaSeries.DataMarker.LabelStyle.BackgroundColor = Color.ParseColor("#FF0080DF");
            splineAreaSeries.DataMarker.LabelStyle.LabelFormat     = "#.#'%'";

            chart.Series.Add(splineAreaSeries);
            return(chart);
        }
示例#25
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);
        }
示例#26
0
        public override View GetSampleContent(Context context)
        {
            chart = new SfChart(context);
            chart.SetBackgroundColor(Color.White);
            chart.Title.Text = "Average sales for person";

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

            DateTimeAxis primaryAxis = new DateTimeAxis();

            primaryAxis.PlotOffset               = 5;
            primaryAxis.AxisLineOffset           = 5;
            primaryAxis.ShowMajorGridLines       = false;
            primaryAxis.Interval                 = 1;
            primaryAxis.EdgeLabelsDrawingMode    = EdgeLabelsDrawingMode.Shift;
            primaryAxis.EdgeLabelsVisibilityMode = EdgeLabelsVisibilityMode.Visible;
            primaryAxis.LabelStyle.LabelFormat   = "yyyy";
            chart.PrimaryAxis = primaryAxis;
            chart.PrimaryAxis.ShowMajorGridLines = false;
            chart.SecondaryAxis = new NumericalAxis {
            };

            chart.SecondaryAxis.MajorTickStyle.TickSize     = 0;
            chart.SecondaryAxis.LineStyle.StrokeWidth       = 0;
            (chart.SecondaryAxis as NumericalAxis).Maximum  = 80;
            (chart.SecondaryAxis as NumericalAxis).Minimum  = 10;
            (chart.SecondaryAxis as NumericalAxis).Interval = 10;
            chart.SecondaryAxis.Title.Text             = "Revenue";
            chart.SecondaryAxis.LabelStyle.LabelFormat = "#'M '";

            var series = new LineSeries
            {
                ItemsSource  = MainPage.GetSeriesData1(),
                XBindingPath = "Date",
                YBindingPath = "YValue",
                Label        = "John",
                Color        = Color.ParseColor("#00BDAE"),
                StrokeWidth  = 3
            };

            series.DataMarker.MarkerStrokeColor = Color.ParseColor("#00BDAE");
            series.DataMarker.ShowMarker        = true;
            series.DataMarker.MarkerColor       = Color.White;
            series.DataMarker.MarkerStrokeWidth = 2;
            series.DataMarker.MarkerWidth       = 6;
            series.DataMarker.MarkerHeight      = 6;
            chart.Series.Add(series);

            series = new LineSeries
            {
                ItemsSource  = MainPage.GetSeriesData2(),
                XBindingPath = "Date",
                YBindingPath = "YValue",
                Color        = Color.ParseColor("#404041"),
                Label        = "Andrew",
                StrokeWidth  = 3
            };
            series.DataMarker.MarkerStrokeColor = Color.ParseColor("#404041");
            series.DataMarker.ShowMarker        = true;
            series.DataMarker.MarkerColor       = Color.White;
            series.DataMarker.MarkerStrokeWidth = 2;
            series.DataMarker.MarkerWidth       = 6;
            series.DataMarker.MarkerHeight      = 6;
            chart.Series.Add(series);

            series = new LineSeries
            {
                ItemsSource  = MainPage.GetSeriesData3(),
                XBindingPath = "Date",
                YBindingPath = "YValue",
                Color        = Color.ParseColor("#357CD2"),
                Label        = "Thomas",
                StrokeWidth  = 3
            };
            series.DataMarker.MarkerStrokeColor = Color.ParseColor("#357CD2");
            series.DataMarker.ShowMarker        = true;
            series.DataMarker.MarkerColor       = Color.White;
            series.DataMarker.MarkerStrokeWidth = 2;
            series.DataMarker.MarkerWidth       = 6;
            series.DataMarker.MarkerHeight      = 6;
            chart.Series.Add(series);

            chart.Behaviors.Add(new ChartTrackballBehavior());

            var label = new TextView(context);

            label.SetPadding(5, 5, 5, 5);
            label.Text = "Press and hold to enable trackball.";

            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);
        }
示例#27
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);
        }
示例#28
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text     = "Average Sales Comparison";
            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;

            NumericalAxis categoryaxis = new NumericalAxis();

            categoryaxis.Minimum  = 2000;
            categoryaxis.Maximum  = 2005;
            categoryaxis.Interval = 1;
            categoryaxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            categoryaxis.Title.Text            = "Year";
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.Minimum                = 2;
            numericalaxis.Maximum                = 5;
            numericalaxis.Interval               = 1;
            numericalaxis.Title.Text             = "Revenue in Millions";
            numericalaxis.LabelStyle.LabelFormat = "#'M '";
            chart.SecondaryAxis = numericalaxis;

            var areaSeries1 = new AreaSeries
            {
                Label           = "Product A",
                Alpha           = 0.5f,
                EnableAnimation = true,
                ItemsSource     = MainPage.GetAreaData1(),
                XBindingPath    = "XValue",
                YBindingPath    = "YValue",
                LegendIcon      = ChartLegendIcon.SeriesType
            };
            var areaSeries2 = new AreaSeries
            {
                Label           = "Product B",
                Alpha           = 0.5f,
                EnableAnimation = true,
                ItemsSource     = MainPage.GetAreaData2(),
                XBindingPath    = "XValue",
                YBindingPath    = "YValue",
                LegendIcon      = ChartLegendIcon.SeriesType
            };

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

            areaSeries1.TooltipEnabled  = true;
            areaSeries2.TooltipEnabled  = true;
            areaSeries1.EnableAnimation = true;
            areaSeries2.EnableAnimation = true;

            return(chart);
        }
示例#29
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.Title.Text     = "Height vs Weight";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);
            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;

            NumericalAxis primariyAxis = new NumericalAxis();

            primariyAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            primariyAxis.ShowMajorGridLines    = false;
            primariyAxis.Minimum    = 100;
            primariyAxis.Maximum    = 220;
            primariyAxis.Interval   = 20;
            primariyAxis.Title.Text = "Height in Inches";
            chart.PrimaryAxis       = primariyAxis;

            NumericalAxis secondaryAxis = new NumericalAxis();

            secondaryAxis.ShowMajorGridLines = false;
            secondaryAxis.Minimum            = 50;
            secondaryAxis.Maximum            = 80;
            secondaryAxis.Interval           = 5;
            secondaryAxis.Title.Text         = "Weight in Pounds";
            chart.SecondaryAxis = secondaryAxis;

            scatter                 = new ScatterSeries();
            scatter.Alpha           = 0.7f;
            scatter.ScatterWidth    = 12;
            scatter.ScatterHeight   = 12;
            scatter.ItemsSource     = MainPage.GetScatterMaleData();
            scatter.XBindingPath    = "XValue";
            scatter.YBindingPath    = "YValue";
            scatter.Label           = "Male";
            scatter.LegendIcon      = ChartLegendIcon.SeriesType;
            scatter.TooltipEnabled  = true;
            scatter.EnableAnimation = true;

            ScatterSeries scatter1 = new ScatterSeries();

            scatter1.Alpha           = 0.7f;
            scatter1.ScatterWidth    = 12;
            scatter1.ScatterHeight   = 12;
            scatter1.ShapeType       = ChartScatterShapeType.Diamond;
            scatter1.ItemsSource     = MainPage.GetScatterFemaleData();
            scatter1.XBindingPath    = "XValue";
            scatter1.YBindingPath    = "YValue";
            scatter1.Label           = "Female";
            scatter1.LegendIcon      = ChartLegendIcon.SeriesType;
            scatter1.EnableAnimation = true;
            scatter1.TooltipEnabled  = true;

            chart.Series.Add(scatter);
            chart.Series.Add(scatter1);

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

            chart.TooltipCreated += Chart_TooltipCreated;
            return(chart);
        }
示例#30
0
        void Chart_LegendItemCreated(object sender, ChartLegendItemCreatedEventArgs e)
        {
            MultipleCircleModel datamodel = e.LegendItem.DataPoint as MultipleCircleModel;

            LinearLayout outerLayout = new LinearLayout(chart.Context);

            outerLayout.Orientation = Orientation.Horizontal;
            outerLayout.SetBackgroundColor(Color.Transparent);

            LinearLayout innerLayout = new LinearLayout(chart.Context);

            innerLayout.Orientation = Orientation.Vertical;
            innerLayout.SetPadding(3, 30, 3, 0);
            innerLayout.SetBackgroundColor(Color.Transparent);

            TextView loanName    = new TextView(chart.Context);
            TextView loanPercent = new TextView(chart.Context);

            ImageView centerView = new ImageView(chart.Context);

            centerView.LayoutParameters = new ViewGroup.LayoutParams(new LinearLayout.LayoutParams((int)(40 * density), (int)(40 * density)));
            centerView.SetImageResource(datamodel.ImageResId);

            loanPercent.Text          = (e.LegendItem.DataPoint as MultipleCircleModel).YValue + "%";
            loanPercent.TextAlignment = Android.Views.TextAlignment.Center;
            loanPercent.Gravity       = GravityFlags.Center;
            loanPercent.SetTextColor(e.LegendItem.IconColor);
            loanPercent.TextSize = 15;

            loanName.Text          = (e.LegendItem.DataPoint as MultipleCircleModel).XValue;
            loanName.TextAlignment = Android.Views.TextAlignment.Center;
            loanName.Gravity       = GravityFlags.Center;
            loanName.SetTextColor(Color.Black);
            innerLayout.AddView(loanPercent);
            innerLayout.AddView(loanName);

            SfChart sfChart = new SfChart(chart.Context);

            sfChart.LayoutParameters = new ViewGroup.LayoutParams(new LinearLayout.LayoutParams((int)(65 * density), (int)(65 * density)));
            sfChart.SetBackgroundColor(Color.White);

            DoughnutSeries series = new DoughnutSeries();

            series.Color       = e.LegendItem.IconColor;
            series.ItemsSource = new ObservableCollection <MultipleCircleModel>()
            {
                datamodel
            };
            series.XBindingPath        = "XValue";
            series.YBindingPath        = "YValue";
            series.StartAngle          = -90;
            series.EndAngle            = 270;
            series.MaximumValue        = 100;
            series.Spacing             = 0.4;
            series.DoughnutCoefficient = 0.6;
            series.CircularCoefficient = 0.9;
            series.CapStyle            = DoughnutCapStyle.BothCurve;
            series.IsStackedDoughnut   = true;
            series.CenterView          = centerView;
            sfChart.Series.Add(series);

            outerLayout.AddView(sfChart);
            outerLayout.AddView(innerLayout);
            e.LegendItem.View = outerLayout;
        }
        public override View GetSampleContent(Context context)
        {
            chart = new SfChart(context);
            chart.SetBackgroundColor(Color.White);
            chart.AreaBackgroundColor = Color.Rgb(245, 245, 245);

            NumericalAxis categoryaxis = new NumericalAxis();

            categoryaxis.ShowMajorGridLines    = false;
            categoryaxis.Minimum               = 0;
            categoryaxis.Maximum               = 4;
            categoryaxis.LineStyle.StrokeColor = Color.White;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.ShowMajorGridLines    = false;
            numericalaxis.Minimum               = 20;
            numericalaxis.Maximum               = 70;
            numericalaxis.LineStyle.StrokeColor = Color.White;
            chart.SecondaryAxis = numericalaxis;

            LineAnnotation lineAnnotation = new LineAnnotation();

            lineAnnotation.Text = "Line";
            lineAnnotation.X1   = 2.5;
            lineAnnotation.X2   = 3.5;
            lineAnnotation.Y1   = 52;
            lineAnnotation.Y2   = 63;
            lineAnnotation.LabelStyle.MarginTop    = 5;
            lineAnnotation.LabelStyle.MarginRight  = 5;
            lineAnnotation.LabelStyle.MarginLeft   = 5;
            lineAnnotation.LabelStyle.MarginBottom = 5;
            lineAnnotation.LineCap = ChartLineCap.Arrow;

            HorizontalLineAnnotation horizontalAnnotation = new HorizontalLineAnnotation();

            horizontalAnnotation.Y1            = 45;
            horizontalAnnotation.Text          = "Horizontal Line";
            horizontalAnnotation.LineCap       = ChartLineCap.Arrow;
            horizontalAnnotation.ShowAxisLabel = true;

            VerticalLineAnnotation verticalAnnotation = new VerticalLineAnnotation();

            verticalAnnotation.X1            = 2;
            verticalAnnotation.Text          = "Vertical Line";
            verticalAnnotation.LineCap       = ChartLineCap.Arrow;
            verticalAnnotation.ShowAxisLabel = true;

            RectangleAnnotation RectAnnotation = new RectangleAnnotation();

            RectAnnotation.X1   = 0.5;
            RectAnnotation.X2   = 1.5;
            RectAnnotation.Y1   = 25;
            RectAnnotation.Y2   = 35;
            RectAnnotation.Text = "Rectangle";

            EllipseAnnotation eleAnnotation = new EllipseAnnotation();

            eleAnnotation.X1   = 2.5;
            eleAnnotation.X2   = 3.5;
            eleAnnotation.Y1   = 25;
            eleAnnotation.Y2   = 35;
            eleAnnotation.Text = "Ellipse";

            TextAnnotation textAnnotation = new TextAnnotation();

            textAnnotation.X1   = 1;
            textAnnotation.Y1   = 57.5;
            textAnnotation.Text = "Text Annotation";

            chart.Annotations.Add(textAnnotation);
            chart.Annotations.Add(eleAnnotation);
            chart.Annotations.Add(RectAnnotation);
            chart.Annotations.Add(verticalAnnotation);
            chart.Annotations.Add(horizontalAnnotation);
            chart.Annotations.Add(lineAnnotation);
            return(chart);
        }
示例#32
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);
        }
示例#33
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "Unemployment Rates 1975-2010";
            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;

            NumericalAxis numericalAxis = new NumericalAxis();

            numericalAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            numericalAxis.Minimum                 = 1975;
            numericalAxis.Maximum                 = 2010;
            numericalAxis.Interval                = 5;
            numericalAxis.ShowMajorGridLines      = false;
            numericalAxis.PlotOffset              = 10;
            numericalAxis.AxisLineOffset          = 10;
            numericalAxis.MajorTickStyle.TickSize = 10;
            chart.PrimaryAxis = numericalAxis;

            NumericalAxis numericalaxis = new NumericalAxis();

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

            StepLineSeries stepLineSeries1 = new StepLineSeries();

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

            StepLineSeries stepLineSeries2 = new StepLineSeries();

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

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

            chart.Series.Add(stepLineSeries1);
            chart.Series.Add(stepLineSeries2);
            return(chart);
        }
示例#34
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);
        }
示例#35
0
        public override View GetSampleContent(Context context)
        {
            chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);

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

            chart.PrimaryAxis                    = new CategoryAxis();
            chart.PrimaryAxis.PlotOffset         = 5;
            chart.PrimaryAxis.AxisLineOffset     = 2;
            chart.PrimaryAxis.ShowMajorGridLines = false;
            chart.SecondaryAxis                  = new NumericalAxis {
            };

            chart.SecondaryAxis.MajorTickStyle.TickSize    = 0;
            chart.SecondaryAxis.LineStyle.StrokeWidth      = 0;
            (chart.SecondaryAxis as NumericalAxis).Maximum = 50;
            (chart.SecondaryAxis as NumericalAxis).Minimum = 25;

            var series = new LineSeries
            {
                ItemsSource  = MainPage.GetSeriesData1(),
                XBindingPath = "XValue",
                YBindingPath = "YValue",
                Label        = "Germany",
                Color        = Color.ParseColor("#00BDAE"),
                StrokeWidth  = 3
            };

            series.DataMarker.MarkerColor       = Color.ParseColor("#00BDAE");
            series.DataMarker.ShowMarker        = true;
            series.DataMarker.MarkerStrokeColor = Color.White;
            series.DataMarker.MarkerStrokeWidth = 2;
            series.DataMarker.MarkerWidth       = 10;
            series.DataMarker.MarkerHeight      = 10;
            chart.Series.Add(series);

            series = new LineSeries
            {
                ItemsSource  = MainPage.GetSeriesData2(),
                XBindingPath = "XValue",
                YBindingPath = "YValue",
                Color        = Color.ParseColor("#404041"),
                Label        = "England",
                StrokeWidth  = 3
            };
            series.DataMarker.MarkerColor       = Color.ParseColor("#404041");
            series.DataMarker.ShowMarker        = true;
            series.DataMarker.MarkerStrokeColor = Color.White;
            series.DataMarker.MarkerStrokeWidth = 2;
            series.DataMarker.MarkerWidth       = 10;
            series.DataMarker.MarkerHeight      = 10;
            chart.Series.Add(series);

            series = new LineSeries
            {
                ItemsSource  = MainPage.GetSeriesData3(),
                XBindingPath = "XValue",
                YBindingPath = "YValue",
                Color        = Color.ParseColor("#357CD2"),
                Label        = "France",
                StrokeWidth  = 3
            };
            series.DataMarker.MarkerColor       = Color.ParseColor("#357CD2");
            series.DataMarker.ShowMarker        = true;
            series.DataMarker.MarkerStrokeColor = Color.White;
            series.DataMarker.MarkerStrokeWidth = 2;
            series.DataMarker.MarkerWidth       = 10;
            series.DataMarker.MarkerHeight      = 10;
            chart.Series.Add(series);

            chart.Behaviors.Add(new CustomTrackballBehavior());

            var label = new TextView(context);;

            label.SetPadding(5, 5, 5, 5);
            label.Text = "Press and hold to enable trackball.";

            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);
        }
示例#36
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  = "##.##" + (char)0x00B0 + "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);
        }
示例#37
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);
        }
        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);
        }
示例#39
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);
        }
        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);
        }
示例#41
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text     = "Weather Report";
            chart.Title.TextSize = 15;

            NumericalStripLine numericalStripLines1 = new NumericalStripLine();

            numericalStripLines1.Start = 10;
            numericalStripLines1.Width = 10;
            numericalStripLines1.Text  = "Low Temperature";
            numericalStripLines1.LabelStyle.TextSize = 12;
            numericalStripLines1.FillColor           = Color.ParseColor("#f9d423");

            NumericalStripLine numericalStripLines2 = new NumericalStripLine();

            numericalStripLines2.Start = 20;
            numericalStripLines2.Width = 10;
            numericalStripLines2.Text  = "Average Temperature";
            numericalStripLines2.LabelStyle.TextSize = 12;
            numericalStripLines2.FillColor           = Color.ParseColor("#fc902a");

            NumericalStripLine numericalStripLines3 = new NumericalStripLine();

            numericalStripLines3.Start = 30;
            numericalStripLines3.Width = 10;
            numericalStripLines3.Text  = "High Temperature";
            numericalStripLines3.LabelStyle.TextSize = 12;
            numericalStripLines3.FillColor           = Color.ParseColor("#ff512f");

            NumericalAxis numericalAxis = new NumericalAxis();

            numericalAxis.Minimum = 10;
            numericalAxis.Maximum = 40;
            numericalAxis.LabelStyle.LabelFormat = "##.##°C";

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

            chart.PrimaryAxis = new CategoryAxis();
            (chart.PrimaryAxis as CategoryAxis).LabelPlacement = LabelPlacement.BetweenTicks;
            chart.SecondaryAxis = numericalAxis;

            var lineSeries = new LineSeries
            {
                StrokeWidth  = 2,
                ItemsSource  = MainPage.GetStripLineData(),
                XBindingPath = "XValue",
                YBindingPath = "YValue",
                Color        = Color.White
            };

            chart.Series.Add(lineSeries);

            ChartTooltipBehavior toolTip = new ChartTooltipBehavior();

            toolTip.TextColor = Color.Black;
            chart.Behaviors.Add(toolTip);

            lineSeries.DataMarker.ShowLabel         = false;
            lineSeries.DataMarker.ShowMarker        = true;
            lineSeries.DataMarker.MarkerWidth       = 10;
            lineSeries.DataMarker.MarkerHeight      = 10;
            lineSeries.DataMarker.MarkerColor       = Color.ParseColor("#666666");
            lineSeries.DataMarker.MarkerStrokeColor = Color.ParseColor("#ffffff");
            lineSeries.DataMarker.MarkerStrokeWidth = 4;
            lineSeries.TooltipEnabled = true;
            return(chart);
        }
示例#42
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);
        }
示例#43
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);
        }
示例#44
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.Title.Text     = "Height vs Weight";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);
            chart.ColorModel.ColorPalette = ChartColorPalette.Natural;

            NumericalAxis primariyAxis = new NumericalAxis();

            primariyAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            primariyAxis.ShowMajorGridLines    = false;
            primariyAxis.Minimum    = 100;
            primariyAxis.Maximum    = 220;
            primariyAxis.Interval   = 20;
            primariyAxis.Title.Text = "Height in Inches";
            chart.PrimaryAxis       = primariyAxis;

            NumericalAxis secondaryAxis = new NumericalAxis();

            secondaryAxis.ShowMajorGridLines = false;
            secondaryAxis.Minimum            = 50;
            secondaryAxis.Maximum            = 80;
            secondaryAxis.Interval           = 5;
            secondaryAxis.Title.Text         = "Weight in Pounds";
            chart.SecondaryAxis = secondaryAxis;

            ScatterSeries scatter = new ScatterSeries();

            scatter.Alpha           = 0.7f;
            scatter.ScatterWidth    = 12;
            scatter.ScatterHeight   = 12;
            scatter.ItemsSource     = MainPage.GetScatterMaleData();
            scatter.XBindingPath    = "XValue";
            scatter.YBindingPath    = "YValue";
            scatter.Label           = "Male";
            scatter.LegendIcon      = ChartLegendIcon.SeriesType;
            scatter.EnableAnimation = true;

            ScatterSeries scatter1 = new ScatterSeries();

            scatter1.Alpha           = 0.7f;
            scatter1.ScatterWidth    = 12;
            scatter1.ScatterHeight   = 12;
            scatter1.ShapeType       = ChartScatterShapeType.Diamond;
            scatter1.ItemsSource     = MainPage.GetScatterFemaleData();
            scatter1.XBindingPath    = "XValue";
            scatter1.YBindingPath    = "YValue";
            scatter1.Label           = "Female";
            scatter1.LegendIcon      = ChartLegendIcon.SeriesType;
            scatter1.EnableAnimation = true;

            chart.Series.Add(scatter);
            chart.Series.Add(scatter1);

            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);
        }
示例#45
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);
        }
示例#46
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);
        }
示例#47
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);
        }
示例#48
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.Title.Text     = "Project Cost Breakdown";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.Visibility             = Visibility.Visible;
            chart.Legend.DockPosition           = ChartDock.Bottom;
            chart.Legend.ToggleSeriesVisibility = true;
            chart.Legend.OverflowMode           = ChartLegendOverflowMode.Wrap;
            chart.Legend.IconHeight             = 14;
            chart.Legend.IconWidth = 14;

            DoughnutSeries doughnutSeries = new DoughnutSeries();

            doughnutSeries.DataPointSelectionEnabled = true;
            doughnutSeries.ColorModel.ColorPalette   = ChartColorPalette.Natural;
            doughnutSeries.ExplodableOnTouch         = true;
            doughnutSeries.ItemsSource          = MainPage.GetDoughnutData();
            doughnutSeries.XBindingPath         = "XValue";
            doughnutSeries.YBindingPath         = "YValue";
            doughnutSeries.DataMarker.ShowLabel = true;
            doughnutSeries.DataMarker.LabelStyle.LabelFormat = "#.##'M'";
            doughnutSeries.EnableAnimation = true;
            chart.Series.Add(doughnutSeries);

            LinearLayout layout = new LinearLayout(context);

            layout.Orientation = Orientation.Vertical;
            TextView label = new TextView(context);

            label.Gravity       = GravityFlags.Center;
            label.TextAlignment = Android.Views.TextAlignment.Center;
            label.Text          = "Tap on slice";
            TextView label1 = new TextView(context);

            label1.Gravity       = GravityFlags.Center;
            label1.TextAlignment = Android.Views.TextAlignment.Center;
            layout.AddView(label);
            layout.AddView(label1);
            doughnutSeries.CenterView = layout;

            chart.SelectionChanging += (object sender, SfChart.SelectionChangingEventArgs e) =>
            {
                if (doughnutSeries.ExplodeIndex >= 0)
                {
                    var    datapoints = e.P1.SelectedSeries.ItemsSource as List <DataPoint>;
                    var    datapoint  = datapoints[e.P1.SelectedDataPointIndex].YValue;
                    double total      = 0;

                    for (int i = 0; i < datapoints.Count; i++)
                    {
                        total = total + (double)datapoints[i].YValue;
                    }

                    double percentageValue = ((double)datapoint / total) * 100;
                    string percentage      = percentageValue.ToString("N2") + "%";

                    label.Text = percentage;
                    var segments = e.P1.SelectedSeries.Segments;
                    label.SetTextColor(segments[e.P1.SelectedDataPointIndex].Color);
                    label1.Text    = datapoints[e.P1.SelectedDataPointIndex].XValue.ToString();
                    label.TextSize = 19;

                    doughnutSeries.CenterView = layout;
                    e.P1.Cancel = true;
                }
                else
                {
                    label1.Text    = string.Empty;
                    label.Text     = "Tap on slice";
                    label.TextSize = 13;
                    label.SetTextColor(label1.TextColors);
                    doughnutSeries.CenterView = layout;
                    e.P1.Cancel = true;
                }
            };

            return(chart);
        }
示例#49
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.SetBackgroundColor(Color.White);
            chart.Title.Text     = "Inflation Rate in Percentage";
            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;

            NumericalAxis primaryAxis = new NumericalAxis();

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

            NumericalAxis numericalaxis = new NumericalAxis();

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

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

            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);
        }
       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;
        }
示例#51
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);
        }
        //---------------------------------------------------------------------------------------------------------------------------------------------------

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            //Element from the layout.
            SfChart Graph = new SfChart(Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity);

            //Axes settings.
            CategoryAxis  AxeX = new CategoryAxis();
            NumericalAxis AxeY = new NumericalAxis();

            Graph.PrimaryAxis   = AxeX;
            Graph.SecondaryAxis = AxeY;

            AxeX.LabelRotationAngle   = 315;
            AxeX.LabelStyle.TextColor = Android.Graphics.Color.Black;
            AxeY.LabelStyle.TextColor = Android.Graphics.Color.Black;

            AxeX.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;

            //Graph settings.
            Graph.SetBackgroundColor(Android.Graphics.Color.DarkGreen);

            ChartZoomPanBehavior Zoom = new ChartZoomPanBehavior();

            Graph.Behaviors.Add(Zoom);

            ObservableArrayList ListForData = new ObservableArrayList();

            //If the user is choosed.
            if (Classes.User.CurrentUser != -1)
            {
                //Getting parameters of currrent user from DB.
                int k = 1;
                foreach (ParametresOfUser TempParametres in DatabaseUser.GetUser(User.CurrentUser).Parameters)
                {
                    ListForData.Add(new ChartDataPoint(TempParametres.EntryDate.ToShortDateString(), TempParametres.Weight));
                }

                //Setting data to the list
                SplineSeries Seria = new SplineSeries();
                Seria.DataSource = ListForData;

                //Settings oof lables.
                Seria.DataMarker.ShowMarker  = true;
                Seria.DataMarker.ShowLabel   = true;
                Seria.DataMarker.MarkerColor = Android.Graphics.Color.Yellow;
                Seria.DataMarker.ConnectorLineStyle.ConnectorHeight        = 50;
                Seria.DataMarker.ConnectorLineStyle.ConnectorRotationAngle = 175;
                Seria.DataMarker.ConnectorLineStyle.PathEffect             = new DashPathEffect(new float[] { 3, 3 }, 3);

                //Adding graph to form.
                Graph.Series.Add(Seria);
            }

            //If the user isn't choosed.
            else
            {
                HelpclassDataValidation.MakingErrorToast(Resource.String.ErrorMessage_Unchoosed);
            }

            return(Graph);
        }
示例#53
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.Title.Text = "Food Production - 2017";
            chart.SetBackgroundColor(Color.White);
            chart.Scroll += (sender, e) =>
            {
                month = int.MaxValue;
            };

            DateTimeAxis dateTimeAxis = new DateTimeAxis();

            dateTimeAxis.Title.Text    = "Production Across Years";
            dateTimeAxis.ZoomFactor    = 0.2f;
            dateTimeAxis.ZoomPosition  = 0.6f;
            dateTimeAxis.LabelCreated += (sender, e) =>
            {
                var date = DateTime.Parse(e.AxisLabel.LabelContent.ToString());
                if (date.Month != month)
                {
                    ChartAxisLabelStyle labelStyle = new ChartAxisLabelStyle();
                    labelStyle.LabelFormat = "MMM-dd";
                    labelStyle.TextSize    = 9;
                    labelStyle.Typeface    = Typeface.DefaultBold;
                    e.AxisLabel.LabelStyle = labelStyle;
                    month = date.Month;
                }
                else
                {
                    ChartAxisLabelStyle labelStyle = new ChartAxisLabelStyle();
                    labelStyle.LabelFormat = "dd";
                    e.AxisLabel.LabelStyle = labelStyle;
                }
            };
            dateTimeAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
            chart.PrimaryAxis = dateTimeAxis;

            var numericalAxis = new NumericalAxis();

            numericalAxis.Title.Text = "Growth (In Metric Tons)";
            chart.SecondaryAxis      = numericalAxis;

            FastLineSeries lineSeries = new FastLineSeries();

            lineSeries.ColorModel.ColorPalette = ChartColorPalette.Natural;
            lineSeries.ItemsSource             = Data.GetDateTimeValue();
            lineSeries.XBindingPath            = "Date";
            lineSeries.YBindingPath            = "YValue";
            lineSeries.TooltipEnabled          = true;
            chart.Series.Add(lineSeries);

            ChartZoomPanBehavior zoomPan = new ChartZoomPanBehavior();

            zoomPan.SelectionZoomingEnabled = false;
            zoomPan.ZoomMode = ZoomMode.X;

            chart.Behaviors.Add(zoomPan);

            return(chart);
        }
示例#54
-1
       public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.Visibility = Visibility.Visible;

            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 doughnutSeries = new DoughnutSeries
            {
                ExplodeIndex = 3,
                DataSource = datas,
                DataMarkerPosition = CircularSeriesDataMarkerPosition.OutsideExtended,
            };

            doughnutSeries.DataMarker.ShowLabel = true;
            doughnutSeries.ConnectorType = ConnectorType.Bezier;

            chart.Series.Add(doughnutSeries);
            return chart;
        }
示例#55
-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;
        }