当前位置: 首页>>代码示例>>C#>>正文


C# TKChart类代码示例

本文整理汇总了C#中TKChart的典型用法代码示例。如果您正苦于以下问题:C# TKChart类的具体用法?C# TKChart怎么用?C# TKChart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TKChart类属于命名空间,在下文中一共展示了TKChart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ViewDidLoad

        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);
        }
开发者ID:sudipnath,项目名称:ios-sdk,代码行数:25,代码来源:BandAndLineAnnotations.cs

示例2: PointSelected

			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;
				}
			}
开发者ID:tremors,项目名称:ios-sdk,代码行数:7,代码来源:CustomPointLabelRender.cs

示例3: ViewDidLoad

		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);
		}
开发者ID:tremors,项目名称:ios-sdk,代码行数:29,代码来源:LayerAnnotation.cs

示例4: AnimationForSeries

            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;
            }
开发者ID:sudipnath,项目名称:ios-sdk,代码行数:28,代码来源:CustomAnimationPieChart.cs

示例5: ViewDidLoad

        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;
        }
开发者ID:sudipnath,项目名称:ios-sdk,代码行数:35,代码来源:PanZoom.cs

示例6: ViewDidLoad

        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;
        }
开发者ID:sudipnath,项目名称:ios-sdk,代码行数:34,代码来源:Trackball.cs

示例7: ViewDidLoad

		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);
		}
开发者ID:tremors,项目名称:ios-sdk,代码行数:28,代码来源:CustomAnimationLineChart.cs

示例8: AnimationForSeries

            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;
            }
开发者ID:joelconnects,项目名称:ios-sdk,代码行数:25,代码来源:CustomAnimationAreaChart.cs

示例9: ViewDidLoad

        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);
        }
开发者ID:sudipnath,项目名称:ios-sdk,代码行数:31,代码来源:NumericAxis.cs

示例10: ViewDidLoad

        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;
        }
开发者ID:sudipnath,项目名称:ios-sdk,代码行数:31,代码来源:ScatterChart.cs

示例11: ViewDidLoad

		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);
		}
开发者ID:tremors,项目名称:ios-sdk,代码行数:29,代码来源:DateTimeCategoryAxis.cs

示例12: ViewDidLoad

		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));
		}
开发者ID:tremors,项目名称:ios-sdk,代码行数:30,代码来源:CustomPointLabelRender.cs

示例13: ViewDidLoad

		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);
			}
		}
开发者ID:tremors,项目名称:ios-sdk,代码行数:27,代码来源:BubbleChart.cs

示例14: ViewDidLoad

        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);
        }
开发者ID:joelconnects,项目名称:ios-sdk,代码行数:27,代码来源:RangeColumnBarChart.cs

示例15: GetPoint

 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;
 }
开发者ID:sudipnath,项目名称:ios-sdk,代码行数:7,代码来源:BindWithDelegate.cs


注:本文中的TKChart类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。