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;
			}
		}
示例#2
0
        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 ();
			
			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;
		}
        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;
        }
        /// <summary>
        /// Purpose: Set the chart properties and then draw the charts via the ShinobiChartDataSource class
        /// </summary>
        private void DrawChart()
        {

            float margin = 50 ;

            chart = new ShinobiChart (new CGRect (margin, margin, View.Bounds.Width - 2 * margin, View.Bounds.Height - 2 * margin)) {
                Title = LocalString.GetString("Umsatz36"),
                AutoresizingMask = ~UIViewAutoresizing.None,
//                LicenseKey = "MhVlc8KcDxk+okMMjAxNDExMTZzdGFkbGVyX2NoQGdteC5kZQ==VrdVExgHtimI03hvoPvQ0Htp5U9tP5Nlr5IZhOxwsNs0raEuZCbizUSybvAyb/Yo9HAgotyBC3gRciXIAggLCvgUH3QynASg3BZrgLOnD2v1B2NeJqgQmsthaRUbtO4W1W7wJKLNt2cWB1fBud4qhuLTB/h8=BQxSUisl3BaWf/7myRmmlIjRnMU2cA7q+/03ZX9wdj30RzapYANf51ee3Pi8m2rVW6aD7t6Hi4Qy5vv9xpaQYXF5T7XzsafhzS3hbBokp36BoJZg8IrceBj742nQajYyV7trx5GIw9jy/V6r0bvctKYwTim7Kzq+YPWGMtqtQoU=PFJTQUtleVZhbHVlPjxNb2R1bHVzPnh6YlRrc2dYWWJvQUh5VGR6dkNzQXUrUVAxQnM5b2VrZUxxZVdacnRFbUx3OHZlWStBK3pteXg4NGpJbFkzT2hGdlNYbHZDSjlKVGZQTTF4S2ZweWZBVXBGeXgxRnVBMThOcDNETUxXR1JJbTJ6WXA3a1YyMEdYZGU3RnJyTHZjdGhIbW1BZ21PTTdwMFBsNWlSKzNVMDg5M1N4b2hCZlJ5RHdEeE9vdDNlMD08L01vZHVsdXM+PEV4cG9uZW50PkFRQUI8L0V4cG9uZW50PjwvUlNBS2V5VmFsdWU+" // TODO: Add your trail licence key here!
           };
//            SChartNumberAxis xAxis = new SChartNumberAxis () {
//                Title = "X Value",
//                EnableGesturePanning = false,
//                EnableGestureZooming = true
//            };
//            chart.XAxis = xAxis;

            // Add a pair of axes

            SChartDateTimeAxis xAxis= new SChartDateTimeAxis () {
                Title = LocalString.GetString("Datum"),
                EnableGesturePanning = false,
                EnableGestureZooming = true
            };
//            SChartDiscontinuousDateTimeAxis xAxis = new SChartDiscontinuousDateTimeAxis () {
//                Title = "Datum",
//                EnableGesturePanning = false,
//                EnableGestureZooming = true
//            };
            chart.XAxis = xAxis;

            SChartNumberAxis yAxis = new SChartNumberAxis () {
                Title = LocalString.GetString("Umsatz"),
                EnableGesturePanning = true,
                EnableGestureZooming = true,
                RangePaddingLow = new NSNumber(0.1),
                RangePaddingHigh = new NSNumber(0.1)
            };
            chart.YAxis = yAxis;



            // Add to the view
            View.AddSubview (chart);

            // Set the data source
            chart.DataSource = new ShinobiChartDataSource(_person);

            // Hide the legend if on displaying on iPhone to save space
            chart.Legend.Hidden = false;

      }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            NSDateFormatter dateFormatter = new NSDateFormatter { DateFormat = "dd-MM-yyyy" };

            // 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 Pirce",
                AutoresizingMask = ~UIViewAutoresizing.None,

                LicenseKey = "", // TODO: add your trail license key here!

                // add X & Y axes, with explicit ranges so that the chart is initially rendered 'zoomed in'
                XAxis = new SChartDateTimeAxis(new SChartDateRange(dateFormatter.Parse("01-01-2010"), dateFormatter.Parse("01-06-2010"))) {
                    Title = "Date",
                    EnableGesturePanning = true,
                    EnableGestureZooming = true
                },

                YAxis = new SChartNumberAxis(new SChartNumberRange(150, 300)) {
                    Title = "Price (USD)",
                    EnableGesturePanning = true,
                    EnableGestureZooming = true
                },

                DataSource = new MultipleAxesDataSource(),
                Delegate = new MultipleAxesDelegate()
            };

            // Add a secondary y-axis for volume
            SChartNumberAxis volumeAxis = new SChartNumberAxis {
                // Render on the right-hand side
                AxisPosition = SChartAxisPosition.Reverse,
                Title = "Volume",
                // Add an upper padding so that the volume chart occupies the bottom hald of the plot area
                RangePaddingHigh = new NSNumber(100)
            };

            NSNumberFormatter volumeFormatter = (volumeAxis.LabelFormatter.Formatter as NSNumberFormatter);
            volumeFormatter.MaximumFractionDigits = 0;
            volumeFormatter.PositiveSuffix = "M";
            volumeFormatter.NegativeSuffix = "M";

            // Hide gridlines
            volumeAxis.Style.MajorGridLineStyle.ShowMajorGridLines = false;
            chart.AddYAxis (volumeAxis);

            View.AddSubview (chart);
        }