Пример #1
0
 public override TKChartData GetPoint(TKChart chart, nuint dataIndex, nuint seriesIndex)
 {
     TKChartDataPoint point = new TKChartDataPoint ();
     point.DataXValue = new NSNumber (dataIndex);
     point.DataYValue = new NSNumber(r.Next (100));
     return point;
 }
Пример #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            chart = new TKChart(this.View.Bounds);
            chart.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            chart.Delegate         = chartDelegate;
            this.View.AddSubview(chart);

            int[] values  = new int[] { 58, 59, 61, 64, 66, 69, 72, 72, 69 };
            int[] values1 = new int[] { 42, 44, 47, 51, 56, 61, 62, 64, 62 };
            List <TKChartDataPoint> dataPoints  = new List <TKChartDataPoint> ();
            List <TKChartDataPoint> dataPoints1 = new List <TKChartDataPoint> ();

            for (int i = 0; i < values.Length; i++)
            {
                TKChartDataPoint point  = new TKChartDataPoint(new NSNumber(i), new NSNumber(values [i]));
                TKChartDataPoint point1 = new TKChartDataPoint(new NSNumber(i), new NSNumber(values1 [i]));
                dataPoints.Add(point);
                dataPoints1.Add(point1);
            }

            // >> chart-pointlabels-cs
            TKChartLineSeries lineSeries = new TKChartLineSeries(dataPoints.ToArray());

            lineSeries.SelectionMode    = TKChartSeriesSelectionMode.DataPoint;
            lineSeries.Style.PointShape = new TKPredefinedShape(TKShapeType.Circle, new SizeF(8, 8));
            lineSeries.Style.PointLabelStyle.TextHidden    = false;
            lineSeries.Style.PointLabelStyle.LabelOffset   = new UIOffset(0, -24);
            lineSeries.Style.PointLabelStyle.Insets        = new UIEdgeInsets(-1, -5, -1, -5);
            lineSeries.Style.PointLabelStyle.LayoutMode    = TKChartPointLabelLayoutMode.Manual;
            lineSeries.Style.PointLabelStyle.Font          = UIFont.SystemFontOfSize(10);
            lineSeries.Style.PointLabelStyle.TextAlignment = UITextAlignment.Center;
            lineSeries.Style.PointLabelStyle.TextColor     = UIColor.White;
            lineSeries.Style.PointLabelStyle.Fill          = new TKSolidFill(new UIColor((float)(108 / 255.0), (float)(181 / 255.0), (float)(250 / 255.0), (float)1.0));
            lineSeries.Style.PointLabelStyle.ClipMode      = TKChartPointLabelClipMode.Hidden;
            // << chart-pointlabels-cs

            TKChartLineSeries lineSeries1 = new TKChartLineSeries(dataPoints1.ToArray());

            lineSeries1.SelectionMode    = TKChartSeriesSelectionMode.DataPoint;
            lineSeries1.Style.PointShape = new TKPredefinedShape(TKShapeType.Circle, new SizeF(8, 8));
            lineSeries1.Style.PointLabelStyle.TextHidden    = false;
            lineSeries1.Style.PointLabelStyle.LabelOffset   = new UIOffset(0, -24);
            lineSeries1.Style.PointLabelStyle.Insets        = new UIEdgeInsets(-1, -5, -1, -5);
            lineSeries1.Style.PointLabelStyle.LayoutMode    = TKChartPointLabelLayoutMode.Manual;
            lineSeries1.Style.PointLabelStyle.Font          = UIFont.SystemFontOfSize(10);
            lineSeries1.Style.PointLabelStyle.TextAlignment = UITextAlignment.Center;
            lineSeries1.Style.PointLabelStyle.TextColor     = UIColor.White;
            lineSeries1.Style.PointLabelStyle.Fill          = new TKSolidFill(new UIColor((float)(241 / 255.0), (float)(140 / 255.0), (float)(133 / 255.0), (float)1.0));
            lineSeries1.Style.PointLabelStyle.ClipMode      = TKChartPointLabelClipMode.Hidden;

            TKChartNumericAxis yAxis = new TKChartNumericAxis(new NSNumber(40), new NSNumber(80));

            yAxis.MajorTickInterval = new NSNumber(10);
            chart.YAxis             = yAxis;

            chart.AddSeries(lineSeries);
            chart.AddSeries(lineSeries1);
        }
Пример #3
0
        private void CustomLabelsSelected()
        {
            chart.RemoveAllData();

            List <TKChartDataPoint> items = new List <TKChartDataPoint> ();

            for (int i = 0; i < names.Length; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    NSDate           date  = this.DateWithYear(j + 2002, 1, 1);
                    TKChartDataPoint point = new TKChartDataPoint(date, new NSNumber(this.r.Next(50) + offsets[i]));
                    items.Add(point);
                }

                TKChartSplineAreaSeries series = new TKChartSplineAreaSeries(items.ToArray());
                series.Title = names[i];
                chart.AddSeries(series);
                items.Clear();
            }

            // >> chart-custom-axis-labels-cs
            this.chart.YAxis.CustomLabels = new NSDictionary(new NSNumber(100), UIColor.Blue,
                                                             new NSNumber(200), UIColor.Yellow,
                                                             new NSNumber(400), UIColor.Red);
            // << chart-custom-axis-labels-cs
        }
