public override TKChartPointLabel LabelForDataPoint(TKChart chart, TKChartData dataPoint, string propertyName, TKChartSeries series, nuint dataIndex)
        {
            // If it's a BarSeries use vertical label
            if (series is TKChartColumnSeries)
            {
                if (this.rotateLabels)
                {
                    return(CreateVerticalLabel(series, (TKChartDataPoint)dataPoint));
                }
                else
                {
                    return(CreateHorizontalLabel(series, (TKChartDataPoint)dataPoint));
                }
            }

            if (series is TKChartDonutSeries)
            {
                return(CreateDonutLabel(series, (TKChartDataPoint)dataPoint));
            }

            if (series is TKChartPieSeries)
            {
                return(CreatePieLabel(series, (TKChartDataPoint)dataPoint));
            }

            // use horizontal label for everything else
            return(CreateHorizontalLabel(series, (TKChartDataPoint)dataPoint));
        }
Exemple #2
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

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

			string[] months = new string[]{ "Jan", "Feb", "Mar", "Apr", "May", "Jun" };
			int[] values = new int[]{ 95, 40, 55, 30, 76, 34 };
			List<TKChartDataPoint> list = new List<TKChartDataPoint> ();

			for (int i = 0; i < months.Length; i++) {
				list.Add (new TKChartDataPoint(new NSString(months[i]), new NSNumber(values[i])));
			}
			chart.AddSeries (new TKChartAreaSeries (list.ToArray()));

			CALayer layer = new CALayer ();
			layer.Bounds = new RectangleF (0, 0, 100, 100);
			layer.BackgroundColor = new UIColor(1, 0, 0, 0.6f).CGColor;
			layer.ShadowRadius = 10;
			layer.ShadowColor = UIColor.Yellow.CGColor;
			layer.ShadowOpacity = 1;
			layer.CornerRadius = 10;

			TKChartLayerAnnotation a = new TKChartLayerAnnotation(layer, new NSString("Mar"), new NSNumber(80), chart.Series[0]);
			a.ZPosition = TKChartAnnotationZPosition.AboveSeries;
			chart.AddAnnotation(a);
		}
		public override void ViewDidLoad ()
		{
			this.AddOption ("Sequential animation", applySequential);
			this.AddOption ("Grow animation", applyGrow);

			base.ViewDidLoad ();

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

			Random r = new Random ();
			List<TKChartDataPoint> list = new List<TKChartDataPoint> ();
			for (int i = 0; i < 10; i++) {
				list.Add (new TKChartDataPoint(new NSNumber(i), new NSNumber(r.Next() % 100)));
			}
			
			TKChartLineSeries lineSeries = new TKChartLineSeries (list.ToArray ());
			chart.AddSeries (lineSeries);

			float shapeSize = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone ? 14 : 17;
			lineSeries.Style.PointShape = new TKPredefinedShape (TKShapeType.Circle, new SizeF (shapeSize, shapeSize));
			lineSeries.Style.ShapeMode = TKChartSeriesStyleShapeMode.AlwaysShow;
			lineSeries.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
			chart.AddSeries (lineSeries);
		}
Exemple #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

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

            Random r = new Random ();
            List<TKChartDataPoint> list = new List<TKChartDataPoint> ();
            for (int i = 0; i < 200; i++) {
                list.Add (new TKChartDataPoint(new NSNumber(r.Next() % 200), new NSNumber(r.Next() % 1000)));
            }
            chart.AddSeries (new TKChartScatterSeries (list.ToArray()));

            list = new List<TKChartDataPoint> ();
            for (int i = 0; i < 200; i++) {
                list.Add (new TKChartDataPoint(new NSNumber(r.Next() % 200), new NSNumber(r.Next() % 1000)));
            }
            chart.AddSeries (new TKChartScatterSeries (list.ToArray()));

            list = new List<TKChartDataPoint> ();
            for (int i = 0; i < 200; i++) {
                list.Add (new TKChartDataPoint(new NSNumber(r.Next() % 200), new NSNumber(r.Next() % 1000)));
            }

            chart.AddSeries (new TKChartScatterSeries (list.ToArray()));

            chart.XAxis.AllowZoom = true;
            chart.XAxis.AllowPan = true;
            chart.YAxis.AllowZoom = true;
            chart.YAxis.AllowPan = true;
        }
Exemple #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            CGRect exampleBounds         = this.ExampleBounds;
            CGRect overlayChartBounds    = new CGRect(exampleBounds.X, exampleBounds.Y, exampleBounds.Width, exampleBounds.Height / 1.5f);
            CGRect indicatorsChartBounds = new CGRect(exampleBounds.X, overlayChartBounds.Height + 15, exampleBounds.Width, exampleBounds.Height / 3.0f);

            overlayChart = new TKChart(overlayChartBounds);
            overlayChart.GridStyle.VerticalLinesHidden = false;
            overlayChart.AutoresizingMask = ~UIViewAutoresizing.None;
            this.View.AddSubview(overlayChart);

            indicatorsChart = new TKChart(indicatorsChartBounds);
            indicatorsChart.AutoresizingMask = ~UIViewAutoresizing.None;
            this.View.AddSubview(indicatorsChart);

            data     = StockDataPoint.LoadStockPoints(-1);
            settings = new IndicatorsTableView(this);

            SelectedIndicator = 0;
            SelectedTrendLine = 0;

            series = new TKChartCandlestickSeries(data.ToArray());

            overlayChart.Delegate = new ChartDelegate(indicatorsChart);

            this.loadCharts();
        }
