public override void ViewDidLoad () { base.ViewDidLoad (); // Create the chart float margin = UserInterfaceIdiomIsPhone ? 10 : 50; chart = new ShinobiChart (new RectangleF (margin, margin, View.Bounds.Width - 2 * margin, View.Bounds.Height - 2 * margin)) { Title = "Grocery Sales Figures", AutoresizingMask = ~UIViewAutoresizing.None, LicenseKey = "" // TODO: add your trail licence key here! }; // Add a pair of axes SChartCategoryAxis xAxis = new SChartCategoryAxis (); xAxis.Style.InterSeriesPadding = 0.1; chart.XAxis = xAxis; SChartAxis yAxis = new SChartNumberAxis () { Title = "Sales (1000s)", RangePaddingHigh = new NSNumber(1) }; chart.YAxis = yAxis; // Add the the view View.AddSubview (chart); // Set the data source chart.DataSource = new ColumnSeriesDataSource (); // Show the legend on iPad only if(!UserInterfaceIdiomIsPhone) { chart.Legend.Hidden = false; chart.Legend.Placement = SChartLegendPlacement.InsidePlotArea; } }
private void CreateChart() { _bubbleChart = new ShinobiChart(this.Bounds); _bubbleChart.LicenseKey = ShinobiLicenseKeyProviderJson.Instance.ChartsLicenseKey; _bubbleChart.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; SChartAxis xAxis = new SChartNumberAxis(); xAxis.RangePaddingHigh = (NSNumber)0.5; xAxis.RangePaddingLow = (NSNumber)0.5; xAxis.Title = "Hour"; _bubbleChart.XAxis = xAxis; SChartCategoryAxis yAxis = new SChartCategoryAxis(); yAxis.RangePaddingHigh = (NSNumber)0.5; yAxis.RangePaddingLow = (NSNumber)0.5; yAxis.Title = "Day"; _bubbleChart.YAxis = yAxis; // Add it as a subview this.AddSubview(_bubbleChart); }
void CreateColumnChart(CGRect frame) { // Create the chart columnChart = new ShinobiChart (frame.Inset(40)) { Title = "Grocery Sales Figures", AutoresizingMask = ~UIViewAutoresizing.None, LicenseKey = "" //TODO: add your trail licence key here! }; // Add a pair of axes var xAxis = new SChartCategoryAxis (); xAxis.Style.InterSeriesPadding = 0; columnChart.XAxis = xAxis; var yAxis = new SChartNumberAxis { Title = "Sales (1000s)", RangePaddingHigh = new NSNumber(1) }; columnChart.YAxis = yAxis; // Add to the view View.AddSubview (columnChart); var columnChartDelegate = new ColumnChartDelegate(); columnChartDelegate.ToggledSelection += ColumnChartToggledSelection; columnChart.DataSource = columnChartDataSource; columnChart.Delegate = columnChartDelegate; // Show the legend columnChart.Legend.Hidden = false; columnChart.Legend.Placement = SChartLegendPlacement.InsidePlotArea; }