Exemplo n.º 1
0
        public SelectionSample()
        {
            InitializeComponent();
            Title = AppResources.SelectionTitle;

            this.flexPie.ItemsSource = PieChartSampleFactory.CreateEntiyList();
            this.flexPie.Palette     = Xuni.Forms.ChartCore.ChartPalettes.Superhero;
            Device.OnPlatform(Android: () =>
                              this.flexPie.SelectedDashes = new double[] { 15, 5 }
                              );

            Device.OnPlatform(WinPhone: () =>
                              this.flexPie.SelectedDashes = new double[] { 3, 1 }
                              );

            Device.OnPlatform(iOS: () =>
                              this.flexPie.SelectedDashes = new double[] { 7.5, 2.5 }
                              );
            this.pickerPosition.SelectedIndexChanged += pickerPosition_SelectedIndexChanged;
            foreach (var item in Enum.GetNames(typeof(ChartPositionType)))
            {
                this.pickerPosition.Items.Add(item);
            }
            this.pickerPosition.SelectedIndex = 3;

            root.SizeChanged += root_SizeChanged;
        }
 public GettingStartedSample()
 {
     InitializeComponent();
     this.pieChart.ItemsSource   = PieChartSampleFactory.CreateEntiyList();
     this.dountChart.ItemsSource = PieChartSampleFactory.CreateEntiyList();
     this.root.SizeChanged      += root_SizeChanged;
 }
Exemplo n.º 3
0
 public BasicFeaturesSample()
 {
     InitializeComponent();
     Title = AppResources.BasicFeaturesTitle;
     this.flexPie.ItemsSource = PieChartSampleFactory.CreateEntiyList();
     this.flexPie.Palette     = Xuni.Forms.ChartCore.ChartPalettes.Midnight;
     this.SizeChanged        += gr_SizeChanged;
 }
Exemplo n.º 4
0
        public TooltipsSample()
        {
            InitializeComponent();
            Title = AppResources.CustomTooltipsTitle;
            this.flexPie.ItemsSource = PieChartSampleFactory.CreateEntiyList();

            //pieChart.Tooltip.Content = GetChartTooltip();
        }
        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;
        }
Exemplo n.º 6
0
        public SelectionSample()
        {
            InitializeComponent();
            this.flexPie.ItemsSource = PieChartSampleFactory.CreateEntiyList();

            this.pickerPosition.SelectedIndexChanged += pickerPosition_SelectedIndexChanged;
            foreach (var item in Enum.GetNames(typeof(ChartPositionType)))
            {
                this.pickerPosition.Items.Add(item);
            }
            this.pickerPosition.SelectedIndex = 2;
        }
Exemplo n.º 7
0
        public DataLabel()
        {
            InitializeComponent();
            Title = AppResources.DataLabelsTitle;
            this.flexPie.ItemsSource = PieChartSampleFactory.CreateEntiyList();
            this.flexPie.Palette     = Xuni.Forms.ChartCore.ChartPalettes.Organic;

            foreach (var item in Enum.GetNames(typeof(PieLabelPosition)))
            {
                this.pickPostion.Items.Add(item);
            }
            this.pickPostion.SelectedIndex = 2;
        }
        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;
        }
Exemplo n.º 9
0
 public ThemingSample()
 {
     InitializeComponent();
     this.listPalettes        = new List <Color[]>();
     this.flexPie.ItemsSource = PieChartSampleFactory.CreateEntiyList();
     foreach (var field in typeof(Palettes).GetRuntimeFields())
     {
         if (field.IsStatic && field.FieldType == typeof(Color[]))
         {
             listPalettes.Add(field.GetValue(null) as Color[]);
             this.pickerThemeing.Items.Add(field.Name);
         }
     }
     this.pickerThemeing.SelectedIndex         = 0;
     this.pickerThemeing.SelectedIndexChanged += pickerThemeing_SelectedIndexChanged;
 }
        public LegendAndTitlesSample()
        {
            InitializeComponent();
            Title = AppResources.LegendSampleTitle;

            this.flexPie.ItemsSource = PieChartSampleFactory.CreateEntiyList();
            //this.flexPie.Palette = Xuni.Forms.ChartCore.Palettes.Coral;
            this.flexPie.SelectedDashes = null;
            this.pickerLegendPosition.SelectedIndexChanged += pickerPosition_SelectedIndexChanged;

            foreach (var item in Enum.GetNames(typeof(ChartPositionType)))
            {
                this.pickerLegendPosition.Items.Add(item);
            }
            this.pickerLegendPosition.SelectedIndex = 0;
            this.flexPie.Legend.Position            = ChartPositionType.Auto;
        }
Exemplo n.º 11
0
        public Snapshot()
        {
            InitializeComponent();
            Title = AppResources.ExportImageTitle;
            this.pieChart.ItemsSource = PieChartSampleFactory.CreateEntiyList();
            snapshotFrame.Opacity     = 0;
            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (s, e) =>
            {
                snapshotFrame.Opacity = 1;

                // Make the control mearsure and layout again. Otherwise the size of the control may incorrect.
                pieChart.IsVisible = false;
                pieChart.IsVisible = true;
            };
            snapshotFrame.GestureRecognizers.Add(tapGestureRecognizer);
        }
Exemplo n.º 12
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;
        }
Exemplo n.º 13
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;
        }
 public BasicFeaturesSample()
 {
     InitializeComponent();
     this.flexPie.ItemsSource = PieChartSampleFactory.CreateEntiyList();
     root.SizeChanged        += gr_SizeChanged;
 }