Exemple #6
0
        void snippet3()
        {
            // >> chart-binding-props-cs
            var chart = new TKChart(CGRect.Inflate(this.View.Bounds, -10, -10));

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

            Random r          = new Random();
            var    dataPoints = new List <CustomObject> ();

            for (int i = 0; i < 5; i++)
            {
                CustomObject obj = new CustomObject()
                {
                    ObjectID = i,
                    Value1   = r.Next(100),
                    Value2   = r.Next(100),
                    Value3   = r.Next(100)
                };
                dataPoints.Add(obj);
            }

            chart.BeginUpdates();
            chart.AddSeries(new TKChartLineSeries(dataPoints.ToArray(), "ObjectID", "Value1"));
            chart.AddSeries(new TKChartAreaSeries(dataPoints.ToArray(), "ObjectID", "Value2"));
            chart.AddSeries(new TKChartScatterSeries(dataPoints.ToArray(), "ObjectID", "Value3"));
            chart.EndUpdates();
            // << chart-binding-props-cs
        }
Exemple #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TKChart chart = new TKChart(this.ExampleBounds);

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

            Random r = new Random();

            for (int i = 0; i < 2; i++)
            {
                List <TKChartDataPoint> list = new List <TKChartDataPoint> ();
                for (int j = 0; j < 20; j++)
                {
                    list.Add(new TKChartDataPoint(new NSNumber(r.Next() % 1450), new NSNumber(r.Next() % 150)));
                }
                chart.AddSeries(new TKChartScatterSeries(list.ToArray()));
            }

            UIImageView imageView = new UIImageView();

            imageView.Image  = new UIImage("logo.png");
            imageView.Bounds = new CGRect(0, 0, imageView.Image.Size.Width, imageView.Image.Size.Height);
            imageView.Alpha  = 0.7f;
            chart.AddAnnotation(new TKChartViewAnnotation(imageView, new NSNumber(550), new NSNumber(90), chart.Series[0]));
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TKChart chart = new TKChart(this.ExampleBounds);

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

            var xAxis     = new TKChartDateTimeCategoryAxis();
            var formatter = new NSDateFormatter();

            formatter.DateFormat = "d MMM";
            xAxis.LabelFormatter = formatter;
            xAxis.Style.MajorTickStyle.TicksOffset         = -3;
            xAxis.Style.MajorTickStyle.TicksHidden         = false;
            xAxis.Style.MajorTickStyle.TicksWidth          = 1.5f;
            xAxis.Style.MajorTickStyle.TicksFill           = new TKSolidFill(new UIColor(203 / 255.0f, 203 / 255.0f, 203 / 255.0f, 1f));
            xAxis.Style.MajorTickStyle.MaxTickClippingMode = TKChartAxisClippingMode.Visible;
            xAxis.PlotMode = TKChartAxisPlotMode.BetweenTicks;

            var yAxis = new TKChartNumericAxis(new NSNumber(320), new NSNumber(360));

            yAxis.MajorTickInterval = 20;

            var series = new TKChartCandlestickSeries(StockDataPoint.LoadStockPoints(10).ToArray());

            series.GapLength = 0.6f;
            series.XAxis     = xAxis;
            chart.YAxis      = yAxis;

            chart.AddSeries(series);
        }
        public override void ViewDidLoad()
        {
            this.AddOption("Sequential animation", applySequential);
            this.AddOption("Grow animation", applyGrow);

            base.ViewDidLoad();

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

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

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

            TKChartLineSeries lineSeries = new TKChartLineSeries(list.ToArray());

            chart.AddSeries(lineSeries);

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

            lineSeries.Style.PointShape = new TKPredefinedShape(TKShapeType.Circle, new SizeF(shapeSize, shapeSize));
            lineSeries.Style.ShapeMode  = TKChartSeriesStyleShapeMode.AlwaysShow;
            lineSeries.SelectionMode    = TKChartSeriesSelectionMode.DataPoint;
            chart.AddSeries(lineSeries);
        }
        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));
        }
Exemple #11
0
            public override TKChartPaletteItem PaletteItemForSeries(TKChart chart, TKChartSeries series, nint index)
            {
                TKChartPaletteItem item = null;

                if (series.Index == 1)
                {
                    UIColor[] colors = new UIColor[] {
                        new UIColor(0f, 1f, 0f, 0.4f),
                        new UIColor(1f, 0f, 0f, 0.4f),
                        new UIColor(0f, 0f, 1f, 0.4f),
                    };
                    TKLinearGradientFill gradient = new TKLinearGradientFill(colors, new PointF(0.5f, 0.0f), new PointF(0.5f, 1.0f));
                    item = new TKChartPaletteItem(gradient);
                }
                else
                {
                    TKImageFill image = new TKImageFill(new UIImage("pattern1.png"), 5.0f);
                    image.ResizingMode = TKImageFillResizingMode.Tile;
                    TKStroke stroke = new TKStroke(UIColor.Black, 1.0f);
                    stroke.CornerRadius = 5.0f;
                    stroke.DashPattern  = new NSNumber[] { new NSNumber(2), new NSNumber(2), new NSNumber(5), new NSNumber(2) };
                    item = new TKChartPaletteItem(new NSObject[] { image, stroke });
                }

                return(item);
            }
        public override void ViewDidLoad()
        {
            this.AddOption("cross lines", crossLines);
            this.AddOption("horizontal line", horizontalLine);
            this.AddOption("vertical line", verticalLine);
            this.AddOption("disable lines", disableLines);

            base.ViewDidLoad();

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

            Random r = new Random();

            for (int i = 0; i < 2; i++)
            {
                List <TKChartDataPoint> list = new List <TKChartDataPoint> ();
                for (int j = 0; j < 20; j++)
                {
                    list.Add(new TKChartDataPoint(new NSNumber(r.Next() % 1450), new NSNumber(r.Next() % 150)));
                }
                chart.AddSeries(new TKChartScatterSeries(list.ToArray()));
            }
            chart.AddAnnotation(new TKChartCrossLineAnnotation(new NSNumber(900), new NSNumber(60), chart.Series[0]));
        }
            public override CAAnimation AnimationForSeries(TKChart chart, TKChartSeries series, TKChartSeriesRenderState state, CGRect rect)
            {
                double duration = 0.5;
                List<CAAnimation> animations = new List<CAAnimation> ();

                for (int i = 0; i<(int)state.Points.Count; i++) {
                    string keyPath = string.Format ("seriesRenderStates.{0}.points.{1}.y", series.Index, i);
                    TKChartVisualPoint point = (TKChartVisualPoint)state.Points.ObjectAtIndex((uint)i);
                    double oldY = rect.Height;
                    double half = oldY + (point.Y - oldY)/2.0;
                    CAKeyFrameAnimation a = (CAKeyFrameAnimation)CAKeyFrameAnimation.GetFromKeyPath(keyPath);
                    a.KeyTimes = new NSNumber[] { new NSNumber (0), new NSNumber (0), new NSNumber (1) };
                    a.Values = new NSObject[] { new NSNumber (oldY), new NSNumber (half), new NSNumber (point.Y) };
                    a.Duration = duration;
                    a.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.EaseOut);
                    animations.Add(a);
                }

                CAAnimationGroup group = new CAAnimationGroup ();

                group.Duration = duration;
                group.Animations = animations.ToArray();

                return group;
            }
			public override void PointSelected (TKChart chart, TKChartData point, TKChartSeries series, nint index)
			{
				if (this.labelRender != null) {
					this.labelRender.SelectedSeries = (int)series.Index;
					this.labelRender.SelectedDataPoint = index;
				}
			}
