Esempio n. 1
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
            {
                ShowMajorGridLines    = false,
                Interval              = 20,
                RangePadding          = NumericalPadding.Round,
                EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift
            };

            var series = new StackingBar100Series
            {
                DataSource         = MainPage.GetData1(),
                DataMarkerPosition = DataMarkerPosition.Center,
            };

            series.DataMarker.ShowLabel = true;
            series.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Center;
            chart.Series.Add(series);

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

            series = new StackingBar100Series
            {
                DataSource         = MainPage.GetData3(),
                DataMarkerPosition = DataMarkerPosition.Center,
            };
            series.DataMarker.ShowLabel = true;
            series.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Center;
            chart.Series.Add(series);
            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,
                Interval = 20,
                RangePadding = NumericalPadding.Round,
                EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift
            };

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

            series = new StackingBar100Series
            {

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

                DataSource = MainPage.GetData3(),
                DataMarkerPosition = DataMarkerPosition.Center,
            };
            series.DataMarker.ShowLabel = true;
            series.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Center;
            chart.Series.Add(series);
            return chart;
        }
        private void CreateSeries(object newValue)
        {
            StackingBar100Series stackingBar100Series = new StackingBar100Series()
            {
                ItemsSource = new List <PriceData> {
                    newValue as PriceData
                },
                XBindingPath = XBindingPath,
                YBindingPath = YBindingPath,
                Width        = 0.7,
            };

            stackingBar100Series.DataMarker                          = new ChartDataMarker();
            stackingBar100Series.DataMarker.ShowLabel                = true;
            stackingBar100Series.DataMarker.LabelStyle.TextColor     = Color.White;
            stackingBar100Series.DataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Center;
            stackingBar100Series.DataMarkerPosition                  = DataMarkerPosition.Center;
            Series.Add(stackingBar100Series);
        }
Esempio n. 4
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);

            chart.SetBackgroundColor(Color.White);
            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 categoryAxis = new CategoryAxis();

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

            NumericalAxis numericalAxis = new NumericalAxis();

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

            StackingBar100Series stackingBar100Series = new StackingBar100Series();

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

            StackingBar100Series stackingBar100Series1 = new StackingBar100Series();

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

            StackingBar100Series stackingBar100Series2 = new StackingBar100Series();

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

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

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

            stackingBar100Series.EnableAnimation  = true;
            stackingBar100Series1.EnableAnimation = true;
            stackingBar100Series2.EnableAnimation = true;
            return(chart);
        }
Esempio n. 5
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;

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

            CategoryAxis categoryAxis = new CategoryAxis();

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

            NumericalAxis numericalAxis = new NumericalAxis();

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

            StackingBar100Series stackingBar100Series = new StackingBar100Series();

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

            StackingBar100Series stackingBar100Series1 = new StackingBar100Series();

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

            StackingBar100Series stackingBar100Series2 = new StackingBar100Series();

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

            StackingBar100Series stackingBar100Series3 = new StackingBar100Series();

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

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

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

            stackingBar100Series.EnableAnimation  = true;
            stackingBar100Series1.EnableAnimation = true;
            stackingBar100Series2.EnableAnimation = true;
            stackingBar100Series3.EnableAnimation = true;
            return(chart);
        }