Пример #4
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			chart = new TKChart (this.View.Bounds);
			chart.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
			chart.Delegate = chartDelegate;
			this.View.AddSubview (chart);

			Random r = new Random ();
			List<TKChartDataPoint> dataPoints = new List<TKChartDataPoint> ();
			for (int i = 0; i < 10; i++) {
				TKChartDataPoint point = new TKChartDataPoint (new NSNumber (i), new NSNumber (r.Next () % 100));
				dataPoints.Add (point);
			}

			TKChartColumnSeries columnSeries = new TKChartColumnSeries (dataPoints.ToArray ());
			columnSeries.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
			columnSeries.Style.PointLabelStyle.TextHidden = false;
			columnSeries.Style.PointLabelStyle.LayoutMode = TKChartPointLabelLayoutMode.Manual;
			columnSeries.Style.PointLabelStyle.LabelOffset = new UIOffset (0, -10);
			columnSeries.Style.PointLabelStyle.Insets = new UIEdgeInsets (-1, -5, -1, -5);
			columnSeries.Style.PointLabelStyle.Font = UIFont.SystemFontOfSize (10);
			columnSeries.Style.PointLabelStyle.TextAlignment = UITextAlignment.Center;
			columnSeries.Style.PointLabelStyle.ClipMode = TKChartPointLabelClipMode.Visible;
			columnSeries.Style.PointLabelStyle.TextColor = UIColor.White;
			columnSeries.Style.PointLabelStyle.Fill = new TKSolidFill (new UIColor ((float)(108 / 255.0), (float)(181 / 255.0), (float)(250 / 255.0), (float)1.0));

			chart.AddSeries (columnSeries);
			chart.Select (new TKChartSelectionInfo (chart.Series [0], 3));
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            chart = new TKChart(this.View.Bounds);
            chart.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            chart.Delegate         = chartDelegate;
            this.View.AddSubview(chart);

            Random r = new Random();
            List <TKChartDataPoint> dataPoints = new List <TKChartDataPoint> ();

            for (int i = 0; i < 10; i++)
            {
                TKChartDataPoint point = new TKChartDataPoint(new NSNumber(i), new NSNumber(r.Next() % 100));
                dataPoints.Add(point);
            }

            TKChartColumnSeries columnSeries = new TKChartColumnSeries(dataPoints.ToArray());

            columnSeries.Selection = TKChartSeriesSelection.DataPoint;
            columnSeries.Style.PointLabelStyle.TextHidden    = false;
            columnSeries.Style.PointLabelStyle.LayoutMode    = TKChartPointLabelLayoutMode.Manual;
            columnSeries.Style.PointLabelStyle.LabelOffset   = new UIOffset(0, -10);
            columnSeries.Style.PointLabelStyle.Insets        = new UIEdgeInsets(-1, -5, -1, -5);
            columnSeries.Style.PointLabelStyle.Font          = UIFont.SystemFontOfSize(10);
            columnSeries.Style.PointLabelStyle.TextAlignment = UITextAlignment.Center;
            columnSeries.Style.PointLabelStyle.ClipMode      = TKChartPointLabelClipMode.Visible;
            columnSeries.Style.PointLabelStyle.TextColor     = UIColor.White;
            columnSeries.Style.PointLabelStyle.Fill          = new TKSolidFill(new UIColor((float)(108 / 255.0), (float)(181 / 255.0), (float)(250 / 255.0), (float)1.0));

            chart.AddSeries(columnSeries);
            chart.Select(new TKChartSelectionInfo(chart.Series [0], 3));
        }
Пример #6
0
        private void CustomDrawingSelected()
        {
            chart.RemoveAllData();

            MyAxis axis = new MyAxis(new NSNumber(100), new NSNumber(450));

            chart.YAxis = axis;

            List <TKChartDataPoint> items = new List <TKChartDataPoint> ();

            for (int i = 0; i < names.Length; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    NSDate           date  = this.DateWithYear(j + 2002, 1, 1);
                    TKChartDataPoint point = new TKChartDataPoint(date, new NSNumber(this.r.Next(50) + offsets[i]));
                    items.Add(point);
                }

                TKChartSplineAreaSeries series = new TKChartSplineAreaSeries(items.ToArray());
                series.Title = names[i];
                // >> chart-style-fill-cs
                series.Style.Palette = new TKChartPalette();
                TKChartPaletteItem palleteItem = new TKChartPaletteItem();
                palleteItem.Stroke = new TKStroke(strokes[i], 1.5f);
                palleteItem.Fill   = new TKLinearGradientFill(fills[i], new CGPoint(0, 0), new CGPoint(1, 1));
                series.Style.Palette.AddPaletteItem(palleteItem);
                // << chart-style-fill-cs
                chart.AddSeries(series);
                items.Clear();
            }
        }
Пример #7
0
        public void UpdateChart(NSTimer tr)
        {
            this.chart.RemoveAllData();
            Random           r         = new Random();
            TKChartDataPoint dataPoint = new TKChartDataPoint(NSDate.Now, new NSNumber(r.Next() % 70));

            this.dataPoints.Add(dataPoint);
            if (this.dataPoints.Count > 25)
            {
                this.dataPoints.RemoveAt(0);
            }

            this.chart.YAxis = new TKChartNumericAxis(new NSNumber(0), new NSNumber(100));
            TKChartDataPoint    firstPoint = this.dataPoints [0];
            TKChartDataPoint    lastPoint  = this.dataPoints [this.dataPoints.Count - 1];
            TKChartDateTimeAxis xAxis      = new TKChartDateTimeAxis(firstPoint.DataXValue, lastPoint.DataXValue);

            xAxis.Style.LabelStyle.FitMode = TKChartAxisLabelFitMode.None;
            xAxis.Style.MajorTickStyle.MaxTickClippingMode = TKChartAxisClippingMode.Visible;
            xAxis.MajorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Seconds;
            this.chart.XAxis            = xAxis;

            this.lineSeries = new TKChartLineSeries(this.dataPoints.ToArray());
            this.chart.AddSeries(this.lineSeries);
            this.chart.ReloadData();
        }
Пример #8
0
            public override ITKChartData GetPoint(TKChart chart, nuint dataIndex, nuint seriesIndex)
            {
                TKChartDataPoint point = new TKChartDataPoint();

                point.DataXValue = new NSNumber(dataIndex);
                point.DataYValue = new NSNumber(r.Next(100));
                return((ITKChartData)point);
            }
Пример #9
0
        public override void ViewDidLoad()
        {
            this.AddOption ("Bar Series", LoadBarSeries);
            this.AddOption ("Column Series", LoadColumnSeries);
            this.AddOption ("Line Series", LoadLineSeries);
            this.AddOption ("Pie Series", LoadPieSeries);
            this.AddOption ("Ohlc Series", LoadFinancialSeries);

            base.ViewDidLoad ();

            chart = new TKChart (this.ExampleBounds);
            chart.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            chart.AllowAnimations = true;
            chart.Delegate = chartDelegate;
            this.View.AddSubview (chart);

            Random r = new Random ();
            columnData = new List<TKChartDataPoint> ();
            barData = new List<TKChartDataPoint> ();
            string[] categories = new string[] { "Greetings", "Perfecto", "NearBy", "Family Store", "Fresh & Green" };
            for (int i = 0; i < categories.Length; i++) {
                TKChartDataPoint columnPoint = new TKChartDataPoint (new NSString (categories [i]), new NSNumber (r.Next () % 100));
                TKChartDataPoint barPoint = new TKChartDataPoint (new NSNumber (r.Next () % 100), NSObject.FromObject(categories[i]));
                columnData.Add (columnPoint);
                barData.Add (barPoint);
            }

            lineData = new List<TKChartDataPoint> ();
            int[] lineValues = new int[] { 82, 68, 83, 46, 32, 75, 8, 54, 47, 51 };
            for (int i = 0; i < lineValues.Length; i++) {
                TKChartDataPoint point = new TKChartDataPoint (new NSNumber (i), new NSNumber (lineValues [i]));
                lineData.Add (point);
            }

            pieDonutData = new List<TKChartDataPoint> ();
            pieDonutData.Add (new TKChartDataPoint (new NSNumber (20), null, "Google"));
            pieDonutData.Add (new TKChartDataPoint (new NSNumber (30), null, "Apple"));
            pieDonutData.Add (new TKChartDataPoint (new NSNumber (10), null, "Microsoft"));
            pieDonutData.Add (new TKChartDataPoint (new NSNumber (5), null, "IBM"));
            pieDonutData.Add (new TKChartDataPoint (new NSNumber (8), null, "Oracle"));

            int[] openPrices = new int[] { 100, 125, 69, 99, 140, 125 };
            int[] closePrices = new int[] { 85, 65, 135, 120, 80, 136 };
            int[] lowPrices = new int[] { 50, 60, 65, 55, 75, 90 };
            int[] highPrices = new int[] { 129, 142, 141, 123, 150, 161 };
            ohlcData = new List<TKChartFinancialDataPoint> ();
            for (int i = 0; i < openPrices.Length; i++) {
                NSDate date = NSDate.FromTimeIntervalSinceNow (60 * 60 * 24 * i);
                NSNumber open = new NSNumber (openPrices [i]);
                NSNumber high = new NSNumber (highPrices [i]);
                NSNumber low = new NSNumber (lowPrices [i]);
                NSNumber close = new NSNumber (closePrices [i]);
                TKChartFinancialDataPoint point = TKChartFinancialDataPoint.DataPoint(date, open, high, low, close);
                ohlcData.Add (point);
            }

            this.LoadBarSeries (this, EventArgs.Empty);
        }