Exemple #15
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

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

            Random r = new Random ();
            List<TKChartDataPoint> list = new List<TKChartDataPoint> ();
            for (int i = 0; i < 12; i++) {
                list.Add (new TKChartDataPoint (new NSNumber (i), new NSNumber (r.Next () % 2000)));
            }

            TKChartLineSeries series = new TKChartLineSeries (list.ToArray());
            series.SelectionMode = TKChartSeriesSelectionMode.Series;

            TKChartNumericAxis xAxis = new TKChartNumericAxis ();
            xAxis.Range = new TKRange (new NSNumber (0), new NSNumber (11));
            xAxis.Position = TKChartAxisPosition.Bottom;
            xAxis.MajorTickInterval = 1;
            chart.XAxis = xAxis;

            TKChartNumericAxis yAxis = new TKChartNumericAxis ();
            yAxis.Range = new TKRange (new NSNumber (0), new NSNumber (2000));
            yAxis.Position = TKChartAxisPosition.Left;
            yAxis.MajorTickInterval = 400;
            chart.YAxis = yAxis;

            chart.AddSeries (series);
        }
Exemple #16
0
        public override void ViewDidLoad()
        {
            this.AddOption("Animate", animate);

            base.ViewDidLoad();

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

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

            list.Add(new TKChartDataPoint(new NSNumber(10), null, "Apple"));
            list.Add(new TKChartDataPoint(new NSNumber(20), null, "Google"));
            list.Add(new TKChartDataPoint(new NSNumber(30), null, "Microsoft"));
            list.Add(new TKChartDataPoint(new NSNumber(5), null, "IBM"));
            list.Add(new TKChartDataPoint(new NSNumber(8), null, "Oracle"));

            TKChartPieSeries series = new TKChartPieSeries(list.ToArray());

            series.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
            chart.AddSeries(series);
        }
Exemple #17
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;
 }
Exemple #18
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TKChart chart = new TKChart(this.ExampleBounds);

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

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

            string[] categories = new [] { "Apple", "Google", "Microsoft", "Samsung" };
            for (int i = 0; i < categories.Length; i++)
            {
                list.Add(new TKChartDataPoint(new NSString(categories[i]), new NSNumber(r.Next() % 100)));
            }

            TKChartColumnSeries series = new TKChartColumnSeries(list.ToArray());

            series.SelectionMode = TKChartSeriesSelectionMode.Series;

            TKChartCategoryAxis xAxis = new TKChartCategoryAxis();

            xAxis.Position = TKChartAxisPosition.Bottom;
            xAxis.PlotMode = TKChartAxisPlotMode.BetweenTicks;
            series.XAxis   = xAxis;

            TKChartNumericAxis yAxis = new TKChartNumericAxis(new NSNumber(0), new NSNumber(100));

            yAxis.Position = TKChartAxisPosition.Left;
            chart.YAxis    = yAxis;

            chart.AddSeries(series);
        }
Exemple #19
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

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

            Random r = new Random ();
            for (int i = 0; i < 2; i++) {
                List<TKChartDataPoint> list = new List<TKChartDataPoint> ();
                for (int j = 0; j < 20; j++) {

                    list.Add(new TKChartDataPoint (new NSNumber (r.Next() % 1450), new NSNumber (r.Next () % 150)));
                }

                TKChartScatterSeries series = new TKChartScatterSeries (list.ToArray());
                series.Title = string.Format ("Series: {0}", list);
                if (2 == i) {
                    series.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
                } else {
                    series.SelectionMode = TKChartSeriesSelectionMode.Series;
                }
                series.Style.PaletteMode = TKChartSeriesStylePaletteMode.UseItemIndex;
                series.MarginForHitDetection = 300;
                chart.AddSeries (series);
            }
            chart.EndUpdates ();
            chart.XAxis.AllowZoom = true;
            chart.YAxis.AllowZoom = true;
        }
