public override SFSeries GetSeries(SFChart chart, nint index)
    {
        SFStackingAreaSeries series = new SFStackingAreaSeries();

        series.Alpha       = 0.6f;
        series.BorderWidth = 3;

        if (index == 0)
        {
            series.BorderColor = UIColor.FromRGBA(255.0f / 255.0f, 191.0f / 255.0f, 0.0f / 255.0f, 1.0f);
        }
        else if (index == 1)
        {
            series.BorderColor = UIColor.FromRGBA(81.0f / 255.0f, 72.0f / 255.0f, 57.0f / 255.0f, 1.0f);
        }
        else
        {
            series.BorderColor = UIColor.FromRGBA(195.0f / 255.0f, 81.0f / 255.0f, 64.0f / 255.0f, 1.0f);
        }

        return(series);
    }
        public StackedArea()
        {
            SFChart chart = new SFChart();

            chart.ColorModel.Palette = SFChartColorPalette.Natural;

            chart.Title.Text = new NSString("Trend in Sales of Ethical Produce");
            SFCategoryAxis primaryAxis = new SFCategoryAxis();

            primaryAxis.ShowMajorGridLines    = false;
            primaryAxis.EdgeLabelsDrawingMode = SFChartAxisEdgeLabelsDrawingMode.Shift;
            chart.PrimaryAxis              = primaryAxis;
            chart.SecondaryAxis            = new SFNumericalAxis();
            chart.SecondaryAxis.Title.Text = new NSString("Spends");
            chart.SecondaryAxis.Interval   = new NSNumber(1);
            chart.SecondaryAxis.Minimum    = new NSNumber(0);
            chart.SecondaryAxis.Maximum    = new NSNumber(7);
            chart.SecondaryAxis.AxisLineStyle.LineWidth = 0;
            chart.SecondaryAxis.MajorTickStyle.LineSize = 0;
            NSNumberFormatter formatter = new NSNumberFormatter();

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

            SFStackingAreaSeries series1 = new SFStackingAreaSeries();

            series1.ItemsSource     = dataModel.StackedAreaData1;
            series1.XBindingPath    = "XValue";
            series1.YBindingPath    = "YValue";
            series1.EnableTooltip   = true;
            series1.Alpha           = 0.5f;
            series1.Label           = "Organic";
            series1.LegendIcon      = SFChartLegendIcon.SeriesType;
            series1.EnableAnimation = true;
            chart.Series.Add(series1);

            SFStackingAreaSeries series2 = new SFStackingAreaSeries();

            series2.ItemsSource     = dataModel.StackedAreaData2;
            series2.XBindingPath    = "XValue";
            series2.YBindingPath    = "YValue";
            series2.EnableTooltip   = true;
            series2.Label           = "Fair-trade";
            series2.LegendIcon      = SFChartLegendIcon.SeriesType;
            series2.EnableAnimation = true;
            chart.Series.Add(series2);

            SFStackingAreaSeries series3 = new SFStackingAreaSeries();

            series3.ItemsSource     = dataModel.StackedAreaData3;
            series3.XBindingPath    = "XValue";
            series3.YBindingPath    = "YValue";
            series3.EnableTooltip   = true;
            series3.Label           = "Veg Alternatives";
            series3.LegendIcon      = SFChartLegendIcon.SeriesType;
            series3.EnableAnimation = true;
            chart.Series.Add(series3);

            SFStackingAreaSeries series4 = new SFStackingAreaSeries();

            series4.ItemsSource     = dataModel.StackedAreaData4;
            series4.XBindingPath    = "XValue";
            series4.YBindingPath    = "YValue";
            series4.EnableTooltip   = true;
            series4.Label           = "Others";
            series4.LegendIcon      = SFChartLegendIcon.SeriesType;
            series4.EnableAnimation = true;
            chart.Series.Add(series4);

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

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

            chart.ColorModel.Palette = SFChartColorPalette.Natural;

            chart.Title.Text = new NSString("Industrial Production Growth");
            SFCategoryAxis primaryAxis = new SFCategoryAxis();

            primaryAxis.Title.Text            = new NSString("Year");
            primaryAxis.EdgeLabelsDrawingMode = SFChartAxisEdgeLabelsDrawingMode.Shift;
            chart.PrimaryAxis              = primaryAxis;
            chart.SecondaryAxis            = new SFNumericalAxis();
            chart.SecondaryAxis.Title.Text = new NSString("Production (%)");
            ChartViewModel dataModel = new ChartViewModel();

            SFStackingAreaSeries series1 = new SFStackingAreaSeries();

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

            SFStackingAreaSeries series2 = new SFStackingAreaSeries();

            series2.ItemsSource     = dataModel.StackedAreaData2;
            series2.XBindingPath    = "XValue";
            series2.YBindingPath    = "YValue";
            series2.EnableTooltip   = true;
            series2.Label           = "Indonesia";
            series2.EnableAnimation = true;
            chart.Series.Add(series2);

            SFStackingAreaSeries series3 = new SFStackingAreaSeries();

            series3.ItemsSource     = dataModel.StackedAreaData3;
            series3.XBindingPath    = "XValue";
            series3.YBindingPath    = "YValue";
            series3.EnableTooltip   = true;
            series3.Label           = "Russia";
            series3.EnableAnimation = true;
            chart.Series.Add(series3);

            SFStackingAreaSeries series4 = new SFStackingAreaSeries();

            series4.ItemsSource     = dataModel.StackedAreaData4;
            series4.XBindingPath    = "XValue";
            series4.YBindingPath    = "YValue";
            series4.EnableTooltip   = true;
            series4.Label           = "Bangladesh";
            series4.EnableAnimation = true;
            chart.Series.Add(series4);

            chart.Legend.Visible = true;
            chart.Legend.ToggleSeriesVisibility = true;
            chart.Legend.IconWidth    = 14;
            chart.Legend.IconHeight   = 14;
            chart.Legend.DockPosition = SFChartLegendPosition.Bottom;
            chart.AddChartBehavior(new SFChartZoomPanBehavior());

            this.AddSubview(chart);
        }
	public override SFSeries GetSeries (SFChart chart, nint index)
	{
		SFStackingAreaSeries series = new SFStackingAreaSeries ();
		series.Alpha 				= 0.6f;
		series.BorderWidth 			= 3;

		if(index == 0)
			series.BorderColor 		= UIColor.FromRGBA( 255.0f/255.0f ,191.0f/255.0f,0.0f/255.0f,1.0f);
		else if(index ==1)
			series.BorderColor 		= UIColor.FromRGBA( 81.0f/255.0f ,72.0f/255.0f,57.0f/255.0f,1.0f);
		else 
			series.BorderColor 		= UIColor.FromRGBA( 195.0f/255.0f ,81.0f/255.0f,64.0f/255.0f,1.0f);
		
		return series;
	}