public LegendAndTitlesSample(PieChartSample chartSample)
            : base()
        {
            FlexPie chart = PieChartSampleFactory.GetFlexChartSample(chartSample);

            chart.HeaderText      = EntryInputs.headerText;
            chart.HeaderFont      = Font.SystemFontOfSize(30);
            chart.HeaderTextColor = Color.FromHex("#666666");

            chart.FooterText      = EntryInputs.footerText;
            chart.FooterFont      = Font.SystemFontOfSize(15);
            chart.FooterTextColor = Color.FromHex("#666666");

            chart.Legend.Position = Xuni.Xamarin.ChartCore.ChartPositionType.Bottom;

            RelativeLayout mainRelativeLayout = new RelativeLayout();

            WrapLayout stepperStack = new WrapLayout();

            stepperStack.Orientation = StackOrientation.Horizontal;

            Entry headerEntry = new Entry();

            headerEntry.VerticalOptions   = LayoutOptions.FillAndExpand;
            headerEntry.HorizontalOptions = LayoutOptions.FillAndExpand;

            stepperStack.Children.Add(EntryInputs.getHeaderEntry(chart));
            stepperStack.Children.Add(EntryInputs.getFooterEntry(chart));
            stepperStack.Children.Add(Pickers.GetLegendPositionPicker(chart));

            mainRelativeLayout.Children.Add(stepperStack, Constraint.Constant(0),
                                            Constraint.Constant(0));

            mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(stepperStack, (parent, sibling) =>
            {
                return(sibling.Y + sibling.Height);
            }),
                                            Constraint.RelativeToView(stepperStack, (parent, sibling) =>
            {
                return(parent.Width);
            }),
                                            Constraint.RelativeToView(stepperStack, (parent, sibling) =>
            {
                return(parent.Height - sibling.Height);
            }));
            // On Windows Phone,StackLayout and Picker will shrink automatically.
            // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8
            mainRelativeLayout.SizeChanged += (s, e) =>
            {
                stepperStack.WidthRequest = mainRelativeLayout.Width;
            };

            Content = mainRelativeLayout;
        }
        public SelectionSample(PieChartSample chartSample)
            : base()
        {
            FlexPie chart = PieChartSampleFactory.GetFlexChartSample(chartSample);

            chart.SelectionMode       = Xuni.Xamarin.ChartCore.ChartSelectionModeType.Point;
            chart.SelectedItemOffset  = .2;
            chart.SelectedDashes      = new double[] { 20, 10 };
            chart.SelectedBorderColor = Color.FromRgb(255, 0, 0);
            chart.SelectedBorderWidth = 3;


            chart.SelectedItemPosition = Xuni.Xamarin.ChartCore.ChartPositionType.Top;
            chart.IsAnimated           = true;

            RelativeLayout mainRelativeLayout = new RelativeLayout();

            WrapLayout stepperStack = new WrapLayout();

            stepperStack.Orientation = StackOrientation.Horizontal;

            stepperStack.Children.Add(Steppers.GetSelectedOffsetStepper(chart));
            stepperStack.Children.Add(Pickers.GetSelectedItemPositionPicker(chart));
            stepperStack.Children.Add(Switches.GetAnimatedSwitch(chart));

            mainRelativeLayout.Children.Add(stepperStack, Constraint.Constant(0),
                                            Constraint.Constant(0));

            mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(stepperStack, (parent, sibling) =>
            {
                return(sibling.Y + sibling.Height);
            }),
                                            Constraint.RelativeToView(stepperStack, (parent, sibling) =>
            {
                return(parent.Width);
            }),
                                            Constraint.RelativeToView(stepperStack, (parent, sibling) =>
            {
                return(parent.Height - sibling.Height);
            }));
            // On Windows Phone,StackLayout and Picker will shrink automatically.
            // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8
            mainRelativeLayout.SizeChanged += (s, e) =>
            {
                stepperStack.WidthRequest = mainRelativeLayout.Width;
            };

            Content = mainRelativeLayout;
        }
Ejemplo n.º 3
0
        public BasicFeaturesSample(PieChartSample chartSample)
            : base()
        {
            FlexPie chart = PieChartSampleFactory.GetFlexChartSample(chartSample);

            chart.InnerRadius = 0.3;

            RelativeLayout mainRelativeLayout = new RelativeLayout();

            WrapLayout stepperStack = new WrapLayout();

            stepperStack.Orientation = StackOrientation.Horizontal;

            stepperStack.Children.Add(Steppers.GetInnerRadiusStepper(chart));
            stepperStack.Children.Add(Steppers.GetOffsetStepper(chart));
            stepperStack.Children.Add(Steppers.GetStartAngleStepper(chart));
            stepperStack.Children.Add(Switches.GetRotatedSwitch(chart));

            mainRelativeLayout.Children.Add(stepperStack, Constraint.Constant(0),
                                            Constraint.Constant(0));

            mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(stepperStack, (parent, sibling) =>
            {
                return(sibling.Y + sibling.Height);
            }),
                                            Constraint.RelativeToView(stepperStack, (parent, sibling) =>
            {
                return(parent.Width);
            }),
                                            Constraint.RelativeToView(stepperStack, (parent, sibling) =>
            {
                return(parent.Height - sibling.Height);
            }));
            // On Windows Phone,StackLayout and Picker will shrink automatically.
            // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8
            mainRelativeLayout.SizeChanged += (s, e) =>
            {
                stepperStack.WidthRequest = mainRelativeLayout.Width;
            };

            Content = mainRelativeLayout;
        }
Ejemplo n.º 4
0
        public ThemingSample(PieChartSample chartSample)
            : base()
        {
            FlexPie chart = PieChartSampleFactory.GetFlexChartSample(chartSample);

            RelativeLayout mainRelativeLayout = new RelativeLayout();

            WrapLayout stepperStack = new WrapLayout();

            stepperStack.Orientation = StackOrientation.Horizontal;


            Picker picker = Pickers.GetPalettePicker(chart);

            stepperStack.Children.Add(picker);

            mainRelativeLayout.Children.Add(stepperStack, Constraint.Constant(0),
                                            Constraint.Constant(0));

            mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(stepperStack, (parent, sibling) =>
            {
                return(sibling.Y + sibling.Height);
            }),
                                            Constraint.RelativeToView(stepperStack, (parent, sibling) =>
            {
                return(parent.Width);
            }),
                                            Constraint.RelativeToView(stepperStack, (parent, sibling) =>
            {
                return(parent.Height - sibling.Height);
            }));
            // On Windows Phone,StackLayout and Picker will shrink automatically.
            // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8
            mainRelativeLayout.SizeChanged += (s, e) =>
            {
                picker.WidthRequest = mainRelativeLayout.Width;
            };

            Content = mainRelativeLayout;
        }
        public GettingStartedSample(PieChartSample chartSample)
            : base()
        {
            pieChart   = PieChartSampleFactory.GetFlexChartSample(chartSample);
            donutChart = PieChartSampleFactory.GetFlexChartSample(chartSample);

            donutChart.InnerRadius = .6;

            mainRelativeLayout = new RelativeLayout();

            mainRelativeLayout.Children.Add(pieChart, Constraint.Constant(0), Constraint.Constant(0),
                                            Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width);
            }),
                                            Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height / 2);
            }));

            mainRelativeLayout.Children.Add(donutChart,
                                            Constraint.Constant(0),
                                            Constraint.RelativeToView(pieChart, (parent, sibling) =>
            {
                return(sibling.Y + sibling.Height);
            }),
                                            Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width);
            }),
                                            Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height / 2);
            }));

            Content = mainRelativeLayout;
        }