Exemple #20
0
            public override CAAnimation AnimationForSeries(TKChart chart, TKChartSeries series, TKChartSeriesRenderState state, CGRect rect)
            {
                double             duration   = 0;
                List <CAAnimation> animations = new List <CAAnimation>();

                for (int i = 0; i < (int)state.Points.Count; i++)
                {
                    string pointKeyPath = state.AnimationKeyPathForPointAtIndex((uint)i);

                    string keyPath        = string.Format("{0}.distanceFromCenter", pointKeyPath);
                    CAKeyFrameAnimation a = CAKeyFrameAnimation.GetFromKeyPath(keyPath);
                    a.Values   = new NSNumber[] { new NSNumber(50), new NSNumber(50), new NSNumber(0) };
                    a.KeyTimes = new NSNumber[] { new NSNumber(0), new NSNumber(i / (i + 1.0)), new NSNumber(1) };
                    a.Duration = 0.3 * (i + 1.1);
                    animations.Add(a);

                    keyPath    = string.Format("{0}.opacity", pointKeyPath);
                    a          = CAKeyFrameAnimation.GetFromKeyPath(keyPath);
                    a.Values   = new NSNumber[] { new NSNumber(0), new NSNumber(0), new NSNumber(1) };
                    a.KeyTimes = new NSNumber[] { new NSNumber(0), new NSNumber(i / (i + 1.0)), new NSNumber(1) };
                    a.Duration = 0.3 * (i + 1.1);
                    animations.Add(a);

                    duration = a.Duration;
                }
                CAAnimationGroup g = new CAAnimationGroup();

                g.Duration   = duration;
                g.Animations = animations.ToArray();
                return(g);
            }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TKChart chart = new TKChart(this.View.Bounds);

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

            string[] months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun" };
            int[]    values = { 95, 40, 55, 30, 76, 34 };
            List <TKChartDataPoint> array = new List <TKChartDataPoint> ();

            for (int i = 0; i < months.Length; i++)
            {
                array.Add(new TKChartDataPoint(new NSString(months[i]), new NSNumber(values[i])));
            }
            TKChartAreaSeries series = new TKChartAreaSeries(array.ToArray());

            series.Style.PointShape = new TKPredefinedShape(TKShapeType.Circle, new SizeF(10, 10));
            chart.AddSeries(series);

            TKPredefinedShape shape = new TKPredefinedShape(TKShapeType.Star, new SizeF(20, 20));
            MyAnnotation      a     = new MyAnnotation(shape, new NSString("Mar"), new NSNumber(60), series);

            a.Fill   = new TKSolidFill(UIColor.Blue);
            a.Stroke = new TKStroke(UIColor.Yellow, 3);
            chart.AddAnnotation(a);
        }
Exemple #22
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TKChart chart = new TKChart(this.ExampleBounds);

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

            Random r = new Random();

            for (int i = 0; i < 2; i++)
            {
                List <TKChartDataPoint> list = new List <TKChartDataPoint> ();
                for (int j = 0; j < 20; j++)
                {
                    list.Add(new TKChartDataPoint(new NSNumber(r.Next() % 1450), new NSNumber(r.Next() % 150)));
                }
                chart.AddSeries(new TKChartScatterSeries(list.ToArray()));
            }

            chart.AddAnnotation(new TKChartGridLineAnnotation(new NSNumber(80), chart.YAxis, new TKStroke(UIColor.Red)));
            chart.AddAnnotation(new TKChartGridLineAnnotation(new NSNumber(600), chart.XAxis));
            chart.AddAnnotation(new TKChartBandAnnotation(new TKRange(new NSNumber(10), new NSNumber(40)), chart.YAxis, new TKSolidFill(new UIColor(1, 0, 0, 0.4f)), null));

            TKChartBandAnnotation a = new TKChartBandAnnotation(new TKRange(new NSNumber(900), new NSNumber(1500)), chart.XAxis);

            a.Style.Fill = new TKSolidFill(new UIColor(0, 1, 0, 0.3f));
            chart.AddAnnotation(a);
        }
Exemple #23
0
            public override CAAnimation AnimationForSeries(TKChart chart, TKChartSeries series, TKChartSeriesRenderState state, CGRect rect)
            {
                double             duration   = 0.5;
                List <CAAnimation> animations = new List <CAAnimation> ();

                for (int i = 0; i < (int)state.Points.Count; i++)
                {
                    string              keyPath = string.Format("seriesRenderStates.{0}.points.{1}.y", series.Index, i);
                    TKChartVisualPoint  point   = (TKChartVisualPoint)state.Points.ObjectAtIndex((uint)i);
                    double              oldY    = rect.Height;
                    double              half    = oldY + (point.Y - oldY) / 2.0;
                    CAKeyFrameAnimation a       = (CAKeyFrameAnimation)CAKeyFrameAnimation.GetFromKeyPath(keyPath);
                    a.KeyTimes       = new NSNumber[] { new NSNumber(0), new NSNumber(0), new NSNumber(1) };
                    a.Values         = new NSObject[] { new NSNumber(oldY), new NSNumber(half), new NSNumber(point.Y) };
                    a.Duration       = duration;
                    a.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut);
                    animations.Add(a);
                }

                CAAnimationGroup group = new CAAnimationGroup();

                group.Duration   = duration;
                group.Animations = animations.ToArray();

                return(group);
            }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TKChart chart = new TKChart(this.ExampleBounds);

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

            Random r = new Random();
            List <DataPointImpl> data = new List <DataPointImpl> ();

            for (int i = 0; i <= 5; i++)
            {
                DataPointImpl impl = new DataPointImpl()
                {
                    ObjectID = i,
                    Value    = r.Next(100)
                };
                data.Add(impl);
            }

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

            columnSeries.SelectionMode = TKChartSeriesSelectionMode.Series;
            chart.AddSeries(columnSeries);
        }
Exemple #25
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

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

			Random r = new Random ();
			for (int i = 0; i < 2; i++) {
				List<TKChartBubbleDataPoint> list = new List<TKChartBubbleDataPoint> ();
				for (int j = 0; j < 20; j++) {
					list.Add (new TKChartBubbleDataPoint (new NSNumber (r.Next () % 1450), new NSNumber (r.Next () % 150), new NSNumber (r.Next () % 200)));
				}

				TKChartBubbleSeries series = new TKChartBubbleSeries (list.ToArray());
				series.Title = string.Format("Series {0}", i+1);
				series.Scale = 1.5;
				series.MarginForHitDetection = 2f;
				if (i == 0) {
					series.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
				} else {
					series.SelectionMode = TKChartSeriesSelectionMode.Series;
				}
				chart.AddSeries (series);
			}
		}
