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


C# TKChart.AddAnnotation方法代码示例

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


在下文中一共展示了TKChart.AddAnnotation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: ViewDidLoad

        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])));
            }

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

            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);

            balloon = new TKChartBalloonAnnotation ("The lowest value:\n $30000", new NSString("Apr"), new NSNumber(30), series);
            balloon.Style.VerticalAlign = TKChartBalloonVerticalAlignment.Bottom;
            chart.AddAnnotation (balloon);
        }
开发者ID:sudipnath,项目名称:ios-sdk,代码行数:39,代码来源:BalloonAnnotation.cs

示例4: 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()));
            }

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

示例5: ViewDidLoad

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

示例6: 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 = { "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);
		}
开发者ID:tremors,项目名称:ios-sdk,代码行数:24,代码来源:CustomAnnotation.cs

示例7: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

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

			List<TKChartDataPoint> array = new List<TKChartDataPoint>();
			array.Add(new TKChartDataPoint(new NSNumber(25.0), null, "Auto &\nTransport"));
			array.Add(new TKChartDataPoint(new NSNumber(25.0), null, "Food &\nDining"));
			array.Add(new TKChartDataPoint(new NSNumber(25.0), null, "Fees &\nCharges"));
			array.Add(new TKChartDataPoint(new NSNumber(12.5), null, "Business\nServices"));
			array.Add(new TKChartDataPoint(new NSNumber(12.5), null, "Personal\nCare"));

			var series = new TKChartPieSeries(array.ToArray());
			series.SelectionMode = TKChartSeriesSelectionMode.DataPoint;
			series.ExpandRadius = (nfloat)1.04;
			series.RotationAngle = (nfloat)(-(Math.PI/2.0f + Math.PI/4.0f));
			series.RadiusInset = 50;
			series.LabelDisplayMode = TKChartPieSeriesLabelDisplayMode.Inside;
			series.Style.PointLabelStyle.TextHidden = false;
			series.Style.PointLabelStyle.StringFormat = "%.0f%%";
			series.Style.PointLabelStyle.TextColor = UIColor.White;
			pieChart.AddSeries(series);

			foreach (TKChartDataPoint pt in series.Items) {
				var annotation = new TKChartBalloonAnnotation(pt.DataName, pt, series);
				annotation.Style.Fill = null;
				annotation.Style.Stroke = null;
				annotation.Style.DistanceFromPoint = 0;
				annotation.Style.TextColor = UIColor.Gray;
				pieChart.AddAnnotation(annotation);
			}
		}
开发者ID:tremors,项目名称:ios-sdk,代码行数:36,代码来源:PieChartAnnotations.cs

示例8: 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 ();
            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]));
        }
开发者ID:sudipnath,项目名称:ios-sdk,代码行数:18,代码来源:CrossLineAnnotation.cs


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