Ejemplo n.º 1
0
        public override View GetSampleContent(Context context)
        {
            chart = new SfChart(context);
            chart.Title.Text = "Olympic Medal Counts";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);

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

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

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

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

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

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

            return chart;
        }
Ejemplo n.º 2
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);
        }