Exemple #26
0
        public override void ViewDidLoad()
        {
            AddOption("Range Column", rangeColumnSelected);
            AddOption("Range Bar", rangeBarSelected);

            base.ViewDidLoad();

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

            lowValues = new NSNumber[] {
                new NSNumber(33), new NSNumber(29),
                new NSNumber(55), new NSNumber(21),
                new NSNumber(10), new NSNumber(39),
                new NSNumber(40), new NSNumber(11)
            };

            highValues = new NSNumber[] {
                new NSNumber(47), new NSNumber(61),
                new NSNumber(64), new NSNumber(40),
                new NSNumber(33), new NSNumber(90),
                new NSNumber(87), new NSNumber(69)
            };

            this.rangeColumnSelected();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TKChart chart = new TKChart(this.ExampleBounds);

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

            string[] months = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun" };
            int[]    values = new int[] { 95, 40, 55, 30, 76, 34 };
            List <TKChartDataPoint> list = new List <TKChartDataPoint> ();

            for (int i = 0; i < months.Length; i++)
            {
                list.Add(new TKChartDataPoint(new NSString(months[i]), new NSNumber(values[i])));
            }
            chart.AddSeries(new TKChartAreaSeries(list.ToArray()));

            CALayer layer = new CALayer();

            layer.Bounds          = new RectangleF(0, 0, 100, 100);
            layer.BackgroundColor = new UIColor(1, 0, 0, 0.6f).CGColor;
            layer.ShadowRadius    = 10;
            layer.ShadowColor     = UIColor.Yellow.CGColor;
            layer.ShadowOpacity   = 1;
            layer.CornerRadius    = 10;

            TKChartLayerAnnotation a = new TKChartLayerAnnotation(layer, new NSString("Mar"), new NSNumber(80), chart.Series[0]);

            a.ZPosition = TKChartAnnotationZPosition.AboveSeries;
            chart.AddAnnotation(a);
        }
        public override void ViewDidLoad()
        {
            AddOption ("Range Column", rangeColumnSelected);
            AddOption ("Range Bar", rangeBarSelected);

            base.ViewDidLoad ();

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

            lowValues = new NSNumber[] {
                new NSNumber (33), new NSNumber (29),
                new NSNumber (55), new NSNumber (21),
                new NSNumber (10), new NSNumber (39),
                new NSNumber (40), new NSNumber (11)
            };

            highValues = new NSNumber[] {
                new NSNumber (47), new NSNumber (61),
                new NSNumber (64), new NSNumber (40),
                new NSNumber (33), new NSNumber (90),
                new NSNumber (87), new NSNumber (69)
            };

            this.rangeColumnSelected (this, EventArgs.Empty);
        }
Exemple #29
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

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

            Random r = new Random ();
            List<TKChartDataPoint> list1 = new List<TKChartDataPoint> ();
            List<TKChartDataPoint> list2 = new List<TKChartDataPoint> ();
            for (int i = 0; i < 26; i++) {
                list1.Add (new TKChartDataPoint(new NSNumber(i+1), new NSNumber(r.Next(100))));
                list2.Add (new TKChartDataPoint (new NSNumber (i + 1), new NSNumber (r.Next (60))));
            }

            TKChartNumericAxis xAxis = new TKChartNumericAxis(new NSNumber (1), new NSNumber (26));
            xAxis.Position = TKChartAxisPosition.Bottom;
            xAxis.MajorTickInterval = 5;
            chart.AddAxis (xAxis);

            TKChartAreaSeries series = new TKChartAreaSeries (list1.ToArray());
            series.XAxis = xAxis;
            chart.AddSeries (series);

            series = new TKChartAreaSeries (list2.ToArray());
            series.XAxis = xAxis;
            chart.AddSeries (series);

            chart.AllowTrackball = true;
            chart.Trackball.SnapMode = TKChartTrackballSnapMode.AllClosestPoints;
            chart.Delegate = new ChartDelegate ();
            chart.Trackball.Tooltip.Style.TextAlignment = UITextAlignment.Left;
        }
            // >> chart-structure-animation-cs
            public override CAAnimation AnimationForSeries(TKChart chart, TKChartSeries series, TKChartSeriesRenderState state, CGRect rect)
            {
                var duration   = 0.0;
                var animations = new List <CAAnimation> ();

                for (int i = 0; i < (int)state.Points.Count; i++)
                {
                    var pointKeyPath = state.AnimationKeyPathForPointAtIndex((uint)i);
                    var keyPath      = pointKeyPath + ".x";
                    var point        = state.Points.ObjectAtIndex((uint)i) as TKChartVisualPoint;
                    var animation    = new CABasicAnimation();
                    animation.KeyPath  = keyPath;
                    animation.Duration = (double)(r.Next(100)) / 100.0;
                    animation.From     = new NSNumber(0);
                    animation.To       = new NSNumber(point.X);
                    animations.Add(animation);
                    duration = Math.Max(animation.Duration, duration);
                }

                var group = new CAAnimationGroup();

                group.Duration   = duration;
                group.Animations = animations.ToArray();
                return(group);
            }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

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

            Random r = new Random ();
            for (int i = 0; i < 2; i++) {
                List<TKChartDataPoint> list = new List<TKChartDataPoint> ();
                for (int j = 0; j < 20; j++) {
                    list.Add(new TKChartDataPoint(new NSNumber(r.Next() % 1450), new NSNumber(r.Next() % 150)));
                }
                chart.AddSeries (new TKChartScatterSeries (list.ToArray()));
            }

            chart.AddAnnotation (new TKChartGridLineAnnotation(new NSNumber(80), chart.YAxis, new TKStroke(UIColor.Red)));
            chart.AddAnnotation (new TKChartGridLineAnnotation(new NSNumber(600), chart.XAxis));
            chart.AddAnnotation (new TKChartBandAnnotation(new TKRange(new NSNumber(10), new NSNumber(40)), chart.YAxis, new TKSolidFill(new UIColor (1, 0, 0, 0.4f)), null));

            TKChartBandAnnotation a = new TKChartBandAnnotation(new TKRange (new NSNumber(900), new NSNumber(1500)), chart.XAxis);
            a.Style.Fill = new TKSolidFill (new UIColor (0, 1, 0, 0.3f));
            chart.AddAnnotation (a);
        }
        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);
        }