Пример #10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            chart = new TKChart(this.ExampleBounds);
            chart.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            chart.AllowAnimations  = true;
            chart.Delegate         = new ChartDelegate();
            this.View.AddSubview(chart);

            Random r = new Random();

            columnData = new List <TKChartDataPoint> ();
            barData    = new List <TKChartDataPoint> ();
            string[] categories = new string[] { "Greetings", "Perfecto", "NearBy", "Family Store", "Fresh & Green" };
            for (int i = 0; i < categories.Length; i++)
            {
                TKChartDataPoint columnPoint = new TKChartDataPoint(new NSString(categories [i]), new NSNumber(r.Next() % 100));
                TKChartDataPoint barPoint    = new TKChartDataPoint(new NSNumber(r.Next() % 100), NSObject.FromObject(categories[i]));
                columnData.Add(columnPoint);
                barData.Add(barPoint);
            }

            lineData = new List <TKChartDataPoint> ();
            int[] lineValues = new int[] { 82, 68, 83, 46, 32, 75, 8, 54, 47, 51 };
            for (int i = 0; i < lineValues.Length; i++)
            {
                TKChartDataPoint point = new TKChartDataPoint(new NSNumber(i), new NSNumber(lineValues [i]));
                lineData.Add(point);
            }

            pieDonutData = new List <TKChartDataPoint> ();
            pieDonutData.Add(new TKChartDataPoint(new NSNumber(20), null, "Google"));
            pieDonutData.Add(new TKChartDataPoint(new NSNumber(30), null, "Apple"));
            pieDonutData.Add(new TKChartDataPoint(new NSNumber(10), null, "Microsoft"));
            pieDonutData.Add(new TKChartDataPoint(new NSNumber(5), null, "IBM"));
            pieDonutData.Add(new TKChartDataPoint(new NSNumber(8), null, "Oracle"));

            int[] openPrices  = new int[] { 100, 125, 69, 99, 140, 125 };
            int[] closePrices = new int[] { 85, 65, 135, 120, 80, 136 };
            int[] lowPrices   = new int[] { 50, 60, 65, 55, 75, 90 };
            int[] highPrices  = new int[] { 129, 142, 141, 123, 150, 161 };
            ohlcData = new List <TKChartDataPoint> ();
            for (int i = 0; i < openPrices.Length; i++)
            {
                NSDate   date  = NSDate.FromTimeIntervalSinceNow(60 * 60 * 24 * i);
                NSNumber open  = new NSNumber(openPrices [i]);
                NSNumber high  = new NSNumber(highPrices [i]);
                NSNumber low   = new NSNumber(lowPrices [i]);
                NSNumber close = new NSNumber(closePrices [i]);
                TKChartFinancialDataPoint point = TKChartFinancialDataPoint.DataPoint(date, open, high, low, close);
                ohlcData.Add(point);
            }

            this.LoadBarSeries(this, EventArgs.Empty);
        }
Пример #11
0
            public override TKChartPointLabel LabelForDataPoint(TKChart chart, TKChartData dataPoint, string propertyName, TKChartSeries series, nuint dataIndex)
            {
                TKChartDataPoint point = (TKChartDataPoint)dataPoint;

                if (series.Index == (nuint)this.selectedSeriesIndex && dataIndex == (nuint)this.selectedDataPointIndex)
                {
                    return(new MyPointLabel(point, series, String.Format("{0}", point.DataYValue)));
                }


                return(new TKChartPointLabel(point, series, String.Format("{0}", point.DataYValue)));
            }
