Пример #1
0
        // Aplica el themes de TeeChart per defecte
        public static void AplicarOptions(ChartView chart)
        {
            string themeActual    = fileController.LeerThemeActual();
            bool   zoomEnabled    = fileController.LeerZoomActual();
            bool   panningEnabled = fileController.BooleanReadValues("panning:");

            //string zoomTypeActual = fileController.LeerZoomTypeActual();

            switch (themeActual)
            {
            case "None":
                chart.Chart.setTheme(ThemeType.None);
                break;

            case "BlackIsBack":
                chart.Chart.setTheme(ThemeType.BlackIsBack);
                break;

            case "Opera":
                chart.Chart.setTheme(ThemeType.Opera);
                break;

            case "TeeChart":
                chart.Chart.setTheme(ThemeType.TeeChart);
                break;

            case "Excel":
                chart.Chart.setTheme(ThemeType.Excel);
                break;

            case "Classic":
                chart.Chart.setTheme(ThemeType.Classic);
                break;

            case "XP":
                chart.Chart.setTheme(ThemeType.XP);
                break;

            case "Web":
                chart.Chart.setTheme(ThemeType.Web);
                break;

            case "Business":
                chart.Chart.setTheme(ThemeType.Business);
                break;

            case "BlueSky":
                chart.Chart.setTheme(ThemeType.BlueSky);
                break;

            case "Grayscale":
                chart.Chart.setTheme(ThemeType.Grayscale);
                break;

            case "Lookout":
                chart.Chart.setTheme(ThemeType.Lookout);
                break;

            case "Andros":
                chart.Chart.setTheme(ThemeType.Andros);
                break;

            case "Report":
                chart.Chart.setTheme(ThemeType.Report);
                break;

            default:
                throw new Exception("Unexpected Case");
            }

            if (chart.Chart.Header.Text != "Zoom and Panning a Chart")
            {
                chart.Chart.Zoom.Active = zoomEnabled;
                chart.Chart.Zoom.Allow  = zoomEnabled;

                chart.Chart.Panning.Active = panningEnabled;
                if (panningEnabled)
                {
                    chart.Chart.Panning.Allow = ScrollModes.Both;
                }
                else
                {
                    chart.Chart.Panning.Allow = ScrollModes.None;
                }
            }
        }
Пример #2
0
        public SettingsPage()
        {
            InitializeComponent();

            this.Title = "Settings";

            viewOpciones.Root   = rootTable;
            viewOpciones.Intent = TableIntent.Settings;

            section1.Title = "Tools";
            section2.Title = "Theme";
            section3.Title = "Information";

            // Section 1
            zoomSwitchCell.Text       = "Active zoom";
            zoomSwitchCell.On         = fileController.LeerZoomActual();
            zoomSwitchCell.OnChanged += ZoomSwitchCell_OnChanged;

            //pickerZoomTypeTextCell.Tapped += PickerZoomTypeTextCell_Tapped;
            //pickerZoomTypeTextCell.Text = "Zoom type";
            //pickerZoomTypeTextCell.TextColor = Color.Black;
            //pickerZoomTypeTextCell.Detail = "Select the zoom type in charts";

            //pickerZoomTypeViewCell.View = pickerZoomTypeLayout;
            //pickerZoomTypeViewCell.Height = 0;

            //pickerZoomTypeLayout.HorizontalOptions = LayoutOptions.FillAndExpand;
            //pickerZoomTypeLayout.Children.Add(labelSelectedZoomType);
            //pickerZoomTypeLayout.Children.Add(zoomTypePicker);

            //zoomTypePicker.Title = "Select zoom type";
            //InitializeZoomTypePickerItems();
            //zoomTypePicker.SelectedIndexChanged += ZoomTypePicker_SelectedIndexChanged;
            //zoomTypePicker.HeightRequest = 0;
            //zoomTypePicker.IsVisible = false;

            //labelSelectedZoomType.Text = zoomTypePicker.SelectedItem.ToString();
            //labelSelectedZoomType.FontSize += 1;
            //labelSelectedZoomType.TextColor = Color.FromHex("0B8DF9");
            //labelSelectedZoomType.Margin = new Thickness(0, 10, 20, 0);
            //labelSelectedZoomType.HorizontalOptions = LayoutOptions.End;

            panningSwitchCell.Text       = "Active panning";
            panningSwitchCell.On         = fileController.BooleanReadValues("panning:");
            panningSwitchCell.OnChanged += PanningSwitchCell_OnChanged;

            // Section 2
            pickerThemeTextCell.Tapped   += PickerCell_Tapped;
            pickerThemeTextCell.Text      = "Change theme";
            pickerThemeTextCell.TextColor = Color.Black;
            pickerThemeTextCell.Detail    = "Select your favourite chart theme in this app";

            pickerThemeViewCell.View   = pickerThemeLayout;
            pickerThemeViewCell.Height = 0;

            pickerThemeLayout.HorizontalOptions = LayoutOptions.FillAndExpand;
            pickerThemeLayout.Children.Add(labelSelectedTheme);
            pickerThemeLayout.Children.Add(themePicker);

            themePicker.Title = "Change the theme";
            InitializeThemePickerItems();
            themePicker.SelectedIndexChanged += ThemePicker_SelectedIndexChanged;
            themePicker.HeightRequest         = 0;
            themePicker.IsVisible             = false;

            labelSelectedTheme.Text              = themePicker.SelectedItem.ToString();
            labelSelectedTheme.FontSize         += 1;
            labelSelectedTheme.TextColor         = Color.FromHex("0B8DF9");
            labelSelectedTheme.Margin            = new Thickness(0, 10, 20, 0);
            labelSelectedTheme.HorizontalOptions = LayoutOptions.End;

            // Section 3
            versionTextCell.Text        = "TeeChart DEMO Xamarin Forms";
            versionTextCell.TextColor   = Color.Black;
            versionTextCell.Detail      = "Version: 3.0";
            versionTextCell.DetailColor = Color.FromRgb(100, 100, 100);

            // Add Items
            rootTable.Add(section1);
            rootTable.Add(section2);
            rootTable.Add(section3);

            section1.Add(zoomSwitchCell);
            section1.Add(panningSwitchCell);
            //section1.Add(pickerZoomTypeTextCell);
            //section1.Add(pickerZoomTypeViewCell);
            section2.Add(pickerThemeTextCell);
            section2.Add(pickerThemeViewCell);
            section3.Add(versionTextCell);

            this.Content = viewOpciones;
        }