Exemple #33
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

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

            Random r = new Random ();
            List<TKChartDataPoint> list = new List<TKChartDataPoint> ();
            string[] categories = new []{"Apple", "Google", "Microsoft", "Samsung"};
            for (int i = 0; i < categories.Length; i++) {
                list.Add(new TKChartDataPoint(new NSString(categories[i]), new NSNumber(r.Next() % 100)));
            }

            TKChartColumnSeries series = new TKChartColumnSeries (list.ToArray());
            series.SelectionMode = TKChartSeriesSelectionMode.Series;

            TKChartCategoryAxis xAxis = new TKChartCategoryAxis ();
            xAxis.Position = TKChartAxisPosition.Bottom;
            xAxis.PlotMode = TKChartAxisPlotMode.BetweenTicks;
            chart.XAxis = xAxis;

            TKChartNumericAxis yAxis = new TKChartNumericAxis (new NSNumber (0), new NSNumber (100));
            yAxis.Position = TKChartAxisPosition.Left;
            chart.YAxis = yAxis;

            chart.AddSeries (series);
        }
		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));
		}
Exemple #35
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TKChart chart = new TKChart(this.View.Bounds);

            chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.View.AddSubview(chart);
            // >> chart-bubble-cs
            Random r = new Random();

            for (int i = 0; i < 2; i++)
            {
                List <TKChartBubbleDataPoint> list = new List <TKChartBubbleDataPoint> ();
                for (int j = 0; j < 20; j++)
                {
                    list.Add(new TKChartBubbleDataPoint(new NSNumber(r.Next() % 1450), new NSNumber(r.Next() % 150), new NSNumber(r.Next() % 200)));
                }

                TKChartBubbleSeries series = new TKChartBubbleSeries(list.ToArray());
                // << chart-bubble-cs
                series.Title = string.Format("Series {0}", i + 1);
                series.Scale = 1.5;
                series.MarginForHitDetection = 2f;
                if (i == 0)
                {
                    series.Selection = TKChartSeriesSelection.DataPoint;
                }
                else
                {
                    series.Selection = TKChartSeriesSelection.Series;
                }
                chart.AddSeries(series);
            }
        }
            public override CAAnimation AnimationForSeries(TKChart chart, TKChartSeries series, TKChartSeriesRenderState state, CGRect rect)
            {
                double duration = 0;
                List<CAAnimation> animations = new List<CAAnimation>();
                for (int i = 0; i<(int)state.Points.Count; i++) {
                    string pointKeyPath = state.AnimationKeyPathForPointAtIndex ((uint)i);

                    string keyPath = string.Format("{0}.distanceFromCenter", pointKeyPath);
                    CAKeyFrameAnimation a = CAKeyFrameAnimation.GetFromKeyPath(keyPath);
                    a.Values = new NSNumber[] { new NSNumber(50), new NSNumber(50), new NSNumber(0) };
                    a.KeyTimes = new NSNumber[] { new NSNumber(0), new NSNumber(i/(i+1.0)), new NSNumber(1) };
                    a.Duration = 0.3 * (i+1.1);
                    animations.Add(a);

                    keyPath = string.Format("{0}.opacity", pointKeyPath);
                    a = CAKeyFrameAnimation.GetFromKeyPath(keyPath);
                    a.Values = new NSNumber[] { new NSNumber(0), new NSNumber(0), new NSNumber(1) };
                    a.KeyTimes = new NSNumber[] { new NSNumber(0), new NSNumber(i/(i+1.0)), new NSNumber(1) };
                    a.Duration = 0.3 * (i+1.1);
                    animations.Add(a);

                    duration = a.Duration;
                }
                CAAnimationGroup g = new CAAnimationGroup();
                g.Duration = duration;
                g.Animations = animations.ToArray();
                return g;
            }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

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

            Random r = new Random ();
            List<CustomObject> data = new List<CustomObject> ();
            for (int i = 0; i < 5; i++) {
                CustomObject obj = new CustomObject () {
                    ObjectID = i,
                    Value1 = r.Next (100),
                    Value2 = r.Next (100),
                    Value3 = r.Next (100)
                };
                data.Add (obj);
            }

            chart.AddSeries (new TKChartAreaSeries (data.ToArray(), "ObjectID", "Value1"));
            chart.AddSeries (new TKChartAreaSeries (data.ToArray(), "ObjectID", "Value2"));
            chart.AddSeries (new TKChartAreaSeries (data.ToArray(), "ObjectID", "Value3"));

            TKChartStackInfo stackInfo = new TKChartStackInfo (new NSNumber (1), TKChartStackMode.Stack);
            for (int i = 0; i < chart.Series.Length; i++) {
                TKChartSeries series = chart.Series [i];
                series.SelectionMode = TKChartSeriesSelectionMode.Series;
                series.StackInfo = stackInfo;
            }

            chart.ReloadData ();
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

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

			var xAxis = new TKChartDateTimeCategoryAxis ();
			var formatter = new NSDateFormatter ();
			formatter.DateFormat = "d MMM";
			xAxis.LabelFormatter = formatter;
			xAxis.Style.MajorTickStyle.TicksOffset = -3;
			xAxis.Style.MajorTickStyle.TicksHidden = false;
			xAxis.Style.MajorTickStyle.TicksWidth = 1.5f;
			xAxis.Style.MajorTickStyle.TicksFill = new TKSolidFill (new UIColor (203 / 255.0f, 203 / 255.0f, 203 / 255.0f, 1f));
			xAxis.Style.MajorTickStyle.MaxTickClippingMode = TKChartAxisClippingMode.Visible;
			xAxis.PlotMode = TKChartAxisPlotMode.BetweenTicks;

			var yAxis = new TKChartNumericAxis (new NSNumber(320), new NSNumber(360));
			yAxis.MajorTickInterval = 20;

			var series = new TKChartCandlestickSeries(StockDataPoint.LoadStockPoints(10).ToArray());
			series.GapLength = 0.6f;
			series.XAxis = xAxis;
			chart.YAxis = yAxis;

			chart.AddSeries (series);
		}
 public override void PointDeselected(TKChart chart, TKChartData point, TKChartSeries series, nint index)
 {
     if (this.labelRender != null)
     {
         this.labelRender.SelectedDataPoint = -1;
     }
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TKChart chart = new TKChart(this.View.Bounds);

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

            string[] months = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun" };
            int[]    values = new int[] { 95, 40, 55, 30, 76, 34 };
            List <TKChartDataPoint> list = new List <TKChartDataPoint> ();

            for (int i = 0; i < months.Length; i++)
            {
                list.Add(new TKChartDataPoint(new NSString(months[i]), new NSNumber(values[i])));
            }

            TKChartLineSeries series = new TKChartLineSeries(list.ToArray());

            // >> chart-point-shape-cs
            series.Style.PointShape = new TKPredefinedShape(TKShapeType.Circle, new SizeF(10, 10));
            // << chart-point-shape-cs

            // >> chart-point-pallete-cs
            var paletteItem = new TKChartPaletteItem();

            paletteItem.Fill = new TKSolidFill(UIColor.Red);
            var palette = new TKChartPalette();

            palette.AddPaletteItem(paletteItem);
            series.Style.ShapePalette = palette;
            // << chart-point-pallete-cs

            chart.AddSeries(series);
            // >> chart-balloon-annotation-cs
            NSMutableParagraphStyle paragraphStyle = (NSMutableParagraphStyle) new NSParagraphStyle().MutableCopy();

            paragraphStyle.Alignment = UITextAlignment.Center;
            NSMutableDictionary attributes = new NSMutableDictionary();

            attributes.Add(UIStringAttributeKey.ForegroundColor, UIColor.White);
            attributes.Add(UIStringAttributeKey.ParagraphStyle, paragraphStyle);
            NSMutableAttributedString attributedText = new NSMutableAttributedString("Important milestone:\n $55000", attributes);

            attributedText.AddAttribute(UIStringAttributeKey.ForegroundColor, UIColor.Yellow, new NSRange(22, 6));

            TKChartBalloonAnnotation balloon = new TKChartBalloonAnnotation(new NSString("Mar"), new NSNumber(55), series);

            balloon.AttributedText          = attributedText;
            balloon.Style.DistanceFromPoint = 20;
            balloon.Style.ArrowSize         = new Size(10, 10);
            chart.AddAnnotation(balloon);
            // << chart-balloon-annotation-cs

            balloon = new TKChartBalloonAnnotation("The lowest value:\n $30000", new NSString("Apr"), new NSNumber(30), series);
            balloon.Style.VerticalAlign = TKChartBalloonVerticalAlignment.Bottom;
            chart.AddAnnotation(balloon);
        }
 public override void PointSelected(TKChart chart, TKChartData point, TKChartSeries series, nint index)
 {
     if (this.labelRender != null)
     {
         this.labelRender.SelectedSeries    = (int)series.Index;
         this.labelRender.SelectedDataPoint = index;
     }
 }