Пример #12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            chart = new TKChart (this.ExampleBounds);
            chart.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            chart.Delegate = new ChartDelegate (0, 3);
            this.View.AddSubview (chart);

            int[] values = new int[] { 58, 59, 61, 64, 66, 69, 72, 72, 69 };
            int[] values1 = new int[] { 42, 44, 47, 51, 56, 61, 62, 64, 62 };
            List<TKChartDataPoint> dataPoints = new List<TKChartDataPoint> ();
            List<TKChartDataPoint> dataPoints1 = new List<TKChartDataPoint> ();
            for (int i = 0; i < values.Length; i++) {
                TKChartDataPoint point = new TKChartDataPoint (new NSNumber (i), new NSNumber (values [i]));
                TKChartDataPoint point1 = new TKChartDataPoint (new NSNumber (i), new NSNumber (values1 [i]));
                dataPoints.Add (point);
                dataPoints1.Add (point1);
            }

            TKChartLineSeries lineSeries = new TKChartLineSeries (dataPoints.ToArray ());
            lineSeries.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
            lineSeries.Style.PointShape = new TKPredefinedShape (TKShapeType.Circle, new SizeF (8, 8));
            lineSeries.Style.PointLabelStyle.TextHidden = false;
            lineSeries.Style.PointLabelStyle.LabelOffset = new UIOffset (0, -24);
            lineSeries.Style.PointLabelStyle.Insets = new UIEdgeInsets (-1, -5, -1, -5);
            lineSeries.Style.PointLabelStyle.LayoutMode = TKChartPointLabelLayoutMode.Manual;
            lineSeries.Style.PointLabelStyle.Font = UIFont.SystemFontOfSize (10);
            lineSeries.Style.PointLabelStyle.TextAlignment = UITextAlignment.Center;
            lineSeries.Style.PointLabelStyle.TextColor = UIColor.White;
            lineSeries.Style.PointLabelStyle.Fill = new TKSolidFill (new UIColor ((float)(108 / 255.0), (float)(181 / 255.0), (float)(250 / 255.0), (float)1.0));
            lineSeries.Style.PointLabelStyle.ClipMode = TKChartPointLabelClipMode.Hidden;

            TKChartLineSeries lineSeries1 = new TKChartLineSeries (dataPoints1.ToArray ());
            lineSeries1.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
            lineSeries1.Style.PointShape = new TKPredefinedShape (TKShapeType.Circle, new SizeF (8, 8));
            lineSeries1.Style.PointLabelStyle.TextHidden = false;
            lineSeries1.Style.PointLabelStyle.LabelOffset = new UIOffset (0, -24);
            lineSeries1.Style.PointLabelStyle.Insets = new UIEdgeInsets (-1, -5, -1, -5);
            lineSeries1.Style.PointLabelStyle.LayoutMode = TKChartPointLabelLayoutMode.Manual;
            lineSeries1.Style.PointLabelStyle.Font = UIFont.SystemFontOfSize (10);
            lineSeries1.Style.PointLabelStyle.TextAlignment = UITextAlignment.Center;
            lineSeries1.Style.PointLabelStyle.TextColor = UIColor.White;
            lineSeries1.Style.PointLabelStyle.Fill = new TKSolidFill (new UIColor ((float)(241 / 255.0), (float)(140 / 255.0), (float)(133 / 255.0), (float)1.0));
            lineSeries1.Style.PointLabelStyle.ClipMode = TKChartPointLabelClipMode.Hidden;

            TKChartNumericAxis yAxis = new TKChartNumericAxis (new NSNumber (40), new NSNumber (80));
            yAxis.MajorTickInterval = new NSNumber (10);
            chart.YAxis = yAxis;

            chart.AddSeries (lineSeries);
            chart.AddSeries (lineSeries1);
        }
        public override TKChartPointLabel LabelForDataPoint(TKChart chart, TKChartData dataPoint, string propertyName, TKChartSeries series, nuint dataIndex)
        {
            // On iOS, a vertical bar chart is a "Column" series
            if (series is TKChartColumnSeries)
            {
                // If it's a BarSeries use vertical label
                TKChartDataPoint point = (TKChartDataPoint)dataPoint;
                series.Style.ShapeMode = TKChartSeriesStyleShapeMode.AlwaysShow;

                series.Style.PointLabelStyle.LayoutMode = TKChartPointLabelLayoutMode.Manual;
                series.Style.PointLabelStyle.Fill       = new TKSolidFill(UIColor.White);
                series.Style.PointLabelStyle.Insets     = new UIEdgeInsets(-1, -3, -1, -3);

                // Position the label at your preferred position
                series.Style.PointLabelStyle.LabelOffset = new UIOffset(0, 200);

                // Set the text properties
                series.Style.PointLabelStyle.TextOrientation = TKChartPointLabelOrientation.Vertical;
                series.Style.PointLabelStyle.TextAlignment   = UITextAlignment.Center;
                series.Style.PointLabelStyle.TextColor       = UIColor.Blue;
                series.Style.PointLabelStyle.TextHidden      = false;

                return(new TKChartPointLabel(point, series, point.DataYValue.ToString()));
            }
            else
            {
                // use horizontal label for everything else
                TKChartDataPoint point = (TKChartDataPoint)dataPoint;

                series.Style.PointShape = new TKPredefinedShape(TKShapeType.Circle, new System.Drawing.SizeF(8, 8));
                series.Style.PointLabelStyle.TextHidden      = false;
                series.Style.PointLabelStyle.LabelOffset     = new UIOffset(0, -24);
                series.Style.PointLabelStyle.Insets          = new UIEdgeInsets(-1, -5, -1, -5);
                series.Style.PointLabelStyle.LayoutMode      = TKChartPointLabelLayoutMode.Manual;
                series.Style.PointLabelStyle.Font            = UIFont.SystemFontOfSize(10);
                series.Style.PointLabelStyle.TextAlignment   = UITextAlignment.Center;
                series.Style.PointLabelStyle.Fill            = new TKSolidFill(new UIColor((float)(108 / 255.0), (float)(181 / 255.0), (float)(250 / 255.0), (float)1.0));
                series.Style.PointLabelStyle.ClipMode        = TKChartPointLabelClipMode.Hidden;
                series.Style.PointLabelStyle.TextOrientation = TKChartPointLabelOrientation.Horizontal;
                series.Style.PointLabelStyle.TextColor       = UIColor.Red;
                series.Style.ShapeMode = TKChartSeriesStyleShapeMode.AlwaysShow;


                return(new TKChartPointLabel(point, series, $"{point.DataName}, {point.DataYValue}"));
            }
        }
        private TKChartPointLabel CreateHorizontalLabel(TKChartSeries series, TKChartDataPoint dataPoint)
        {
            series.Style.PointShape = new TKPredefinedShape(TKShapeType.Circle, new System.Drawing.SizeF(8, 8));
            series.Style.PointLabelStyle.TextHidden      = false;
            series.Style.PointLabelStyle.LabelOffset     = new UIOffset(0, -24);
            series.Style.PointLabelStyle.Insets          = new UIEdgeInsets(-1, -5, -1, -5);
            series.Style.PointLabelStyle.LayoutMode      = TKChartPointLabelLayoutMode.Manual;
            series.Style.PointLabelStyle.Font            = UIFont.SystemFontOfSize(10);
            series.Style.PointLabelStyle.TextAlignment   = UITextAlignment.Center;
            series.Style.PointLabelStyle.Fill            = new TKSolidFill(new UIColor((float)(108 / 255.0), (float)(181 / 255.0), (float)(250 / 255.0), (float)1.0));
            series.Style.PointLabelStyle.ClipMode        = TKChartPointLabelClipMode.Hidden;
            series.Style.PointLabelStyle.TextOrientation = TKChartPointLabelOrientation.Horizontal;
            series.Style.PointLabelStyle.TextColor       = UIColor.Red;
            series.Style.ShapeMode = TKChartSeriesStyleShapeMode.AlwaysShow;

            return(new TKChartPointLabel(dataPoint, series, $"{dataPoint.DataName}, {dataPoint.DataYValue}"));
        }
