Beispiel #1
0
        public Polar()
        {
            SFChart chart = new SFChart();

            chart.Title.Text         = new NSString("Plants in Wonderland");
            chart.ColorModel.Palette = SFChartColorPalette.Natural;

            chart.Title.TextAlignment = UITextAlignment.Center;
            SFCategoryAxis primaryAxis = new SFCategoryAxis();

            chart.PrimaryAxis = primaryAxis;
            SFNumericalAxis secondaryAxis = new SFNumericalAxis();

            chart.SecondaryAxis = secondaryAxis;
            ChartViewModel dataModel = new ChartViewModel();

            SFPolarSeries series1 = new SFPolarSeries();

            series1.ItemsSource     = dataModel.PolarData1;
            series1.XBindingPath    = "XValue";
            series1.YBindingPath    = "YValue";
            series1.EnableTooltip   = true;
            series1.Alpha           = 0.5f;
            series1.Label           = "Weed";
            series1.EnableAnimation = true;
            chart.Series.Add(series1);

            SFPolarSeries series2 = new SFPolarSeries();

            series2.ItemsSource     = dataModel.PolarData2;
            series2.XBindingPath    = "XValue";
            series2.YBindingPath    = "YValue";
            series2.EnableTooltip   = true;
            series2.Alpha           = 0.5f;
            series2.Label           = "Flower";
            series2.EnableAnimation = true;
            chart.Series.Add(series2);

            SFPolarSeries series3 = new SFPolarSeries();

            series3.ItemsSource     = dataModel.PolarData3;
            series3.XBindingPath    = "XValue";
            series3.YBindingPath    = "YValue";
            series3.EnableTooltip   = true;
            series3.Alpha           = 0.5f;
            series3.Label           = "Tree";
            series3.EnableAnimation = true;
            chart.Series.Add(series3);

            chart.Legend.Visible                = true;
            chart.Legend.IconWidth              = 14;
            chart.Legend.IconHeight             = 14;
            chart.Legend.ToggleSeriesVisibility = true;
            chart.Legend.DockPosition           = SFChartLegendPosition.Bottom;

            this.AddSubview(chart);
        }
Beispiel #2
0
        public Polar()
        {
            SFChart chart = new SFChart();

            chart.Title.Text         = new NSString("Average Sales Comparison");
            chart.ColorModel.Palette = SFChartColorPalette.Natural;

            chart.Title.TextAlignment = UITextAlignment.Center;
            SFCategoryAxis primaryAxis = new SFCategoryAxis();

            chart.PrimaryAxis = primaryAxis;
            SFNumericalAxis secondaryAxis = new SFNumericalAxis();

            secondaryAxis.Interval = new NSNumber(1);
            chart.SecondaryAxis    = secondaryAxis;
            NSNumberFormatter formatter = new NSNumberFormatter();

            formatter.PositiveSuffix = "M";
            chart.SecondaryAxis.LabelStyle.LabelFormatter = formatter;
            ChartViewModel dataModel = new ChartViewModel();

            SFPolarSeries series1 = new SFPolarSeries();

            series1.ItemsSource     = dataModel.PolarData1;
            series1.XBindingPath    = "XValue";
            series1.YBindingPath    = "YValue";
            series1.EnableTooltip   = true;
            series1.Alpha           = 0.5f;
            series1.Label           = "Product A";
            series1.EnableAnimation = true;
            chart.Series.Add(series1);

            SFPolarSeries series2 = new SFPolarSeries();

            series2.ItemsSource     = dataModel.PolarData2;
            series2.XBindingPath    = "XValue";
            series2.YBindingPath    = "YValue";
            series2.EnableTooltip   = true;
            series2.Alpha           = 0.5f;
            series2.Label           = "Product B";
            series2.EnableAnimation = true;
            chart.Series.Add(series2);

            SFPolarSeries series3 = new SFPolarSeries();

            series3.ItemsSource     = dataModel.PolarData3;
            series3.XBindingPath    = "XValue";
            series3.YBindingPath    = "YValue";
            series3.EnableTooltip   = true;
            series3.Alpha           = 0.5f;
            series3.Label           = "Product C";
            series3.EnableAnimation = true;
            chart.Series.Add(series3);

            chart.Legend.Visible                = true;
            chart.Legend.IconWidth              = 14;
            chart.Legend.IconHeight             = 14;
            chart.Legend.ToggleSeriesVisibility = true;
            chart.Legend.DockPosition           = SFChartLegendPosition.Bottom;

            this.AddSubview(chart);
        }