Exemple #42
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);
            }
Exemple #43
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);
        }
Exemple #44
0
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     this.chart = new TKChart(this.ExampleBounds);
     this.chart.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
     this.View.AddSubview(chart);
     this.dataPoints = new List <TKChartDataPoint> ();
     NSTimer.CreateRepeatingScheduledTimer(0.127, UpdateChart);
 }
Exemple #45
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			this.chart = new TKChart (this.View.Bounds);
			this.chart.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
			this.View.AddSubview (chart);
			this.dataPoints = new List<TKChartDataPoint> ();
			NSTimer.CreateRepeatingScheduledTimer(0.127, UpdateChart);
		}
Exemple #46
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);
        }
            public override CAAnimation AnimationForSeries(TKChart chart, TKChartSeries series, TKChartSeriesRenderState state, CGRect rect)
            {
                double             duration   = 0;
                List <CAAnimation> animations = new List <CAAnimation> ();

                for (int i = 0; i < (int)state.Points.Count; i++)
                {
                    TKChartVisualPoint point = (TKChartVisualPoint)state.Points.ObjectAtIndex((uint)i);

                    if (Grow)
                    {
                        string keyPath = string.Format("seriesRenderStates.{0}.points.{1}.x", series.Index, i);

                        CABasicAnimation animation = (CABasicAnimation)CABasicAnimation.FromKeyPath(keyPath);
                        animation.Duration       = 0.1 * (i + 0.2);
                        animation.From           = new NSNumber(0);
                        animation.To             = new NSNumber(point.X);
                        animation.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut);
                        animations.Add(animation);

                        duration = animation.Duration;
                    }
                    else
                    {
                        string keyPath = string.Format("seriesRenderStates.{0}.points.{1}.y", series.Index, i);
                        nfloat oldY    = rect.Height;

                        if (i > 0)
                        {
                            CAKeyFrameAnimation animation = (CAKeyFrameAnimation)CAKeyFrameAnimation.GetFromKeyPath(keyPath);
                            animation.Duration       = 0.1 * (i + 1);
                            animation.Values         = new NSNumber[] { new NSNumber(oldY), new NSNumber(oldY), new NSNumber(point.Y) };
                            animation.KeyTimes       = new NSNumber[] { new NSNumber(0), new NSNumber(i / (i + 1.0)), new NSNumber(1) };
                            animation.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut);
                            animations.Add(animation);

                            duration = animation.Duration;
                        }
                        else
                        {
                            CABasicAnimation animation = (CABasicAnimation)CABasicAnimation.FromKeyPath(keyPath);
                            animation.From     = new NSNumber(oldY);
                            animation.To       = new NSNumber(point.Y);
                            animation.Duration = 0.1f;
                            animations.Add(animation);
                        }
                    }
                }

                CAAnimationGroup group = new CAAnimationGroup();

                group.Duration   = duration;
                group.Animations = animations.ToArray();

                return(group);
            }
