コード例 #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
            };

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

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

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

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

            return(chart);
        }
コード例 #2
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 };

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

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

            series =new StackingColumn100Series
            {
                
                DataSource = MainPage.GetData3(),
                DataMarkerPosition = DataMarkerPosition.Center,
            };
            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.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);
        }
コード例 #4
0
        public AqColorMaps()
        {
            app = App.Current as App;
            this.InitializeComponent();
            aqLimitsColl = new ObservableCollection <AqLimits>();
            var aqLevelCnt = StaticTaqModel.aqiLimits.Count;

            foreach (var aqName in apNames)
            {
                var aqLimit = new AqLimits
                {
                    Name   = aqName,
                    Limits = new ObservableCollection <double>(),
                    Diffs  = new ObservableCollection <double>()
                };

                // Skip aqLimits[aqName][0], because it is unused -1.
                aqLimit.Limits.Add(StaticTaqModel.aqLimits[aqName][1]);
                aqLimit.Diffs.Add(StaticTaqModel.aqLimits[aqName][1]);
                for (var i = 2; i < aqLevelCnt; i++)
                {
                    aqLimit.Limits.Add(StaticTaqModel.aqLimits[aqName][i]);
                    aqLimit.Diffs.Add(StaticTaqModel.aqLimits[aqName][i] - StaticTaqModel.aqLimits[aqName][i - 1]);
                }
                aqLimitsColl.Add(aqLimit);
            }
            for (var i = 1; i < aqLevelCnt; i++)
            {
                var sbs = new StackingColumn100Series();
                sbs.Interior = new SolidColorBrush(StaticTaqModelView.html2RgbColor(StaticTaqModel.aqiBgColors[i]));

                sbs.XBindingPath = "Name";
                sbs.YBindingPath = "Diffs[" + i + "]";

                var b = new Binding();
                b.Source = this;
                b.Path   = new PropertyPath("aqLimitsColl");
                b.Mode   = BindingMode.OneWay;
                sbs.SetBinding(StackingBarSeries.ItemsSourceProperty, b);

                var cai = new ChartAdornmentInfo();
                cai.SegmentLabelContent = LabelContent.LabelContentPath;
                // DataContext =\"aqLimitsColl[" + i + "].\"
                var textColor = "Black";
                if (i > StaticTaqModel.aqTextColorLimit)
                {
                    textColor = "White";
                }
                var dt = XamlReader.Load($"<DataTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">" +
                                         "<TextBlock Foreground=\"" + textColor + "\" Text=\"{Binding Converter={StaticResource con}}\"></TextBlock></DataTemplate>") as DataTemplate;
                cai.LabelTemplate = dt;
                cai.LabelPosition = AdornmentsLabelPosition.Inner;
                cai.ShowLabel     = true;

                sbs.AdornmentsInfo = cai;
                sbs.SegmentSpacing = 0;

                sfChart.Series.Add(sbs);
            }

            this.DataContext = this;
        }
コード例 #5
0
        public override View GetSampleContent(Context context)
        {
            var chart = new SfChart(context);;

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

            CategoryAxis PrimaryAxis = new CategoryAxis();

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

            NumericalAxis numericalAxis = new NumericalAxis();

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

            StackingColumn100Series stackingColumn100Series1 = new StackingColumn100Series();

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

            StackingColumn100Series stackingColumn100Series2 = new StackingColumn100Series();

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

            StackingColumn100Series stackingColumn100Series3 = new StackingColumn100Series();

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

            StackingColumn100Series stackingColumn100Series4 = new StackingColumn100Series();

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

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

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

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

            return(chart);
        }