public ZoomingandPanning() { chart = new SFChart(); SFCategoryAxis primary = new SFCategoryAxis(); primary.LabelPlacement = SFChartLabelPlacement.BetweenTicks; chart.PrimaryAxis = primary; chart.PrimaryAxis.Title.Text = new NSString("Company"); chart.SecondaryAxis = new SFNumericalAxis(); chart.SecondaryAxis.Title.Text = new NSString("Sales"); ChartZoomPanDataSource dataModel = new ChartZoomPanDataSource(); chart.DataSource = dataModel as SFChartDataSource; label = new UILabel(); label.Text = "Pinch to zoom or double tap and drag to select a region to zoom in"; label.Font = UIFont.FromName("Helvetica", 12f); label.TextAlignment = UITextAlignment.Center; label.LineBreakMode = UILineBreakMode.WordWrap; label.Lines = 2; label.BackgroundColor = UIColor.Black.ColorWithAlpha(0.7f); label.TextColor = UIColor.White; chart.AddChartBehavior(new SFChartZoomPanBehavior() { EnableSelectionZooming = true }); this.AddSubview(chart); this.AddSubview(label); this.control = this; }
public ZoomingandPanning () { chart = new SFChart (); SFCategoryAxis primary = new SFCategoryAxis (); primary.LabelPlacement = SFChartLabelPlacement.BetweenTicks; chart.PrimaryAxis = primary; chart.PrimaryAxis.Title.Text = new NSString ("Company"); chart.SecondaryAxis = new SFNumericalAxis (); chart.SecondaryAxis.Title.Text = new NSString ("Sales"); ChartZoomPanDataSource dataModel = new ChartZoomPanDataSource (); chart.DataSource = dataModel as SFChartDataSource; label = new UILabel (); label.Text = "Pinch to zoom or double tap and drag to select a region to zoom in"; label.Font = UIFont.FromName("Helvetica", 12f); label.TextAlignment = UITextAlignment.Center; label.LineBreakMode = UILineBreakMode.WordWrap; label.Lines = 2; label.BackgroundColor = UIColor.Black.ColorWithAlpha (0.7f); label.TextColor = UIColor.White; chart.AddChartBehavior (new SFChartZoomPanBehavior() {EnableSelectionZooming = true}); this.AddSubview (chart); this.AddSubview (label); this.control = this; }