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; } }
public override void ViewDidLoad() { base.ViewDidLoad (); // Create the chart float margin = UserInterfaceIdiomIsPhone ? 10 : 50; RectangleF frame = new RectangleF (margin, margin, View.Bounds.Width - 2 * margin, View.Bounds.Height - 2 * margin); chart = new ShinobiChart (frame) { Title = "Project Commit Punchcard", AutoresizingMask = ~UIViewAutoresizing.None, LicenseKey = "", // TODO: add your trail licence key here! DataSource = new BubbleSeriesDataSource(), YAxis = new SChartCategoryAxis { Title = "Day", RangePaddingHigh = new NSNumber(0.5), RangePaddingLow = new NSNumber(0.5) }, XAxis = new SChartNumberAxis { Title = "Hour", RangePaddingHigh = new NSNumber(0.5), RangePaddingLow = new NSNumber(0.5) } }; View.AddSubview (chart); }
void CreateColumnChart (RectangleF 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; }
private void CreateChart() { _columnChart = new ShinobiChart(this.Bounds); _columnChart.LicenseKey = ShinobiLicenseKeyProviderJson.Instance.ChartsLicenseKey; _columnChart.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; SChartNumberAxis xAxis = new SChartNumberAxis(); xAxis.Title = "Week"; _columnChart.XAxis = xAxis; SChartNumberAxis yAxis = new SChartNumberAxis(); yAxis.RangePaddingHigh = (NSNumber)0.5; yAxis.Title = "Commits"; _columnChart.YAxis = yAxis; // Display the legend _columnChart.Legend.Hidden = false; _columnChart.Legend.Placement = SChartLegendPlacement.InsidePlotArea; _columnChart.Legend.Position = SChartLegendPosition.TopLeft; // disable interaction - in order to allow paging of the container view _columnChart.UserInteractionEnabled = false; // Add it as a subview this.Add(_columnChart); }
private void createChart() { _lineChart = new ShinobiChart(this.Bounds); // Get the license key from our JSON reading utility _lineChart.LicenseKey = ShinobiLicenseKeyProviderJson.Instance.ChartsLicenseKey; _lineChart.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; SChartDateTimeAxis xAxis = new SChartDateTimeAxis(); xAxis.Title = "Week Commencing"; EnableGesturesOnAxis(xAxis); _lineChart.XAxis = xAxis; SChartNumberAxis yAxis = new SChartNumberAxis(); yAxis.RangePaddingHigh = (NSNumber)0.5; yAxis.Title = "Changes"; EnableGesturesOnAxis(yAxis); _lineChart.YAxis = yAxis; // Display the legend _lineChart.Legend.Hidden = false; _lineChart.Legend.Placement = SChartLegendPlacement.InsidePlotArea; _lineChart.Legend.Position = SChartLegendPosition.TopRight; // Add it as a subview this.AddSubview(_lineChart); }
public override void ViewDidLoad() { base.ViewDidLoad (); // Create the chart. chart = new ShinobiChart (View.Bounds); // Assign the data source chart.DataSource = new RadarChartDataSource (); // Create the axes chart.XAxis = new SChartCategoryAxis (); chart.YAxis = new SChartNumberAxis (new SChartNumberRange (0, 100)); // Make X-Axis line draw as a spiderweb chart.XAxis.Style.MajorGridLineStyle.LineRenderMode = SChartRadialLineRenderMode.Linear; chart.XAxis.Style.MajorGridLineStyle.ShowMajorGridLines = true; chart.XAxis.Style.MajorGridLineStyle.LineColor = UIColor.LightGray; // Make Y-Axis gridlines draw as a spiderweb chart.YAxis.Style.MajorGridLineStyle.LineRenderMode = SChartRadialLineRenderMode.Linear; chart.YAxis.Style.MajorGridLineStyle.ShowMajorGridLines = true; chart.YAxis.Style.MajorGridLineStyle.LineColor = UIColor.LightGray; // Ensure the chart fills the screen chart.AutoresizingMask = ~UIViewAutoresizing.None; // TODO: Add your trial licence key here! chart.LicenseKey = ""; // Add the chart to the view. View.AddSubview (chart); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Create a chart var chart = new ShinobiChart(new RectangleF(0, 40, View.Bounds.Width, View.Bounds.Height - 40), SChartAxisType.Number, SChartAxisType.Number); chart.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; // Create a datasource helper _dsHelper = new BindableDataSourceHelper <ExampleDataClass> (chart, () => { return(new SChartLineSeries()); }, "Time", "Lower"); Add(chart); // Create a UISlider var slider = new UISlider(new RectangleF(0, 0, View.Bounds.Width, 40)); slider.MinValue = 0; slider.MaxValue = 5; slider.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; Add(slider); // Create the binding var set = this.CreateBindingSet <ChartView, ChartViewModel> (); // Bind the datasource helper to the view model set.Bind(_dsHelper).For(s => s.Data).To(vm => vm.Source).OneWay(); // And the UISlider set.Bind(slider).To(vm => vm.Frequency); set.Apply(); }
public override SChartSeries GetSeries(ShinobiChart chart, nint dataSeriesIndex) { // In our example all series are line series SChartLineSeries lineSeries = new SChartLineSeries (); lineSeries.Style.LineWidth = 2; return lineSeries; }
public override void ViewDidLoad () { base.ViewDidLoad (); // create the chart float margin = UserInterfaceIdiomIsPhone ? 10 : 50; RectangleF frame = new RectangleF (margin, margin, View.Bounds.Width - 2 * margin, View.Bounds.Height - 2 * margin); chart = new ShinobiChart (frame) { Title = "Countries By Area", // ensure the chart fills the screen AutoresizingMask = ~UIViewAutoresizing.None, // TODO: add your trail licence key here! LicenseKey = "" }; View.AddSubview (chart); chart.DataSource = new PieChartDataSource (); chart.Delegate = new PieChartDelegate (); // show the legend chart.Legend.Hidden = false; }
public override void ViewDidLoad() { base.ViewDidLoad (); // Create the chart View.BackgroundColor = UIColor.White; nfloat margin = UserInterfaceIdiomIsPhone ? 10 : 50; CGRect frame = new CGRect (margin, margin, View.Bounds.Width - 2 * margin, View.Bounds.Height - 2 * margin); chart = new ShinobiChart (frame) { Title = "Apple Stock Price", AutoresizingMask = ~UIViewAutoresizing.None, LicenseKey = "", // TODO: add your trail licence key here! // add the axes XAxis = new SChartDateTimeAxis { Title = "Date" }, YAxis = new SChartNumberAxis { Title = "Price (USD)" } }; foreach(SChartAxis axis in chart.AllAxes) { axis.EnableGesturePanning = true; axis.EnableGestureZooming = true; axis.EnableMomentumPanning = true; axis.EnableMomentumZooming = true; } View.AddSubview(chart); chart.Delegate = new AddingAnnotationsDelegate (); chart.DataSource = new AddingAnnotationsDataSource (); }
public override SChartSeries GetSeries(ShinobiChart chart, int dataSeriesIndex) { SChartBubbleSeries chartSeries = new SChartBubbleSeries(); chartSeries.AutoScalingBiggestBubbleDiameter = 40; return(chartSeries); }
public override SChartData GetDataPoint(ShinobiChart chart, nint dataIndex, nint dataSeriesIndex) { return new SChartRadialDataPoint { Name = countrySizes[(int)dataIndex].Item1, Value = countrySizes[(int)dataIndex].Item2 }; }
/// <summary> /// Create new BindableDataSourceHelper /// </summary> /// <param name="chart">The ShinobiChart we wish to provide data to</param> /// <param name="seriesCreator">A lambda which will return the SChartSeries for this data</param> /// <param name="xValueKey">The name of the property in our domain objects to use as the x-value</param> /// <param name="yValueKey">The name of the property in our domain objects to use as the y-value</param> public BindableDataSourceHelper(ShinobiChart chart, Func <SChartSeries> seriesCreator, string xValueKey, string yValueKey) { _chart = chart; _xValueKey = xValueKey; _yValueKey = yValueKey; ChartSeries = seriesCreator; }
public override SChartData GetDataPoint(ShinobiChart chart, nint dataIndex, nint dataSeriesIndex) { return new SChartDataPoint { XValue = new NSNumber (dataIndex), YValue = new NSNumber (data [dataIndex]), }; }
public override void ViewDidLoad() { base.ViewDidLoad (); // Create the chart View.BackgroundColor = UIColor.White; nfloat margin = UserInterfaceIdiomIsPhone ? 10 : 50; CGRect frame = new CGRect (margin, margin, View.Bounds.Width - 2 * margin, View.Bounds.Height - 2 * margin); chart = new ShinobiChart (frame) { Title = "Apple Stock Price", AutoresizingMask = ~UIViewAutoresizing.None, LicenseKey = "" // TODO: add your trail licence key here! }; // Add a discountinuous date axis chart.XAxis = new SChartDateTimeAxis () { Title = "Date", EnableGesturePanning = true, EnableGestureZooming = true }; chart.YAxis = new SChartNumberAxis () { Title = "Price (USD)", EnableGesturePanning = true, EnableGestureZooming = true }; // Add to the view View.AddSubview (chart); chart.DataSource = new CandlestickChartDataSource (); }
void AddDateMarkerAnnoations (ShinobiChart chart) { // Read the annotations from a JSON file JsonValue annotations = JsonObject.Load(new StreamReader("./Annotations.json")); CGAffineTransform rotationTransform = CGAffineTransform.MakeRotation ((float)Math.PI / 2); // create a line and text annotation for each 'date' marker on the chart foreach (JsonValue annotation in annotations) { // Extract the data for this annotation NSDate date = dateFormatter.Parse (annotation ["date"]); NSNumber yValue = (int)annotation ["y-location"]; NSString text = new NSString(annotation ["annotation"]); // Add a vertical line annotation SChartAnnotation releaseAnnotation = SChartAnnotation.GetVerticalLine (date, chart.XAxis, chart.YAxis, 2, UIColor.FromWhiteAlpha (0.7f, 1)); releaseAnnotation.Position = SChartAnnotationPosition.AboveData; chart.AddAnnotation (releaseAnnotation); // Add a text annotation SChartAnnotation releaseLabel = SChartAnnotation.GetAnnotation (text, UIFont.SystemFontOfSize(14), chart.XAxis, chart.YAxis, date, yValue, UIColor.Black, chart.PlotBackgroundColor); //Rotate the text by 90 degrees releaseLabel.Transform = rotationTransform; releaseLabel.Position = SChartAnnotationPosition.AboveData; chart.AddAnnotation (releaseLabel); } }
void AddCustomAnnotation (ShinobiChart chart) { // Create an annotation SChartAnnotationZooming an = new SChartAnnotationZooming { XAxis = chart.XAxis, YAxis = chart.YAxis, // Set its location - using the data coordinate system XValue = dateFormatter.Parse ("01-01-2009"), YValue = new NSNumber(250), // Pin all four corners of the annotation so that it stretches XValueMax = dateFormatter.Parse ("01-01-2011"), YValueMax = new NSNumber(550), // Set bounds Bounds = new RectangleF (0, 0, 50, 50), Position = SChartAnnotationPosition.BelowData }; // Add some custom content to the annotation UIImage image = new UIImage ("Apple.png"); UIImageView imageView = new UIImageView (image) { Alpha = 0.1f }; an.AddSubview (imageView); // Add to the chart chart.AddAnnotation (an); }
protected override void OnAddingRadialLabel(ShinobiChart chart, UILabel label, SChartRadialDataPoint datapoint, int index, SChartRadialSeries series) { // hide labels for slice with < 5% language share if (datapoint.Value.DoubleValue < 5) { label.Hidden = true; } }
public override SChartSeries GetSeries(ShinobiChart chart, nint dataSeriesIndex) { SChartPieSeries series = new SChartPieSeries (); series.SelectedStyle.Protrusion = 10; series.SelectionAnimation.Duration = 0.4; series.SelectedPosition = 0; return series; }
public override SChartSeries GetSeries (ShinobiChart chart, int dataSeriesIndex) { SChartLineSeries series = new SChartLineSeries (); //series.Style.PointStyle.ShowPoints = true; //series.Style.PointStyle.Radius = 3; //series.Style.PointStyle.InnerRadius = 0.5; return series; }
public override SChartSeries GetSeries(ShinobiChart chart, int dataSeriesIndex) { SChartPieSeries series = new SChartPieSeries(); series.Style.ShowLabels = true; series.LabelFormatString = "%.0f%%"; return(series); }
public override void AlterDataPointLabel(ShinobiChart chart, SChartDataPointLabel label, SChartDataPoint dataPoint, SChartSeries series) { // Do some additional label styling label.Layer.CornerRadius = 10; label.BackgroundColor = UIColor.FromWhiteAlpha (0.8f, 1f); label.Frame = new CGRect (label.Frame.X -10, label.Frame.Y, label.Frame.Width + 20, label.Frame.Height); label.TextAlignment = UITextAlignment.Center; }
public override SChartData GetDataPoint(ShinobiChart chart, nint dataIndex, nint dataSeriesIndex) { var data = sales [(int)dataSeriesIndex].Item2 [(int)dataIndex]; return new SChartDataPoint { XValue = new NSString(data.Item1), YValue = new NSNumber(data.Item2) }; }
public override SChartData GetDataPoint(ShinobiChart chart, nint dataIndex, nint dataSeriesIndex) { string key = playerRatings.Keys.ElementAt ((int)dataIndex); return new SChartDataPoint { XValue = (NSString)key, YValue = NSNumber.FromNInt(playerRatings[key]), }; }
public override SChartData GetDataPoint (ShinobiChart chart, int dataIndex, int dataSeriesIndex) { var data = CurrentData[dataIndex]; return new SChartDataPoint { XValue = new NSString(data.Item1), YValue = new NSNumber(data.Item2) }; }
public override void ViewDidLoad() { base.ViewDidLoad(); // create the chart and add to the view _chart = new ShinobiChart(chartHostView.Bounds); _chart.LicenseKey = "<PUT YOUR LICENSE KEY HERE"; if (_chartTitle != null) { _chart.Title = _chartTitle; } // set the datasource _chartDataSource = new StockChartDataSource(); _chartDataSource.TintColor = View.TintColor; _chart.DataSource = _chartDataSource; // add a couple of axes _chart.XAxis = new SChartDateTimeAxis(); _chart.YAxis = new SChartNumberAxis(); ConfigureAxis(_chart.XAxis); ConfigureAxis(_chart.YAxis); // add a fancy border to the loading indicato progressIndicatorView.Layer.MasksToBounds = false; progressIndicatorView.Layer.CornerRadius = 10; progressIndicatorView.Layer.ShadowColor = UIColor.DarkGray.CGColor; progressIndicatorView.Layer.ShadowOpacity = 1.0f; progressIndicatorView.Layer.ShadowRadius = 6.0f; progressIndicatorView.Layer.ShadowOffset = new SizeF(0f, 3f); chartHostView.Hidden = true; chartHostView.InsertSubview(_chart, 0); // Add a nav bar button to add a trend line NavigationItem.SetRightBarButtonItem( new UIBarButtonItem(UIBarButtonSystemItem.Compose, (sender, e) => { // Present an alert view var alertView = new UIAlertView("Moving Average", "Set the period of the moving average", null, "OK", new string[] { "Cancel" }); alertView.Clicked += (alertSender, button) => { if (button.ButtonIndex == 0) { MovingAverageRequested(this, new MovingAverageRequestedEventArgs( int.Parse(alertView.GetTextField(0).Text)) ); } }; alertView.AlertViewStyle = UIAlertViewStyle.PlainTextInput; alertView.GetTextField(0).Placeholder = "Moving Average Period"; alertView.GetTextField(0).KeyboardType = UIKeyboardType.NumberPad; alertView.Show(); }) , true); }
protected override void OnRenderFinished (ShinobiChart chart) { if (!firstChartRender) { firstChartRender = true; AddDateMarkerAnnoations (chart); AddCustomAnnotation (chart); } }
public override void ViewDidLoad () { base.ViewDidLoad (); // create the chart and add to the view _chart = new ShinobiChart (chartHostView.Bounds); _chart.LicenseKey = "<PUT YOUR LICENSE KEY HERE"; if(_chartTitle != null) { _chart.Title = _chartTitle; } // set the datasource _chartDataSource = new StockChartDataSource (); _chartDataSource.TintColor = View.TintColor; _chart.DataSource = _chartDataSource; // add a couple of axes _chart.XAxis = new SChartDateTimeAxis (); _chart.YAxis = new SChartNumberAxis (); ConfigureAxis (_chart.XAxis); ConfigureAxis (_chart.YAxis); // add a fancy border to the loading indicato progressIndicatorView.Layer.MasksToBounds = false; progressIndicatorView.Layer.CornerRadius = 10; progressIndicatorView.Layer.ShadowColor = UIColor.DarkGray.CGColor; progressIndicatorView.Layer.ShadowOpacity = 1.0f; progressIndicatorView.Layer.ShadowRadius = 6.0f; progressIndicatorView.Layer.ShadowOffset = new SizeF (0f, 3f); chartHostView.Hidden = true; chartHostView.InsertSubview (_chart, 0); // Add a nav bar button to add a trend line NavigationItem.SetRightBarButtonItem ( new UIBarButtonItem (UIBarButtonSystemItem.Compose, (sender, e) => { // Present an alert view var alertView = new UIAlertView ("Moving Average", "Set the period of the moving average", null, "OK", new string[] { "Cancel" }); alertView.Clicked += (alertSender, button) => { if(button.ButtonIndex == 0) { MovingAverageRequested(this, new MovingAverageRequestedEventArgs ( int.Parse (alertView.GetTextField (0).Text)) ); } }; alertView.AlertViewStyle = UIAlertViewStyle.PlainTextInput; alertView.GetTextField (0).Placeholder = "Moving Average Period"; alertView.GetTextField (0).KeyboardType = UIKeyboardType.NumberPad; alertView.Show (); }) , true); }
protected override void OnAddingTickMark(ShinobiChart chart, SChartTickMark tickMark, SChartAxis axis) { // Hide any tickmarks over 100M on the right y-axis if (axis == chart.AllYAxes.Last ()) { if (tickMark.Value > 100.0f && tickMark.TickLabel != null && tickMark.TickMarkView != null) { tickMark.TickLabel.Text = ""; tickMark.TickMarkView.Hidden = true; } } }
public override SChartSeries GetSeries (ShinobiChart chart, int dataSeriesIndex) { SChartLineSeries series = new SChartLineSeries (); series.Style.ShowFill = true; // The first series is a cosine curve, the second is a sine curve series.Title = dataSeriesIndex == 0 ? "y = cos(x)" : "y = sin(x)"; return series; }
public override SChartData GetDataPoint(ShinobiChart chart, int dataIndex, int dataSeriesIndex) { if (dataSeriesIndex == 0) { return(_nonOwnerDPs [dataIndex]); } else { return(_ownerDPs [dataIndex]); } }
public override SChartData GetDataPoint(ShinobiChart chart, int dataIndex, int dataSeriesIndex) { if (dataSeriesIndex == 0) { return(_additionDPs [dataIndex]); } else { return(_removalDPs [dataIndex]); } }
public override int GetNumberOfSeries(ShinobiChart chart) { if (_movingAverageDataPoints != null) { return(2); } else { return(1); } }
public override int GetNumberOfDataPoints(ShinobiChart chart, int seriesIndex) { // Bit convoluted to get the z-index correct if (_movingAverageDataPoints == null || seriesIndex == 1) { return(_dataPoints.Count); } else { return(_movingAverageDataPoints.Count); } }
protected override SChartData[] GetDataPoints(ShinobiChart chart, int seriesIndex) { // Bit convoluted to get the z-index correct if (_movingAverageDataPoints == null || seriesIndex == 1) { return(_dataPoints.ToArray()); } else { return(_movingAverageDataPoints.ToArray()); } }
public override SChartSeries GetSeries(ShinobiChart chart, nint dataSeriesIndex) { SChartRadialLineSeries radialLineSeries = new SChartRadialLineSeries (); // Fill the series radialLineSeries.Style.ShowFill = true; // Join up the first and last points radialLineSeries.PointsWrapAround = true; return radialLineSeries; }
public override SChartData GetDataPoint (ShinobiChart chart, int dataIndex, int dataSeriesIndex) { SChartDataPoint datapoint = new SChartDataPoint (); // both functions share the same x-values double xValue = dataIndex / 10.0; datapoint.XValue = new NSNumber(xValue); // compute the y-value for each series datapoint.YValue = new NSNumber(dataSeriesIndex == 0 ? Math.Cos(xValue) : Math.Sin(xValue)); return datapoint; }
public override SChartSeries GetSeries(ShinobiChart chart, int dataSeriesIndex) { SChartColumnSeries series = new SChartColumnSeries(); series.StackIndex = 0; if (dataSeriesIndex == 0) { series.Title = "Non-owner"; } else { series.Title = "Owner"; } return(series); }
private void CreateChart() { _chart = new ShinobiChart(this.Bounds); _chart.LicenseKey = ShinobiLicenseKeyProviderJson.Instance.ChartsLicenseKey; _chart.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; // disable interaction - in order to allow paging of the container view _chart.UserInteractionEnabled = false; // add the delegate _delegate = new LanguageStatsDelegate(); _chart.Delegate = _delegate; // Add it as a subview this.Add(_chart); }
public override void ViewDidLoad() { base.ViewDidLoad (); // Set up chart ShinobiChart chart = new ShinobiChart (View.Bounds, SChartAxisType.Number, SChartAxisType.Number) { DataSource = new LabelledDatapointsDataSource(), Delegate = new LabelledDatapointsDelegate(), AutoresizingMask = ~UIViewAutoresizing.None, }; View.AddSubview (chart); chart.YAxis.RangePaddingLow = new NSNumber(0.5); chart.YAxis.RangePaddingHigh = new NSNumber(0.5); chart.RedrawChart (); }
public override SChartSeries GetSeries(ShinobiChart chart, int dataSeriesIndex) { SChartLineSeries series = new SChartLineSeries(); if (dataSeriesIndex == 0) { series.Title = "Additions"; } else { series.Title = "Deletions"; } series.Style.ShowFill = true; series.Baseline = 0; return(series); }
public override SChartSeries GetSeries(ShinobiChart chart, nint dataSeriesIndex) { string year = sales [(int)dataSeriesIndex].Item1; SChartColumnSeries columnSeries = new SChartColumnSeries { Title = year, SelectionMode = SChartSelection.Series }; columnSeries.Style.ShowAreaWithGradient = false; columnSeries.SelectedStyle.ShowAreaWithGradient = false; columnSeries.SelectedStyle.AreaColor = UIColor.Red; columnSeries.SelectedStyle.LineWidth = 0; // Set the selected state of the line series - this reflects the initial UI state columnSeries.Selected = year == DisplayYear; return columnSeries; }
public override SChartSeries GetSeries(ShinobiChart chart, nint dataSeriesIndex) { SChartColumnSeries series = new SChartColumnSeries (); // Display labels series.Style.DataPointLabelStyle.ShowLabels = true; // Position labels series.Style.DataPointLabelStyle.OffsetFromDataPoint = new CGPoint (0, -15); series.Style.DataPointLabelStyle.OffsetFlippedForNegativeValues = true; // Style labels series.Style.DataPointLabelStyle.TextColor = UIColor.Black; series.Style.DataPointLabelStyle.DisplayValues = SChartDataPointLabelDisplayValues.Y; return series; }
public override void ViewDidLoad () { base.ViewDidLoad (); View.BackgroundColor = UIColor.White; // 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 = "Trigonometric Functions", AutoresizingMask = ~UIViewAutoresizing.None, LicenseKey = "" // TODO: Add your trail licence key here! }; // Add a pair of axes SChartNumberAxis xAxis = new SChartNumberAxis () { Title = "X Value" }; chart.XAxis = xAxis; SChartNumberAxis yAxis = new SChartNumberAxis () { Title = "Y Value", RangePaddingLow = new NSNumber(0.1), RangePaddingHigh = new NSNumber(0.1) }; chart.YAxis = yAxis; // Enable gestures xAxis.EnableGesturePanning = true; xAxis.EnableGestureZooming = true; yAxis.EnableGesturePanning = true; yAxis.EnableGestureZooming = true; // Add to the view View.AddSubview (chart); // Set the data source chart.DataSource = new GettingStartedDataSource(); // Hide the legend if on displaying on iPhone to save space chart.Legend.Hidden = UserInterfaceIdiomIsPhone; }
public override void ViewDidLoad () { base.ViewDidLoad (); // Create the chart View.BackgroundColor = UIColor.White; float margin = UserInterfaceIdiomIsPhone ? 10 : 50; RectangleF frame = new RectangleF (margin, margin, View.Bounds.Width - 2 * margin, View.Bounds.Height - 2 * margin); chart = new ShinobiChart (frame) { Title = "Apple Stock price", AutoresizingMask = ~UIViewAutoresizing.None, LicenseKey = "" // TODO: add your trail licence key here! }; // A time period that defines the weekends SChartRepeatedTimePeriod weekends = new SChartRepeatedTimePeriod ( new NSDateFormatter { DateFormat = "dd-MM-yyyy" }.Parse ("02-01-2010"), SChartDateFrequency.CreateWithDay (2), SChartDateFrequency.CreateWithWeek (1)); // Add a discountinuous date axis SChartDiscontinuousDateTimeAxis xAxis = new SChartDiscontinuousDateTimeAxis (){ Title = "Date", EnableGesturePanning = true, EnableGestureZooming = true }; xAxis.AddExcludedRepeatedTimePeriod (weekends); chart.XAxis = xAxis; chart.YAxis = new SChartNumberAxis { Title = "Price (USD)", EnableGesturePanning = true, EnableGestureZooming = true }; View.AddSubview (chart); chart.DataSource = new TimeSeriesDataSource (); }
public override void ViewDidLoad () { base.ViewDidLoad (); // Create the chart chart = new ShinobiChart (new RectangleF(20, 20, View.Bounds.Width - 40, View.Bounds.Height - 40)) { Title = "Streaming", AutoresizingMask = ~UIViewAutoresizing.None, // Use a number axis for the x axis XAxis = new SChartNumberAxis(), // Use a number axis for the y axis YAxis = new SChartNumberAxis(), DataSource = new AppendDataDataSource() }; // Add the chart to the view controller View.AddSubview (chart); // Setup a timer to increment the data Timer timer = new Timer (); timer.Interval = 10; timer.Elapsed += (s, e) => { // Take care to update on the main thread BeginInvokeOnMainThread (() => { // Update our data (chart.DataSource as AppendDataDataSource).AdvanceData(); //Refresh the chart chart.RemoveFromStart(1, 0); chart.AppendToEnd(1, 0); chart.RedrawChart(); }); }; timer.Start (); }
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); }
public override SChartSeries GetSeries(ShinobiChart chart, int index) { var lineSeries = new SChartLineSeries(); // Bit convoluted to get the z-index correct if (_movingAverageDataPoints == null || index == 1) { lineSeries.Style.AreaLineColor = TintColor; lineSeries.Style.AreaColor = TintColor.ColorWithAlpha(0.1f); lineSeries.Style.AreaColorLowGradient = TintColor.ColorWithAlpha(0.8f); lineSeries.Style.AreaLineWidth = 1.0; lineSeries.Style.ShowFill = true; lineSeries.CrosshairEnabled = true; } else { lineSeries.Style.LineColor = UIColor.Red.ColorWithAlpha(0.8f); lineSeries.Style.LineWidth = 1.0; lineSeries.Style.ShowFill = false; lineSeries.CrosshairEnabled = false; } return(lineSeries); }
public override SChartData GetDataPoint(ShinobiChart chart, int dataIndex, int seriesIndex) { // no-op return(null); }
public override SChartSeries GetSeries(ShinobiChart chart, int dataSeriesIndex) { return(Series); }
public BindableDataSourceHelper(ShinobiChart chart, string xValueKey, string yValueKey) : this(chart, () => { return(new SChartLineSeries()); }, xValueKey, yValueKey) { }
public override SChartData GetDataPoint(ShinobiChart chart, int dataIndex, int dataSeriesIndex) { return(_dataPoints [dataIndex]); }
public override int GetNumberOfDataPoints(ShinobiChart chart, int dataSeriesIndex) { return(_languageFrequency.Count); }
public override int GetNumberOfDataPoints(ShinobiChart chart, int dataSeriesIndex) { return(_ownerDPs.Count()); }
public override int GetNumberOfSeries(ShinobiChart chart) { return(2); }
public override SChartData GetDataPoint(ShinobiChart chart, int dataIndex, int dataSeriesIndex) { return(_languageFrequency [dataIndex]); }