Пример #15
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.chart.Frame            = this.View.Bounds;
            this.chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.View.AddSubview(this.chart);

            MyAxis axis = new MyAxis(new NSNumber(100), new NSNumber(450));

            chart.YAxis         = axis;
            chart.Legend.Hidden = false;

            string[]  names   = new string[] { "Upper class", "Upper middle class", "Middle class", "Lower middle class" };
            nfloat[]  offsets = new nfloat[] { 350, 250, 150, 100 };
            UIColor[] strokes = new UIColor[] { new UIColor(0.5f, 0.5f, 0.5f, 0.5f),
                                                new UIColor(0.3f, 0.3f, 0.3f, 0.6f),
                                                new UIColor(0.1f, 0.1f, 0.1f, 0.6f),
                                                new UIColor(0.1f, 0.1f, 0.1f, 0.6f) };
            UIColor[][] fills = new UIColor[][] { new UIColor[] { new UIColor(0.78f, 0.81f, 0.86f, 0.5f), new UIColor(0.5f, 0.5f, 0.5f, 0.5f) },
                                                  new UIColor[] { new UIColor(0.78f, 0.76f, 0.70f, 1.0f), new UIColor(0.5f, 0.5f, 0.5f, 0.5f) },
                                                  new UIColor[] { new UIColor(0.80f, 0.73f, 0.67f, 1.0f), new UIColor(0.5f, 0.5f, 0.5f, 0.5f) },
                                                  new UIColor[] { new UIColor(0.70f, 0.58f, 0.58f, 1.0f), new UIColor(0.5f, 0.5f, 0.5f, 0.5f) } };
            List <TKChartDataPoint> items = new List <TKChartDataPoint> ();

            for (int i = 0; i < names.Length; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    NSDate           date  = this.DateWithYear(j + 2002, 1, 1);
                    TKChartDataPoint point = new TKChartDataPoint(date, new NSNumber(this.r.Next(50) + offsets[i]));
                    items.Add(point);
                }

                TKChartSplineAreaSeries series = new TKChartSplineAreaSeries(items.ToArray());
                series.Title         = names[i];
                series.Style.Palette = new TKChartPalette();
                TKChartPaletteItem palleteItem = new TKChartPaletteItem();
                palleteItem.Stroke = new TKStroke(strokes[i], 1.5f);
                palleteItem.Fill   = new TKLinearGradientFill(fills[i], new CGPoint(0, 0), new CGPoint(1, 1));
                series.Style.Palette.AddPaletteItem(palleteItem);
                chart.AddSeries(series);
                items.Clear();
            }
        }
Пример #16
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            this.chart.Frame = this.ExampleBounds;
            this.chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.View.AddSubview (this.chart);

            MyAxis axis = new MyAxis (new NSNumber (100), new NSNumber (450));
            chart.YAxis = axis;
            chart.Legend.Hidden = false;

            string[] names = new string[] { "Upper class", "Upper middle class", "Middle class", "Lower middle class" };
            nfloat[] offsets = new nfloat[] { 350, 250, 150, 100 };
            UIColor[] strokes = new UIColor[]{ new UIColor(0.5f, 0.5f, 0.5f, 0.5f),
                new UIColor(0.3f, 0.3f, 0.3f, 0.6f),
                new UIColor(0.1f, 0.1f, 0.1f, 0.6f),
                new UIColor(0.1f, 0.1f, 0.1f, 0.6f)
            };
            UIColor[][] fills = new UIColor[][]{ new UIColor[]{ new UIColor(0.78f, 0.81f, 0.86f, 0.5f), new UIColor(0.5f, 0.5f, 0.5f, 0.5f) },
                new UIColor[] { new UIColor(0.78f, 0.76f, 0.70f, 1.0f), new UIColor(0.5f, 0.5f, 0.5f, 0.5f) },
                new UIColor[] { new UIColor(0.80f, 0.73f, 0.67f, 1.0f), new UIColor(0.5f, 0.5f, 0.5f, 0.5f) },
                new UIColor[] { new UIColor(0.70f, 0.58f, 0.58f, 1.0f), new UIColor(0.5f, 0.5f, 0.5f, 0.5f) }
            };
            List<TKChartDataPoint> items = new List<TKChartDataPoint> ();

            for (int i = 0; i< names.Length; i++) {

                for (int j = 0; j<10; j++) {
                    NSDate date = this.DateWithYear(j + 2001, 1, 1);
                    TKChartDataPoint point = new TKChartDataPoint(date, new NSNumber(this.r.Next(50) + offsets[i]));
                    items.Add (point);
                }

                TKChartSplineAreaSeries series = new TKChartSplineAreaSeries(items.ToArray());
                series.Title = names[i];
                series.Style.Palette = new TKChartPalette ();
                TKChartPaletteItem palleteItem = new TKChartPaletteItem ();
                palleteItem.Stroke = new TKStroke(strokes[i], 1.5f);
                palleteItem.Fill = new TKLinearGradientFill (fills[i], new CGPoint(0, 0), new CGPoint(1, 1));
                series.Style.Palette.AddPaletteItem(palleteItem);
                chart.AddSeries(series);
                items.Clear ();
            }
        }
        private TKChartPointLabel CreateVerticalLabel(TKChartSeries series, TKChartDataPoint dataPoint)
        {
            series.Style.ShapeMode = TKChartSeriesStyleShapeMode.AlwaysShow;
            series.Style.PointLabelStyle.LayoutMode = TKChartPointLabelLayoutMode.Manual;
            series.Style.PointLabelStyle.Fill       = new TKSolidFill(UIColor.White);
            series.Style.PointLabelStyle.Insets     = new UIEdgeInsets(-1, -3, -1, -3);

            // Position the label at your preferred position
            series.Style.PointLabelStyle.LabelOffset = new UIOffset(0, 200);

            // Set the text properties
            series.Style.PointLabelStyle.TextOrientation = TKChartPointLabelOrientation.Vertical;
            series.Style.PointLabelStyle.TextAlignment   = UITextAlignment.Center;
            series.Style.PointLabelStyle.TextColor       = UIColor.Blue;
            series.Style.PointLabelStyle.TextHidden      = false;

            return(new TKChartPointLabel(dataPoint, series, dataPoint.DataYValue.ToString()));
        }
Пример #18
0
        public void reloadChart(object sender, EventArgs e)
        {
            Random r = new Random ();
            points = new List<TKChartDataPoint> ();
            for (int i = 0; i < 10; i++) {
                float x = i * 10;
                float y = r.Next () % 100;
                TKChartDataPoint point = new TKChartDataPoint (new NSNumber(x), new NSNumber(y));
                points.Add (point);
            }

            TKChartLineSeries lineSeries = new TKChartLineSeries (points.ToArray());
            float shapeSize = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone ? 14 : 17;
            lineSeries.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
            lineSeries.Style.PointShape = new TKPredefinedShape (TKShapeType.Rhombus, new SizeF (shapeSize, shapeSize));
            chart.AddSeries (lineSeries);
            chart.YAxis.Style.LabelStyle.TextHidden = true;

            chart.ReloadData ();
        }
