public BarChartView(string ChartTitle) { List<ChartData> chartData = new ChartDataRepository ().chartDataCollection; SFChartZoomPanBehavior zoomPanBehavior = new SFChartZoomPanBehavior (); zoomPanBehavior.EnableSelectionZooming = true; chart = new SFChart (); chart.Title.Text = new NSString (ChartTitle); chart.Title.Font = UIFont.SystemFontOfSize (12, UIFontWeight.Bold); chart.Title.TextAlignment = UITextAlignment.Center; SFCategoryAxis primary = new SFCategoryAxis (); primary.LabelPlacement = SFChartLabelPlacement.BetweenTicks; primary.Title.Text = new NSString ("Security"); chart.PrimaryAxis = primary; chart.PrimaryAxis.LabelsIntersectAction = SFChartAxisLabelsIntersectAction.MultipleRows; chart.SecondaryAxis = new SFNumericalAxis (); if (ChartTitle == "Top 5 Gains") { chart.SecondaryAxis.Title.Text = new NSString ("Gains"); //chart.Title.Text = new NSString ("Top 5 Gains / Losses"); }; if (ChartTitle == "Top 5 Losers") { chart.SecondaryAxis.Title.Text = new NSString ("Losses"); //chart.SecondaryAxis.Maximum = new NSNumber (50); chart.SecondaryAxis.Interval = new NSNumber(50); //chart.Title.Text = new NSString (""); } if (ChartTitle == "P&L") { chart.SecondaryAxis.Title.Text = new NSString ("Gains/Losses"); chart.Title.Text = new NSString("P&L by Securities"); } BarChartRepository dataModel = new BarChartRepository (chartData, ChartTitle); chart.DataSource = dataModel as SFChartDataSource; chart.Legend.Visible = false; chart.AddChartBehavior (zoomPanBehavior); this.control = chart; }
public DoughnutChartView(string title) { List<ChartData> chartData = new ChartDataRepository ().chartDataCollection; string chartTitle = title; SFChart chart = new SFChart (); //chart.Title.Text = new NSString (title); //chart.Title.Font = UIFont.SystemFontOfSize (20, UIFontWeight.Bold); chart.Title.TextAlignment = UITextAlignment.Center; chart.Legend.Visible = true; chart.Legend.DockPosition = SFChartLegendPosition.Float; chart.Legend.Orientation = SFChartLegendOrientation.Horizontal; chart.Legend.OffsetX = 10; chart.Legend.OffsetY = 380; // chart.Legend.LabelStyle.Font = UIFont.SystemFontOfSize (11); // chart.Legend.IconHeight = 25; // chart.Legend.IconWidth = 25; ChartDoughnutDataSource dataModel = new ChartDoughnutDataSource (chartData, chartTitle); chart.DataSource = dataModel as SFChartDataSource; this.control = chart; }