Пример #1
0
        public override View GetSampleContent(Context context)
        {
            chart                = new SfChart(context);
            chart.Title.Text     = "UK Trade in Food Groups - 2015";
            chart.Title.TextSize = 15;
            chart.SetBackgroundColor(Color.White);
            chart.Legend.Visibility             = Visibility.Visible;
            chart.Legend.DockPosition           = ChartDock.Bottom;
            chart.Legend.IconHeight             = 14;
            chart.Legend.IconWidth              = 14;
            chart.Legend.ToggleSeriesVisibility = true;
            chart.ColorModel.ColorPalette       = ChartColorPalette.Natural;

            CategoryAxis categoryaxis = new CategoryAxis();

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

            NumericalAxis numericalaxis = new NumericalAxis();

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

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

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

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

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

            NumericalAxis categoryaxis = new NumericalAxis();

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

            NumericalAxis numericalaxis = new NumericalAxis();

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

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

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

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

            return(chart);
        }