Пример #19
0
            public override string TextForLabelAtPoint(TKChart chart, TKChartData dataPoint, TKChartSeries series, nuint dataIndex)
            {
                if (series is TKChartPieSeries)
                {
                    TKChartDataPoint point = (TKChartDataPoint)dataPoint;
                    return(point.DataName);
                }
                else if (series is TKChartBarSeries)
                {
                    TKChartDataPoint point = (TKChartDataPoint)dataPoint;
                    return(String.Format("{0}", point.DataXValue));
                }
                else if (series is TKChartOhlcSeries)
                {
                    TKChartFinancialDataPoint point = (TKChartFinancialDataPoint)dataPoint;
                    return(String.Format("O:{0}\nH:{1}\nL:{2}\nC:{3}", point.Open, point.High, point.Low, point.Close));
                }

                return(String.Format("{0}", ((TKChartDataPoint)dataPoint).DataYValue));
            }
Пример #20
0
        public override TKChartPointLabel LabelForDataPoint(TKChartData dataPoint, TKChartSeries series, nuint dataIndex)
        {
            TKChartDataPoint point = (TKChartDataPoint)dataPoint;

            if (series.Index == (nuint)this.SelectedSeries && dataIndex == (nuint)this.SelectedDataPoint)
            {
                if (this.labelLayer == null)
                {
                    this.labelLayer = new SelectedPointLabel();
                }

                this.labelLayer.LabelStyle = series.Style.PointLabelStyle;
                this.labelLayer.Text       = String.Format("{0}", point.DataYValue);
                this.isSelectedPoint       = true;
                return(null);
            }

            this.isSelectedPoint = false;
            return(new TKChartPointLabel(dataPoint, series, String.Format("{0}", point.DataYValue)));
        }
Пример #21
0
		public void UpdateChart (NSTimer tr) {
			this.chart.RemoveAllData ();
			Random r = new Random ();
			TKChartDataPoint dataPoint = new TKChartDataPoint (NSDate.Now, new NSNumber (r.Next () % 70));
			this.dataPoints.Add (dataPoint);
			if (this.dataPoints.Count > 25) {
				this.dataPoints.RemoveAt (0);
			}

			this.chart.YAxis = new TKChartNumericAxis (new NSNumber (0), new NSNumber (100));
			TKChartDataPoint firstPoint = this.dataPoints [0];
			TKChartDataPoint lastPoint = this.dataPoints [this.dataPoints.Count - 1];
			TKChartDateTimeAxis xAxis = new TKChartDateTimeAxis (firstPoint.DataXValue, lastPoint.DataXValue);
			xAxis.Style.LabelStyle.FitMode = TKChartAxisLabelFitMode.None;
			xAxis.Style.MajorTickStyle.MaxTickClippingMode = TKChartAxisClippingMode.Visible;
			xAxis.MajorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Seconds;
			this.chart.XAxis = xAxis;

			this.lineSeries = new TKChartLineSeries (this.dataPoints.ToArray ());
			this.chart.AddSeries (this.lineSeries);
			this.chart.ReloadData ();
		}
Пример #22
0
        public void reloadChart(object sender, EventArgs e)
        {
            Random r = new Random();
            List <TKChartDataPoint> points = new List <TKChartDataPoint> ();

            for (int i = 0; i < 10; i++)
            {
                float            x     = i * 10;
                float            y     = r.Next() % 100;
                TKChartDataPoint point = new TKChartDataPoint(new NSNumber(x), new NSNumber(y));
                points.Add(point);
            }

            TKChartLineSeries lineSeries = new TKChartLineSeries(points.ToArray());
            float             shapeSize  = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone ? 14 : 17;

            lineSeries.SelectionMode    = TKChartSeriesSelectionMode.DataPoint;
            lineSeries.Style.PointShape = new TKPredefinedShape(TKShapeType.Rhombus, new SizeF(shapeSize, shapeSize));
            chart.AddSeries(lineSeries);
            chart.YAxis.Style.LabelStyle.TextHidden = true;

            chart.ReloadData();
        }