Exemple #48
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));
			}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

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

            this.columnSelected (this, EventArgs.Empty);
        }
Exemple #50
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var chart = new TKChart(CGRect.Inflate(this.View.Bounds, -10, -10));

            this.View.AddSubview(chart);
            chart.DataSource       = new ChartDataSource();
            chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
        }
Exemple #51
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

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

            this.columnSelected(this, EventArgs.Empty);
        }
			public override CAAnimation AnimationForSeries (TKChart chart, TKChartSeries series, TKChartSeriesRenderState state, CGRect rect)
			{
				double duration = 0;
				List<CAAnimation> animations = new List<CAAnimation> ();
			
				for (int i = 0; i<(int)state.Points.Count; i++) 
				{			
					TKChartVisualPoint point = (TKChartVisualPoint)state.Points.ObjectAtIndex ((uint)i);

					if (Grow) 
					{
						string keyPath = string.Format ("seriesRenderStates.{0}.points.{1}.x", series.Index, i);

						CABasicAnimation animation = (CABasicAnimation)CABasicAnimation.FromKeyPath(keyPath);
						animation.Duration = 0.1 *(i + 0.2);
						animation.From = new NSNumber(0);
						animation.To = new NSNumber(point.X);
						animation.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.EaseOut);
						animations.Add(animation);
			
						duration = animation.Duration;
					}
					else 
					{
						string keyPath = string.Format ("seriesRenderStates.{0}.points.{1}.y", series.Index, i);
						nfloat oldY = rect.Height;
	
						if (i > 0) 
						{
							CAKeyFrameAnimation animation = (CAKeyFrameAnimation)CAKeyFrameAnimation.GetFromKeyPath(keyPath);
							animation.Duration = 0.1* (i + 1);
							animation.Values = new NSNumber[] { new NSNumber(oldY), new NSNumber(oldY), new NSNumber(point.Y) };
							animation.KeyTimes = new NSNumber[] { new NSNumber(0), new NSNumber(i/(i+1.0)), new NSNumber(1) };
							animation.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut);
							animations.Add (animation);
	
							duration = animation.Duration;
						}
						else 
						{
							CABasicAnimation animation = (CABasicAnimation)CABasicAnimation.FromKeyPath(keyPath);
							animation.From = new NSNumber(oldY);
							animation.To = new NSNumber(point.Y);
							animation.Duration = 0.1f;
							animations.Add(animation);
						}
					}
				}
			
				CAAnimationGroup group = new CAAnimationGroup ();
				group.Duration = duration;
				group.Animations = animations.ToArray();
			
				return group;
			}
            public override TKChartPaletteItem PaletteItemForPoint(TKChart chart, nuint index, TKChartSeries series)
            {
                if (series.Index == (nuint)this.selectedSeriesIndex && index == (nuint)this.selectedDataPointIndex) {
                    return new TKChartPaletteItem (new TKStroke (UIColor.Black, (float)2.0), new TKSolidFill (UIColor.White));
                }

                if (series.Index == 0) {
                    return new TKChartPaletteItem (new TKSolidFill (new UIColor ((float)(108 / 255.0), (float)(181 / 255.0), (float)(250 / 255.0), (float)1.0)));
                }

                return new TKChartPaletteItem (new TKSolidFill (new UIColor ((float)(241 / 255.0), (float)(140 / 255.0), (float)(133 / 255.0), (float)1.0)));
            }
Exemple #54
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            TKChart chart = new TKChart (this.ExampleBounds);
            chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            chart.DataSource = new ChartDataSource ();
            chart.Legend.Hidden = false;
            chart.Legend.Style.Position = TKChartLegendPosition.Top;
            chart.Legend.Container.Stack.Orientation = TKStackLayoutOrientation.Horizontal;
            this.View.AddSubview (chart);
        }
        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 TKChartPointLabelRender PointLabelRenderForSeries (TKChart chart, TKChartSeries series, TKChartSeriesRender render)
			{
				if (this.labelRender == null) {
					labelRender = new MyPointLabelRender (render, this.selectedDataPointIndex, this.selectedSeriesIndex);
				}

				if (series.Index == 0) {
					return this.labelRender;
				}

				return null;
			}
		public override void ViewDidLoad ()
		{
			this.AddOption ("Apply Gravity", applyGravity);

			base.ViewDidLoad ();

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

			this.reloadChart (this, EventArgs.Empty);
		}
Exemple #58
0
		public override void ViewDidLoad ()
		{
			AddOption ("Column", ColumnSelected);
			AddOption ("Bar", BarSelected);

			base.ViewDidLoad ();

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

			this.ColumnSelected ();
		}
        public override void ViewDidLoad()
        {
            this.AddOption ("Stacked", reloadData);
            this.AddOption ("Stacked 100", reloadData);
            this.AddOption ("No Stacking", reloadData);

            base.ViewDidLoad ();

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

            this.reloadData (this, EventArgs.Empty);
        }
Exemple #60
0
            public override TKChartSeries GetSeries(TKChart chart, nuint index)
            {
                TKChartSeries series = null;

                if (index == 2) {
                    series = new TKChartSplineSeries ();
                } else {
                    series = new TKChartLineSeries ();
                }

                series.SelectionMode = TKChartSeriesSelectionMode.Series;
                series.Style.PointShape = new TKPredefinedShape (TKShapeType.Circle, new System.Drawing.SizeF (10, 10));
                series.Title = string.Format ("Series: {0}", index + 1);
                return series;
            }