Пример #23
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            TKChart chart = new TKChart (this.ExampleBounds);
            chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.View.AddSubview (chart);

            TKChartNumericAxis gdpInPoundsYAxis = new TKChartNumericAxis (new NSNumber(1050), new NSNumber(1400));
            gdpInPoundsYAxis.MajorTickInterval = 50;
            gdpInPoundsYAxis.Position = TKChartAxisPosition.Left;
            gdpInPoundsYAxis.Style.LabelStyle.TextAlignment = TKChartAxisLabelAlignment.Left;
            gdpInPoundsYAxis.Style.MajorTickStyle.TicksHidden = false;
            gdpInPoundsYAxis.Style.LineHidden = false;
            chart.AddAxis (gdpInPoundsYAxis);
            chart.YAxis = gdpInPoundsYAxis;

            TKChartDateTimeAxis periodXAxis = new TKChartDateTimeAxis ();
            periodXAxis.MajorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Years;
            periodXAxis.MinorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Years;
            periodXAxis.MajorTickInterval = 1;
            periodXAxis.Position = TKChartAxisPosition.Bottom;
            periodXAxis.PlotMode = TKChartAxisPlotMode.BetweenTicks;
            chart.AddAxis (periodXAxis);

            TKChartNumericAxis gdpInvestmentYAxis = new TKChartNumericAxis (new NSNumber(0), new NSNumber(20));
            gdpInvestmentYAxis.MajorTickInterval = 5;
            gdpInvestmentYAxis.Position = TKChartAxisPosition.Right;
            gdpInvestmentYAxis.Style.LabelStyle.TextAlignment = TKChartAxisLabelAlignment.Left;
            gdpInvestmentYAxis.Style.MajorTickStyle.TicksHidden = false;
            gdpInvestmentYAxis.Style.LineHidden = false;
            chart.AddAxis (gdpInvestmentYAxis);

            TKChartNumericAxis gdpGrowthUpAnnualChangeYAxis = new TKChartNumericAxis (new NSNumber(-6), new NSNumber(4));
            gdpGrowthUpAnnualChangeYAxis.MajorTickInterval = 1;
            gdpGrowthUpAnnualChangeYAxis.Position = TKChartAxisPosition.Right;
            gdpGrowthUpAnnualChangeYAxis.Style.LabelStyle.TextAlignment = TKChartAxisLabelAlignment.Left;
            gdpGrowthUpAnnualChangeYAxis.Style.MajorTickStyle.TicksHidden = false;
            gdpGrowthUpAnnualChangeYAxis.Style.LineHidden = false;
            chart.AddAxis (gdpGrowthUpAnnualChangeYAxis);

            TKChartNumericAxis grossNationalSavingsAnnualGrowthUpYAxis = new TKChartNumericAxis (new NSNumber(0), new NSNumber(16));
            grossNationalSavingsAnnualGrowthUpYAxis.MajorTickInterval = 2;
            grossNationalSavingsAnnualGrowthUpYAxis.Position = TKChartAxisPosition.Right;
            grossNationalSavingsAnnualGrowthUpYAxis.Style.LabelStyle.TextAlignment = TKChartAxisLabelAlignment.Left;
            grossNationalSavingsAnnualGrowthUpYAxis.Style.MajorTickStyle.TicksHidden = false;
            grossNationalSavingsAnnualGrowthUpYAxis.Style.LineHidden = false;
            chart.AddAxis (grossNationalSavingsAnnualGrowthUpYAxis);

            NSDate date2001 = DateWithYear (2001, 12, 31);
            NSDate date2002 = DateWithYear (2002, 12, 31);
            NSDate date2003 = DateWithYear (2003, 12, 31);
            NSDate date2004 = DateWithYear (2004, 12, 31);
            NSDate date2005 = DateWithYear (2005, 12, 31);

            TKChartDataPoint[] gdpInPounds = new TKChartDataPoint[] {
                new TKChartDataPoint(date2001, new NSNumber(1200)),
                new TKChartDataPoint(date2002, new NSNumber(1200)),
                new TKChartDataPoint(date2003, new NSNumber(1225)),
                new TKChartDataPoint(date2004, new NSNumber(1300)),
                new TKChartDataPoint(date2005, new NSNumber(1350))
            };

            TKChartColumnSeries gdpInPoundsSeries = new TKChartColumnSeries  (gdpInPounds);
            gdpInPoundsSeries.XAxis = periodXAxis;
            gdpInPoundsSeries.YAxis = gdpInPoundsYAxis;
            gdpInPoundsSeries.SelectionMode = TKChartSeriesSelectionMode.Series;
            chart.AddSeries (gdpInPoundsSeries);

            TKChartDataPoint[] gdpGrowthUpAnnual = new TKChartDataPoint[] {
                new TKChartDataPoint (date2001, new NSNumber (4)),
                new TKChartDataPoint (date2002, new NSNumber (3)),
                new TKChartDataPoint (date2003, new NSNumber (2)),
                new TKChartDataPoint (date2004, new NSNumber (-5)),
                new TKChartDataPoint (date2005, new NSNumber (1))
            };

            float shapeSize = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone ? 7 : 17;

            TKChartLineSeries gdpGrowthUpSeries = new TKChartLineSeries (gdpGrowthUpAnnual);
            gdpGrowthUpSeries.Style.PointShape = new TKPredefinedShape (TKShapeType.Circle, new SizeF (shapeSize, shapeSize));
            gdpGrowthUpSeries.XAxis = periodXAxis;
            gdpGrowthUpSeries.YAxis = gdpGrowthUpAnnualChangeYAxis;
            gdpGrowthUpSeries.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
            gdpGrowthUpSeries.Style.ShapeMode = TKChartSeriesStyleShapeMode.AlwaysShow;
            chart.AddSeries (gdpGrowthUpSeries);

            TKChartDataPoint[] grossAnualSavings = new TKChartDataPoint[] {
                new TKChartDataPoint (date2001, new NSNumber (14)),
                new TKChartDataPoint (date2002, new NSNumber (8)),
                new TKChartDataPoint (date2003, new NSNumber (12)),
                new TKChartDataPoint (date2004, new NSNumber (11)),
                new TKChartDataPoint (date2005, new NSNumber (16))
            };

            TKChartLineSeries grossAnualSavingsSeries = new TKChartLineSeries (grossAnualSavings);
            grossAnualSavingsSeries.Style.PointShape = new TKPredefinedShape (TKShapeType.Circle, new SizeF(shapeSize, shapeSize));
            grossAnualSavingsSeries.XAxis = periodXAxis;
            grossAnualSavingsSeries.YAxis = grossNationalSavingsAnnualGrowthUpYAxis;
            grossAnualSavingsSeries.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
            grossAnualSavingsSeries.Style.ShapeMode = TKChartSeriesStyleShapeMode.AlwaysShow;
            chart.AddSeries (grossAnualSavingsSeries);

            TKChartDataPoint[] gdpInvestment = new TKChartDataPoint[] {
                new TKChartDataPoint (date2001, new NSNumber (15)),
                new TKChartDataPoint (date2002, new NSNumber (13)),
                new TKChartDataPoint (date2003, new NSNumber (16)),
                new TKChartDataPoint (date2004, new NSNumber (19)),
                new TKChartDataPoint (date2005, new NSNumber (15))
            };

            TKChartLineSeries gdpInvestmentSeries = new TKChartLineSeries (gdpInvestment);
            gdpInvestmentSeries.Style.PointShape = new TKPredefinedShape (TKShapeType.Circle, new SizeF(shapeSize, shapeSize));
            gdpInvestmentSeries.XAxis = periodXAxis;
            gdpInvestmentSeries.YAxis = gdpInvestmentYAxis;
            gdpInvestmentSeries.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
            gdpInvestmentSeries.Style.ShapeMode = TKChartSeriesStyleShapeMode.AlwaysShow;
            chart.AddSeries (gdpInvestmentSeries);

            this.setStyles (gdpInPoundsSeries);
            this.setStyles (grossAnualSavingsSeries);
            this.setStyles (gdpGrowthUpSeries);
            this.setStyles (gdpInvestmentSeries);

            chart.ReloadData ();
        }
Пример #24
0
            public override ITKChartData GetPoint(TKChart chart, nuint dataIndex, nuint seriesIndex)
            {
                var point = new TKChartDataPoint(new NSNumber(dataIndex), new NSNumber(r.Next(100)));

                return(point);
            }
Пример #25
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TKChart chart = new TKChart(this.ExampleBounds);

            chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.View.AddSubview(chart);

            TKChartNumericAxis gdpInPoundsYAxis = new TKChartNumericAxis(new NSNumber(1050), new NSNumber(1400));

            gdpInPoundsYAxis.MajorTickInterval = 50;
            gdpInPoundsYAxis.Position          = TKChartAxisPosition.Left;
            gdpInPoundsYAxis.Style.LabelStyle.TextAlignment   = TKChartAxisLabelAlignment.Left;
            gdpInPoundsYAxis.Style.MajorTickStyle.TicksHidden = false;
            gdpInPoundsYAxis.Style.LineHidden = false;
            chart.AddAxis(gdpInPoundsYAxis);
            chart.YAxis = gdpInPoundsYAxis;

            TKChartDateTimeAxis periodXAxis = new TKChartDateTimeAxis();

            periodXAxis.MajorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Years;
            periodXAxis.MinorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Years;
            periodXAxis.MajorTickInterval     = 1;
            periodXAxis.Position = TKChartAxisPosition.Bottom;
            periodXAxis.PlotMode = TKChartAxisPlotMode.BetweenTicks;
            chart.AddAxis(periodXAxis);

            TKChartNumericAxis gdpInvestmentYAxis = new TKChartNumericAxis(new NSNumber(0), new NSNumber(20));

            gdpInvestmentYAxis.MajorTickInterval = 5;
            gdpInvestmentYAxis.Position          = TKChartAxisPosition.Right;
            gdpInvestmentYAxis.Style.LabelStyle.TextAlignment   = TKChartAxisLabelAlignment.Left;
            gdpInvestmentYAxis.Style.MajorTickStyle.TicksHidden = false;
            gdpInvestmentYAxis.Style.LineHidden = false;
            chart.AddAxis(gdpInvestmentYAxis);

            TKChartNumericAxis gdpGrowthUpAnnualChangeYAxis = new TKChartNumericAxis(new NSNumber(-6), new NSNumber(4));

            gdpGrowthUpAnnualChangeYAxis.MajorTickInterval = 1;
            gdpGrowthUpAnnualChangeYAxis.Position          = TKChartAxisPosition.Right;
            gdpGrowthUpAnnualChangeYAxis.Style.LabelStyle.TextAlignment   = TKChartAxisLabelAlignment.Left;
            gdpGrowthUpAnnualChangeYAxis.Style.MajorTickStyle.TicksHidden = false;
            gdpGrowthUpAnnualChangeYAxis.Style.LineHidden = false;
            chart.AddAxis(gdpGrowthUpAnnualChangeYAxis);

            TKChartNumericAxis grossNationalSavingsAnnualGrowthUpYAxis = new TKChartNumericAxis(new NSNumber(0), new NSNumber(16));

            grossNationalSavingsAnnualGrowthUpYAxis.MajorTickInterval = 2;
            grossNationalSavingsAnnualGrowthUpYAxis.Position          = TKChartAxisPosition.Right;
            grossNationalSavingsAnnualGrowthUpYAxis.Style.LabelStyle.TextAlignment   = TKChartAxisLabelAlignment.Left;
            grossNationalSavingsAnnualGrowthUpYAxis.Style.MajorTickStyle.TicksHidden = false;
            grossNationalSavingsAnnualGrowthUpYAxis.Style.LineHidden = false;
            chart.AddAxis(grossNationalSavingsAnnualGrowthUpYAxis);

            NSDate date2001 = DateWithYear(2001, 12, 31);
            NSDate date2002 = DateWithYear(2002, 12, 31);
            NSDate date2003 = DateWithYear(2003, 12, 31);
            NSDate date2004 = DateWithYear(2004, 12, 31);
            NSDate date2005 = DateWithYear(2005, 12, 31);

            TKChartDataPoint[] gdpInPounds = new TKChartDataPoint[] {
                new TKChartDataPoint(date2001, new NSNumber(1200)),
                new TKChartDataPoint(date2002, new NSNumber(1200)),
                new TKChartDataPoint(date2003, new NSNumber(1225)),
                new TKChartDataPoint(date2004, new NSNumber(1300)),
                new TKChartDataPoint(date2005, new NSNumber(1350))
            };

            TKChartColumnSeries gdpInPoundsSeries = new TKChartColumnSeries(gdpInPounds);

            gdpInPoundsSeries.XAxis         = periodXAxis;
            gdpInPoundsSeries.YAxis         = gdpInPoundsYAxis;
            gdpInPoundsSeries.SelectionMode = TKChartSeriesSelectionMode.Series;
            chart.AddSeries(gdpInPoundsSeries);

            TKChartDataPoint[] gdpGrowthUpAnnual = new TKChartDataPoint[] {
                new TKChartDataPoint(date2001, new NSNumber(4)),
                new TKChartDataPoint(date2002, new NSNumber(3)),
                new TKChartDataPoint(date2003, new NSNumber(2)),
                new TKChartDataPoint(date2004, new NSNumber(-5)),
                new TKChartDataPoint(date2005, new NSNumber(1))
            };

            float shapeSize = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone ? 7 : 17;

            TKChartLineSeries gdpGrowthUpSeries = new TKChartLineSeries(gdpGrowthUpAnnual);

            gdpGrowthUpSeries.Style.PointShape = new TKPredefinedShape(TKShapeType.Circle, new SizeF(shapeSize, shapeSize));
            gdpGrowthUpSeries.XAxis            = periodXAxis;
            gdpGrowthUpSeries.YAxis            = gdpGrowthUpAnnualChangeYAxis;
            gdpGrowthUpSeries.SelectionMode    = TKChartSeriesSelectionMode.DataPoint;
            gdpGrowthUpSeries.Style.ShapeMode  = TKChartSeriesStyleShapeMode.AlwaysShow;
            chart.AddSeries(gdpGrowthUpSeries);

            TKChartDataPoint[] grossAnualSavings = new TKChartDataPoint[] {
                new TKChartDataPoint(date2001, new NSNumber(14)),
                new TKChartDataPoint(date2002, new NSNumber(8)),
                new TKChartDataPoint(date2003, new NSNumber(12)),
                new TKChartDataPoint(date2004, new NSNumber(11)),
                new TKChartDataPoint(date2005, new NSNumber(16))
            };

            TKChartLineSeries grossAnualSavingsSeries = new TKChartLineSeries(grossAnualSavings);

            grossAnualSavingsSeries.Style.PointShape = new TKPredefinedShape(TKShapeType.Circle, new SizeF(shapeSize, shapeSize));
            grossAnualSavingsSeries.XAxis            = periodXAxis;
            grossAnualSavingsSeries.YAxis            = grossNationalSavingsAnnualGrowthUpYAxis;
            grossAnualSavingsSeries.SelectionMode    = TKChartSeriesSelectionMode.DataPoint;
            grossAnualSavingsSeries.Style.ShapeMode  = TKChartSeriesStyleShapeMode.AlwaysShow;
            chart.AddSeries(grossAnualSavingsSeries);

            TKChartDataPoint[] gdpInvestment = new TKChartDataPoint[] {
                new TKChartDataPoint(date2001, new NSNumber(15)),
                new TKChartDataPoint(date2002, new NSNumber(13)),
                new TKChartDataPoint(date2003, new NSNumber(16)),
                new TKChartDataPoint(date2004, new NSNumber(19)),
                new TKChartDataPoint(date2005, new NSNumber(15))
            };

            TKChartLineSeries gdpInvestmentSeries = new TKChartLineSeries(gdpInvestment);

            gdpInvestmentSeries.Style.PointShape = new TKPredefinedShape(TKShapeType.Circle, new SizeF(shapeSize, shapeSize));
            gdpInvestmentSeries.XAxis            = periodXAxis;
            gdpInvestmentSeries.YAxis            = gdpInvestmentYAxis;
            gdpInvestmentSeries.SelectionMode    = TKChartSeriesSelectionMode.DataPoint;
            gdpInvestmentSeries.Style.ShapeMode  = TKChartSeriesStyleShapeMode.AlwaysShow;
            chart.AddSeries(gdpInvestmentSeries);

            this.setStyles(gdpInPoundsSeries);
            this.setStyles(grossAnualSavingsSeries);
            this.setStyles(gdpGrowthUpSeries);
            this.setStyles(gdpInvestmentSeries);

            chart.ReloadData();
        }