Пример #1
0
		void CreateRadialGauge()
		{
			this.radialGauge = new TKRadialGauge ();
			this.radialGauge.Delegate = this.gaugeDelegate;
			this.radialGauge.LabelTitle.Font = UIFont.SystemFontOfSize (30);
			this.radialGauge.LabelTitle.Text = "28˚C";
			this.radialGauge.LabelSubtitle.Text = "temperature";
			this.radialGauge.LabelSubtitle.Font = UIFont.SystemFontOfSize (12);
			this.View.AddSubview(this.radialGauge);

			TKGaugeRadialScale scale = new TKGaugeRadialScale ();
			scale.Range = new TKRange (new NSNumber (10), new NSNumber (40));
			scale.Ticks.Hidden = true;
			scale.Radius = 0.8f;
			scale.Stroke = new TKStroke(UIColor.FromWhiteAlpha(0.7f, 1.0f), 3);
			scale.Labels.Position = TKGaugeLabelsPosition.Outer;
			scale.Labels.Offset = 0.1f;
			this.radialGauge.AddScale (scale);

			TKGaugeSegment segment = new TKGaugeSegment (new NSNumber (10), new NSNumber (28));
			segment.AllowTouch = true;
			segment.Location = 0.84f;
			segment.ShadowOffset = new CGSize(5, 5);
			segment.ShadowOpacity = 0.8f;
			segment.ShadowRadius = 5;
			segment.Width = 0.08f;
			scale.AddSegment(segment);
		}
Пример #2
0
        void CreateRadialGauge()
        {
            this.radialGauge                    = new TKRadialGauge();
            this.radialGauge.Delegate           = this.gaugeDelegate;
            this.radialGauge.LabelTitle.Font    = UIFont.SystemFontOfSize(30);
            this.radialGauge.LabelTitle.Text    = "28˚C";
            this.radialGauge.LabelSubtitle.Text = "temperature";
            this.radialGauge.LabelSubtitle.Font = UIFont.SystemFontOfSize(12);
            this.View.AddSubview(this.radialGauge);

            TKGaugeRadialScale scale = new TKGaugeRadialScale();

            scale.Range           = new TKRange(new NSNumber(10), new NSNumber(40));
            scale.Ticks.Hidden    = true;
            scale.Radius          = 0.8f;
            scale.Stroke          = new TKStroke(UIColor.FromWhiteAlpha(0.7f, 1.0f), 3);
            scale.Labels.Position = TKGaugeLabelsPosition.Outer;
            scale.Labels.Offset   = 0.1f;
            this.radialGauge.AddScale(scale);

            TKGaugeSegment segment = new TKGaugeSegment(new NSNumber(10), new NSNumber(28));

            segment.AllowTouch    = true;
            segment.Location      = 0.84f;
            segment.ShadowOffset  = new CGSize(5, 5);
            segment.ShadowOpacity = 0.8f;
            segment.ShadowRadius  = 5;
            segment.Width         = 0.08f;
            scale.AddSegment(segment);
        }
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge();
            this.linearGauge.WeakDelegate = new GaugeDelegate();
            this.linearGauge.Orientation = TKLinearGaugeOrientation.Vertical;
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale = new TKGaugeLinearScale (new NSNumber(-10), new NSNumber(40));
            this.linearGauge.AddScale (scale);

            TKGaugeSegment segment = new TKGaugeSegment (new NSNumber(-10), new NSNumber(18));
            segment.Location = 0.56f;
            segment.Width = 0.05f;
            segment.Width2 = 0.05f;
            segment.Cap = TKGaugeSegmentCap.Round;

            scale.AddSegment (segment);

            UIColor[] colors = new UIColor[] {
                new UIColor (0.149f, 0.580f, 0.776f, 1.00f),
                new UIColor (0.537f, 0.796f, 0.290f, 1.00f),
                new UIColor (1.000f, 0.773f, 0.247f, 1.00f),
                new UIColor (1.000f, 0.463f, 0.157f, 1.00f),
                new UIColor (0.769f, 0.000f, 0.047f, 1.00f)
            };
            this.AddSegments(scale, colors, 0.5f, 0.05f);
        }
Пример #4
0
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge();
            this.linearGauge.LabelTitle.Font     = UIFont.SystemFontOfSize(16);
            this.linearGauge.LabelTitle.Text     = "85 %";
            this.linearGauge.LabelSubtitle.Font  = UIFont.SystemFontOfSize(12);
            this.linearGauge.LabelSubtitle.Text  = "humidity";
            this.linearGauge.LabelTitleOffset    = new CGPoint(0, -25);
            this.linearGauge.LabelSubtitleOffset = new CGPoint(0, -25);
            this.linearGauge.Delegate            = this.gaugeDelegate;
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale = new TKGaugeLinearScale();

            scale.Range           = new TKRange(new NSNumber(0), new NSNumber(100));
            scale.Ticks.Hidden    = true;
            scale.Stroke          = new TKStroke(UIColor.FromWhiteAlpha(0.7f, 1.0f), 3);
            scale.Labels.Position = TKGaugeLabelsPosition.Outer;
            scale.Labels.Offset   = 0.2f;
            scale.Offset          = 0.2f;
            linearGauge.AddScale(scale);

            TKGaugeSegment segment = new TKGaugeSegment(new NSNumber(0), new NSNumber(85));

            segment.AllowTouch    = true;
            segment.Location      = 0.13f;
            segment.ShadowOffset  = new CGSize(5, 5);
            segment.ShadowOpacity = 0.8f;
            segment.ShadowRadius  = 5;
            segment.Width         = 0.1f;
            segment.Width2        = 0.1f;
            scale.AddSegment(segment);
        }
Пример #5
0
		void CreateRadialGauge()
		{
			this.radialGauge.Delegate = new GaugeDelegate ();
			this.View.AddSubview (this.radialGauge);

			TKGaugeRadialScale scale = new TKGaugeRadialScale (new NSNumber (0), new NSNumber (6));
			this.radialGauge.AddScale (scale);
			scale.AddIndicator(new TKGaugeNeedle(2.3f, 0.6f));

			UIColor[] colors = new UIColor[] { 
				new UIColor (0.871f, 0.871f, 0.871f, 1.00f),
				new UIColor (0.533f, 0.796f, 0.290f, 1.00f),
				new UIColor (1.000f, 0.773f, 0.247f, 1.00f),
				new UIColor (1.000f, 0.467f, 0.161f, 1.00f),
				new UIColor (0.769f, 0.000f, 0.043f, 1.00f)
			};
				
			nfloat max = ((NSNumber)scale.Range.Maximum).FloatValue;
			nfloat rangeWidth = max / colors.Length;
			nfloat start = 0;
			foreach (UIColor color in colors)
			{
				TKGaugeSegment segment = new TKGaugeSegment (new NSNumber(start), new NSNumber(start + rangeWidth));
				segment.Fill = new TKSolidFill (color);
				scale.AddSegment(segment);
				start += rangeWidth;
			}
		}
Пример #6
0
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge();
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale = new TKGaugeLinearScale();

            scale.Stroke        = new TKStroke(UIColor.Clear);
            scale.Ticks.Hidden  = true;
            scale.Labels.Hidden = true;
            this.linearGauge.AddScale(scale);

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(new NSNumber(0), new NSNumber(100));
                segment.Fill     = new TKSolidFill(this.colors[i].ColorWithAlpha(0.4f));
                segment.Width    = 0.2f;
                segment.Width2   = 0.2f;
                segment.Location = i * 0.3f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);

                TKGaugeSegment gradientSegment = new TKGaugeSegment();
                UIColor[]      colors          = new UIColor[] { this.colors[i], this.colors [i + 3] };
                gradientSegment.Fill     = new TKLinearGradientFill(colors, new CGPoint(0.0f, 0.0f), new CGPoint(1.0f, 1.0f));
                gradientSegment.Width    = 0.2f;
                gradientSegment.Width2   = 0.2f;
                gradientSegment.Location = i * 0.3f;
                gradientSegment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(gradientSegment);

                gradientSegment.SetRange(new TKRange(new NSNumber(0), new NSNumber(20 + this.r.Next(50))), 0.5f, CAMediaTimingFunction.EaseInEaseOut);
            }
        }
Пример #7
0
		void CreateRadialGauge()
		{
			this.radialGauge = new TKRadialGauge ();
			this.View.AddSubview (this.radialGauge);

			TKGaugeRadialScale scale = new TKGaugeRadialScale ();
			this.radialGauge.AddScale (scale);
			scale.StartAngle = 0;
			scale.EndAngle = (nfloat)Math.PI*2.0f;
			scale.Stroke = new TKStroke (UIColor.Clear);
			scale.Ticks.Hidden = true;
			scale.Labels.Hidden = true;

			for (int i=0; i < 3; i++) {
				TKGaugeSegment segment = new TKGaugeSegment (new NSNumber (0), new NSNumber (100));
				segment.Fill = new TKSolidFill(this.colors[i].ColorWithAlpha(0.4f));
				segment.Width = 0.2f;
				segment.Location = 0.5f + i * 0.25f;
				segment.Cap = TKGaugeSegmentCap.Round;
				scale.AddSegment(segment);

				TKGaugeSegment gradientSegment = new TKGaugeSegment ();
				UIColor[] colors = new UIColor[] { this.colors[i], this.colors [i + 3] };
				gradientSegment.Fill = new TKLinearGradientFill (colors, new CGPoint(0.0f, 0.0f), new CGPoint(1.0f, 1.0f));
				gradientSegment.Width = 0.2f;
				gradientSegment.Location = 0.5f + i * 0.25f;
				gradientSegment.Cap = TKGaugeSegmentCap.Round;
				scale.AddSegment (gradientSegment);
				gradientSegment.SetRange(new TKRange(new NSNumber(0), new NSNumber(20+ this.r.Next(50)) ), 0.5f, CAMediaTimingFunction.EaseInEaseOut);
			}
		}
Пример #8
0
        void CreateRadialGauge()
        {
            this.radialGauge = new TKRadialGauge();
            this.View.AddSubview(this.radialGauge);

            TKGaugeRadialScale scale = new TKGaugeRadialScale();

            this.radialGauge.AddScale(scale);
            scale.StartAngle    = 0;
            scale.EndAngle      = (nfloat)Math.PI * 2.0f;
            scale.Stroke        = new TKStroke(UIColor.Clear);
            scale.Ticks.Hidden  = true;
            scale.Labels.Hidden = true;
            // >> gauge-customize-cs
            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(new NSNumber(0), new NSNumber(100));
                segment.Fill     = new TKSolidFill(this.colors[i].ColorWithAlpha(0.4f));
                segment.Width    = 0.2f;
                segment.Location = 0.5f + i * 0.25f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);

                TKGaugeSegment gradientSegment = new TKGaugeSegment();
                UIColor[]      colors          = new UIColor[] { this.colors[i], this.colors [i + 3] };
                gradientSegment.Fill     = new TKLinearGradientFill(colors, new CGPoint(0.0f, 0.0f), new CGPoint(1.0f, 1.0f));
                gradientSegment.Width    = 0.2f;
                gradientSegment.Location = 0.5f + i * 0.25f;
                gradientSegment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(gradientSegment);
                gradientSegment.SetRange(new TKRange(new NSNumber(0), new NSNumber(20 + this.r.Next(50))), 0.5f, CAMediaTimingFunction.EaseInEaseOut);
            }
            // << gauge-customize-cs
        }
Пример #9
0
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge ();
            this.linearGauge.LabelTitle.Font = UIFont.SystemFontOfSize (16);
            this.linearGauge.LabelTitle.Text = "85 %";
            this.linearGauge.LabelSubtitle.Font = UIFont.SystemFontOfSize (12);
            this.linearGauge.LabelSubtitle.Text = "humidity";
            this.linearGauge.Delegate = new GaugeDelegate(this);
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale = new TKGaugeLinearScale ();
            scale.Range = new TKRange(new NSNumber (0), new NSNumber (100));
            scale.Ticks.Hidden = true;
            scale.Stroke = new TKStroke(UIColor.FromWhiteAlpha(0.7f, 1.0f), 3);
            scale.Labels.Position = TKGaugeLabelsPosition.Outer;
            scale.Labels.Offset = 0.2f;
            scale.Offset = 0.2f;
            linearGauge.AddScale(scale);

            TKGaugeSegment segment = new TKGaugeSegment (new NSNumber (0), new NSNumber (85));
            segment.AllowTouch = true;
            segment.Location = 0.13f;
            segment.ShadowOffset = new CGSize(5, 5);
            segment.ShadowOpacity = 0.8f;
            segment.ShadowRadius = 5;
            segment.Width = 0.1f;
            segment.Width2 = 0.1f;
            scale.AddSegment(segment);
        }
Пример #10
0
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge();
            this.linearGauge.WeakDelegate = this.gaugeDelegate;
            this.linearGauge.Orientation  = TKLinearGaugeOrientation.Vertical;
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale = new TKGaugeLinearScale(new NSNumber(-10), new NSNumber(40));

            this.linearGauge.AddScale(scale);

            TKGaugeSegment segment = new TKGaugeSegment(new NSNumber(-10), new NSNumber(18));

            segment.Location = 0.56f;
            segment.Width    = 0.05f;
            segment.Width2   = 0.05f;
            segment.Cap      = TKGaugeSegmentCap.Round;

            scale.AddSegment(segment);

            UIColor[] colors = new UIColor[] {
                new UIColor(0.149f, 0.580f, 0.776f, 1.00f),
                new UIColor(0.537f, 0.796f, 0.290f, 1.00f),
                new UIColor(1.000f, 0.773f, 0.247f, 1.00f),
                new UIColor(1.000f, 0.463f, 0.157f, 1.00f),
                new UIColor(0.769f, 0.000f, 0.047f, 1.00f)
            };
            this.AddSegments(scale, colors, 0.5f, 0.05f);
        }
Пример #11
0
        void CreateRadialGauge()
        {
            this.radialGauge.Delegate = new GaugeDelegate();
            this.View.AddSubview(this.radialGauge);

            TKGaugeRadialScale scale = new TKGaugeRadialScale(new NSNumber(0), new NSNumber(6));

            this.radialGauge.AddScale(scale);
            scale.AddIndicator(new TKGaugeNeedle(2.3f, 0.6f));

            UIColor[] colors = new UIColor[] {
                new UIColor(0.871f, 0.871f, 0.871f, 1.00f),
                new UIColor(0.533f, 0.796f, 0.290f, 1.00f),
                new UIColor(1.000f, 0.773f, 0.247f, 1.00f),
                new UIColor(1.000f, 0.467f, 0.161f, 1.00f),
                new UIColor(0.769f, 0.000f, 0.043f, 1.00f)
            };

            nfloat max        = ((NSNumber)scale.Range.Maximum).FloatValue;
            nfloat rangeWidth = max / colors.Length;
            nfloat start      = 0;

            foreach (UIColor color in colors)
            {
                TKGaugeSegment segment = new TKGaugeSegment(new NSNumber(start), new NSNumber(start + rangeWidth));
                segment.Fill = new TKSolidFill(color);
                scale.AddSegment(segment);
                start += rangeWidth;
            }
        }
Пример #12
0
        void CreateRadialGauge()
        {
            this.radialGauge = new TKRadialGauge();
            this.radialGauge.LabelTitle.Text    = @"celsius";
            this.radialGauge.LabelSubtitle.Text = @"farenheit";
            this.radialGauge.LabelTitleOffset   = new CGPoint(0, 60);
            this.View.AddSubview(this.radialGauge);

            // >> gauge-radial-scale-cs
            TKGaugeRadialScale scale1 = new TKGaugeRadialScale();

            scale1.Range          = new TKRange(new NSNumber(34), new NSNumber(40));
            scale1.Ticks.Position = TKGaugeTicksPosition.Inner;
            this.radialGauge.AddScale(scale1);
            // << gauge-radial-scale-cs

            // >>gauge-segments-cs
            // >> gauge-segment-add-cs
            TKGaugeSegment blueSegment = new TKGaugeSegment();

            blueSegment.Range    = new TKRange(new NSNumber(34), new NSNumber(36));
            blueSegment.Location = 0.70f;
            blueSegment.Width    = 0.08f;
            scale1.AddSegment(blueSegment);
            // << gauge-segment-add-cs
            TKGaugeSegment redSegment = new TKGaugeSegment();

            redSegment.Range    = new TKRange(new NSNumber(36.05), new NSNumber(40));
            redSegment.Location = 0.70f;
            redSegment.Width    = 0.08f;
            redSegment.Fill     = new TKSolidFill(UIColor.Red);
            scale1.AddSegment(redSegment);
            // << gauge-segments-cs
            this.SetNeedle(scale1);

            TKGaugeRadialScale scale2 = new TKGaugeRadialScale();

            scale2.Range                 = new TKRange(new NSNumber(93.2), new NSNumber(104));
            scale2.Ticks.Position        = TKGaugeTicksPosition.Outer;
            scale2.Ticks.MajorTicksCount = 6;
            scale2.Ticks.MinorTicksCount = 20;
            scale2.Labels.Offset         = 0.15f;
            scale2.Labels.Position       = TKGaugeLabelsPosition.Outer;
            scale2.Labels.LabelFormat    = "%.01f";
            scale2.Labels.Count          = 6;
            this.radialGauge.AddScale(scale2);

            for (int i = 0; i < this.radialGauge.Scales.Length; i++)
            {
                TKGaugeRadialScale scale = this.radialGauge.Scales[i] as TKGaugeRadialScale;
                scale.Stroke = new TKStroke(UIColor.Gray, 2);
                scale.Ticks.MajorTicksStroke = new TKStroke(UIColor.Gray, 1);
                scale.Labels.Color           = UIColor.Gray;
                scale.Ticks.Offset           = 0;
                scale.Radius = i * 0.12f + 0.60f;
            }
        }
Пример #13
0
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge();
            this.linearGauge.LabelTitle.Text    = @"celsius";
            this.linearGauge.LabelSubtitle.Text = @"farenheit";
            this.linearGauge.LabelOrientation   = TKLinearGaugeOrientation.Vertical;
            this.linearGauge.LabelOffset        = new CGPoint(0, 85);
            this.linearGauge.LabelSpacing       = 75;
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale1 = new TKGaugeLinearScale();

            scale1.Range          = new TKRange(new NSNumber(34), new NSNumber(40));
            scale1.Ticks.Position = TKGaugeTicksPosition.Inner;
            this.linearGauge.AddScale(scale1);

            TKGaugeSegment blueSegment = new TKGaugeSegment();

            blueSegment.Range    = new TKRange(new NSNumber(34), new NSNumber(36));
            blueSegment.Location = 0.62f;
            blueSegment.Width    = 0.08f;
            blueSegment.Width2   = 0.08f;
            scale1.AddSegment(blueSegment);

            TKGaugeSegment redSegment = new TKGaugeSegment();

            redSegment.Range    = new TKRange(new NSNumber(36.05), new NSNumber(40));
            redSegment.Location = 0.62f;
            redSegment.Width    = 0.08f;
            redSegment.Width2   = 0.08f;
            redSegment.Fill     = new TKSolidFill(UIColor.Red);
            scale1.AddSegment(redSegment);

            this.SetNeedle(scale1);

            TKGaugeLinearScale scale2 = new TKGaugeLinearScale();

            scale2.Range                 = new TKRange(new NSNumber(93.2), new NSNumber(104));
            scale2.Ticks.Position        = TKGaugeTicksPosition.Outer;
            scale2.Ticks.MajorTicksCount = 6;
            scale2.Ticks.MinorTicksCount = 20;
            scale2.Labels.Position       = TKGaugeLabelsPosition.Outer;
            scale2.Labels.LabelFormat    = "%.01f";
            scale2.Labels.Count          = 6;
            this.linearGauge.AddScale(scale2);

            for (int i = 0; i < this.linearGauge.Scales.Length; i++)
            {
                TKGaugeLinearScale scale = this.linearGauge.Scales[i] as TKGaugeLinearScale;
                scale.Stroke = new TKStroke(UIColor.Gray, 2);
                scale.Ticks.MajorTicksStroke = new TKStroke(UIColor.Gray, 1);
                scale.Labels.Color           = UIColor.Gray;
                scale.Ticks.Offset           = 0;
                scale.Offset = i * 0.12f + 0.60f;
            }
        }
Пример #14
0
        void CreateRadialGauge()
        {
            this.radialGauge = new TKRadialGauge();
            this.View.AddSubview(this.radialGauge);

            TKGaugeRadialScale scale = new TKGaugeRadialScale();

            scale.Radius          = 0.76f;
            scale.Ticks.Position  = TKGaugeTicksPosition.Outer;
            scale.Labels.Position = TKGaugeLabelsPosition.Outer;
            scale.Labels.Offset   = 0.15f;
            scale.Ticks.Offset    = 0.05f;

            this.radialGauge.AddScale(scale);

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(this.redValues[i], this.redValues[i + 1]);
                segment.Fill     = new TKSolidFill(this.redColors[i]);
                segment.Location = 0.76f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(this.greenValues[i], this.greenValues[i + 1]);
                segment.Fill     = new TKSolidFill(this.greenColors[i]);
                segment.Location = 0.64f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(this.blueValues[i], this.blueValues[i + 1]);
                segment.Fill     = new TKSolidFill(this.blueColors[i]);
                segment.Location = 0.52f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            nfloat[] lengths = new nfloat[] { 0.76f, 0.64f, 0.52f };

            for (int i = 0; i < 3; i++)
            {
                TKGaugeNeedle needle = new TKGaugeNeedle();
                needle.Value  = this.r.Next(100);
                needle.Fill   = new TKSolidFill(UIColor.Gray);
                needle.Length = lengths[i];
                scale.AddIndicator(needle);
            }
        }
Пример #15
0
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge ();
            this.linearGauge.LabelTitle.Text = @"celsius";
            this.linearGauge.LabelSubtitle.Text = @"farenheit";
            this.linearGauge.LabelOrientation = TKLinearGaugeOrientation.Vertical;
            this.linearGauge.LabelOffset = new CGPoint(0, 85);
            this.linearGauge.LabelSpacing = 75;
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale1 = new TKGaugeLinearScale ();
            scale1.Range = new TKRange (new NSNumber(34), new NSNumber(40));
            scale1.Ticks.Position = TKGaugeTicksPosition.Inner;
            this.linearGauge.AddScale(scale1);

            TKGaugeSegment blueSegment = new TKGaugeSegment ();
            blueSegment.Range = new TKRange (new NSNumber(34), new NSNumber(36));
            blueSegment.Location = 0.62f;
            blueSegment.Width = 0.08f;
            blueSegment.Width2 = 0.08f;
            scale1.AddSegment(blueSegment);

            TKGaugeSegment redSegment = new TKGaugeSegment();
            redSegment.Range = new TKRange (new NSNumber(36.05), new NSNumber(40));
            redSegment.Location = 0.62f;
            redSegment.Width = 0.08f;
            redSegment.Width2 = 0.08f;
            redSegment.Fill = new TKSolidFill(UIColor.Red);
            scale1.AddSegment(redSegment);

            this.SetNeedle(scale1);

            TKGaugeLinearScale scale2 = new TKGaugeLinearScale ();
            scale2.Range = new TKRange (new NSNumber(93.2), new NSNumber(104));
            scale2.Ticks.Position = TKGaugeTicksPosition.Outer;
            scale2.Ticks.MajorTicksCount = 6;
            scale2.Ticks.MinorTicksCount = 20;
            scale2.Labels.Position = TKGaugeLabelsPosition.Outer;
            scale2.Labels.LabelFormat = "%.01f";
            scale2.Labels.Count = 6;
            this.linearGauge.AddScale(scale2);

            for(int i = 0; i< this.linearGauge.Scales.Length; i++) {

                TKGaugeLinearScale scale = this.linearGauge.Scales[i] as TKGaugeLinearScale;
                scale.Stroke = new TKStroke(UIColor.Gray, 2);
                scale.Ticks.MajorTicksStroke = new TKStroke(UIColor.Gray, 1);
                scale.Labels.Color = UIColor.Gray;
                scale.Ticks.Offset = 0;
                scale.Offset = i*0.12f + 0.60f;
            }
        }
Пример #16
0
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge();
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale = new TKGaugeLinearScale();

            this.linearGauge.AddScale(scale);

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(this.redValues[i], this.redValues[i + 1]);
                segment.Fill     = new TKSolidFill(this.redColors[i]);
                segment.Location = 0.55f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(this.greenValues[i], this.greenValues[i + 1]);
                segment.Fill     = new TKSolidFill(this.greenColors[i]);
                segment.Location = 0.67f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(this.blueValues[i], this.blueValues[i + 1]);

                segment.Fill     = new TKSolidFill(this.blueColors[i]);
                segment.Location = 0.79f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            nfloat[] lengths = new nfloat[] { 0.55f, 0.67f, 0.79f };

            for (int i = 0; i < 3; i++)
            {
                TKGaugeNeedle needle = new TKGaugeNeedle();
                needle.Value  = this.r.Next(100);
                needle.Fill   = new TKSolidFill(UIColor.Gray);
                needle.Length = 1 - lengths[i];
                scale.AddIndicator(needle);
            }
        }
 void AddSegments(TKGaugeScale scale, UIColor[] colors, nfloat location, nfloat width)
 {
     nfloat max = ((NSNumber)scale.Range.Maximum).FloatValue;
     nfloat min = ((NSNumber)scale.Range.Minimum).FloatValue;
     nfloat rangeWidth = (max - min) / colors.Length;
     nfloat start = min;
     foreach (UIColor color in colors)
     {
         TKGaugeSegment segment = new TKGaugeSegment (new NSNumber(start), new NSNumber(start + rangeWidth));
         segment.Fill = new TKSolidFill (color);
         segment.Location = location;
         segment.Width = width;
         segment.Width2 = width;
         scale.AddSegment(segment);
         start += rangeWidth;
     }
 }
Пример #18
0
        void CreateRadialGauge()
        {
            this.radialGauge = new TKRadialGauge();
            this.radialGauge.LabelSubtitle.Text = "km/h";
            this.radialGauge.LabelTitleOffset   = new CGPoint(0, 20);
            this.View.AddSubview(this.radialGauge);

            TKGaugeRadialScale scale = new TKGaugeRadialScale();

            scale.Range                  = new TKRange(new NSNumber(0), new NSNumber(180));
            scale.Labels.Count           = 9;
            scale.Ticks.MajorTicksCount  = 18;
            scale.Ticks.MinorTicksCount  = 1;
            scale.Ticks.MajorTicksLength = 4;
            scale.Ticks.Offset           = 0.1f;
            scale.Ticks.MajorTicksStroke = new TKStroke(new UIColor(0.522f, 0.522f, 0.522f, 1.00f), 2);
            this.radialGauge.AddScale(scale);

            TKRange[] ranges = new TKRange[] { new TKRange(new NSNumber(0), new NSNumber(60)),
                                               new TKRange(new NSNumber(61), new NSNumber(120)),
                                               new TKRange(new NSNumber(121), new NSNumber(180)) };

            UIColor[] colors = new UIColor[] { new UIColor(0.522f, 0.522f, 0.522f, 1.00f),
                                               new UIColor(0.200f, 0.200f, 0.200f, 1.00f),
                                               new UIColor(0.886f, 0.329f, 0.353f, 1.00f) };
            nint i = 0;

            foreach (TKRange range in ranges)
            {
                TKGaugeSegment segment = new TKGaugeSegment(range);
                segment.Width = 0.02f;
                segment.Fill  = new TKSolidFill(colors[i]);
                scale.AddSegment(segment);
                i++;
            }

            TKGaugeNeedle needle = new TKGaugeNeedle();

            needle.Length        = 0.8f;
            needle.Width         = 3;
            needle.TopWidth      = 3;
            needle.ShadowOffset  = new CGSize(1, 1);
            needle.ShadowOpacity = 0.8f;
            needle.ShadowRadius  = 1.5f;
            scale.AddIndicator(needle);
        }
Пример #19
0
        void AddSegments(TKGaugeScale scale, UIColor[] colors, nfloat location, nfloat width)
        {
            nfloat max        = ((NSNumber)scale.Range.Maximum).FloatValue;
            nfloat min        = ((NSNumber)scale.Range.Minimum).FloatValue;
            nfloat rangeWidth = (max - min) / colors.Length;
            nfloat start      = min;

            foreach (UIColor color in colors)
            {
                TKGaugeSegment segment = new TKGaugeSegment(new NSNumber(start), new NSNumber(start + rangeWidth));
                segment.Fill     = new TKSolidFill(color);
                segment.Location = location;
                segment.Width    = width;
                segment.Width2   = width;
                scale.AddSegment(segment);
                start += rangeWidth;
            }
        }
Пример #20
0
		void CreateLinearGauge()
		{
			this.linearGauge = new TKLinearGauge ();
			this.View.AddSubview(this.linearGauge);

			TKGaugeLinearScale scale = new TKGaugeLinearScale ();
			this.linearGauge.AddScale (scale);

			for (int i = 0; i < 3; i++) {
				TKGaugeSegment segment = new TKGaugeSegment (this.redValues[i], this.redValues[i+1]);
				segment.Fill = new TKSolidFill(this.redColors[i]);
				segment.Location = 0.55f;
				segment.Cap = TKGaugeSegmentCap.Round;
				scale.AddSegment(segment);
			}

			for (int i = 0; i < 3; i++) {
				TKGaugeSegment segment = new TKGaugeSegment (this.greenValues[i], this.greenValues[i+1]);
				segment.Fill = new TKSolidFill(this.greenColors[i]);
				segment.Location = 0.67f;
				segment.Cap = TKGaugeSegmentCap.Round;
				scale.AddSegment(segment);
			}

			for (int i = 0; i < 3; i++) {
				TKGaugeSegment segment = new TKGaugeSegment (this.blueValues[i], this.blueValues[i+1]);

				segment.Fill = new TKSolidFill(this.blueColors[i]);
				segment.Location = 0.79f;
				segment.Cap = TKGaugeSegmentCap.Round;
				scale.AddSegment(segment);
			}

			nfloat[] lengths = new nfloat[]{0.55f, 0.67f, 0.79f };

			for (int i = 0; i < 3 ; i++) {
				
				TKGaugeNeedle needle = new TKGaugeNeedle ();
				needle.Value = this.r.Next (100);
				needle.Fill = new TKSolidFill(UIColor.Gray);
				needle.Length =1 - lengths[i];
				scale.AddIndicator(needle);
			}
		}
Пример #21
0
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge();              //100 height
            this.linearGauge.LabelSubtitle.Text = "rpm x 1000";
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale = new TKGaugeLinearScale();

            scale.Range  = new TKRange(new NSNumber(0), new NSNumber(8));
            scale.Offset = 0.55f;
            scale.Ticks.MinorTicksCount  = 1;
            scale.Ticks.MajorTicksCount  = 14;
            scale.Ticks.MajorTicksLength = 4;
            scale.Ticks.MajorTicksStroke = new TKStroke(new UIColor(0.522f, 0.522f, 0.522f, 1.00f), 2);
            this.linearGauge.AddScale(scale);

            TKGaugeSegment segment = new TKGaugeSegment(new NSNumber(0), new NSNumber(5));

            segment.Fill     = new TKSolidFill(new UIColor(0.522f, 0.522f, 0.522f, 1.00f));
            segment.Location = 0.6f;
            segment.Width    = 0.01f;
            segment.Width2   = 0.01f;
            scale.AddSegment(segment);

            segment          = new TKGaugeSegment(new NSNumber(5.1), new NSNumber(8));
            segment.Fill     = new TKSolidFill(new UIColor(0.886f, 0.329f, 0.353f, 1.00f));
            segment.Location = 0.6f;
            segment.Width    = 0.01f;
            segment.Width2   = 0.01f;
            scale.AddSegment(segment);

            // >> gauge-needle-cs
            TKGaugeNeedle needle = new TKGaugeNeedle();

            needle.Width         = 3;
            needle.TopWidth      = 3;
            needle.Length        = 0.6f;
            needle.ShadowOffset  = new CGSize(1, 1);
            needle.ShadowOpacity = 0.8f;
            needle.ShadowRadius  = 1.5f;
            scale.AddIndicator(needle);
            // << gauge-needle-cs
        }
Пример #22
0
		void CreateLinearGauge() {
			this.linearGauge = new TKLinearGauge (); //100 height
			this.linearGauge.LabelSubtitle.Text = "rpm x 1000";
			this.View.AddSubview(this.linearGauge);

			TKGaugeLinearScale scale = new TKGaugeLinearScale ();
			scale.Range = new TKRange (new NSNumber (0), new NSNumber (8));
			scale.Offset = 0.55f;
			scale.Ticks.MinorTicksCount = 1;
			scale.Ticks.MajorTicksCount = 14;
			scale.Ticks.MajorTicksLength = 4;
			scale.Ticks.MajorTicksStroke = new TKStroke(new UIColor(0.522f, 0.522f, 0.522f, 1.00f), 2);
			this.linearGauge.AddScale(scale);

			TKGaugeSegment segment = new TKGaugeSegment (new NSNumber (0), new NSNumber (5));
			segment.Fill = new TKSolidFill(new UIColor(0.522f, 0.522f, 0.522f, 1.00f));
			segment.Location = 0.6f;
			segment.Width = 0.01f;
			segment.Width2 = 0.01f;
			scale.AddSegment(segment);

			segment = new TKGaugeSegment (new NSNumber (5.1), new NSNumber (8));
			segment.Fill = new TKSolidFill(new UIColor(0.886f, 0.329f, 0.353f, 1.00f));
			segment.Location = 0.6f;
			segment.Width = 0.01f;
			segment.Width2 = 0.01f;
			scale.AddSegment(segment);

			TKGaugeNeedle needle = new TKGaugeNeedle();
			needle.Width = 3;
			needle.TopWidth = 3;
			needle.Length = 0.6f;
			needle.ShadowOffset = new CGSize(1, 1);
			needle.ShadowOpacity = 0.8f;
			needle.ShadowRadius = 1.5f;
			scale.AddIndicator(needle);

		}
Пример #23
0
        void CreateRadialGauge()
        {
            this.radialGauge = new TKRadialGauge ();
            this.radialGauge.LabelSubtitle.Text = "km/h";
            this.radialGauge.LabelOffset = new CGPoint(0, 20);
            this.View.AddSubview(this.radialGauge);

            TKGaugeRadialScale scale = new TKGaugeRadialScale ();
            scale.Range = new TKRange (new NSNumber(0), new NSNumber(180));
            scale.Labels.Count = 9;
            scale.Ticks.MajorTicksCount = 18;
            scale.Ticks.MinorTicksCount = 1;
            scale.Ticks.MajorTicksLength = 4;
            scale.Ticks.Offset = 0.1f;
            scale.Ticks.MajorTicksStroke =  new TKStroke( new UIColor(0.522f, 0.522f, 0.522f, 1.00f), 2);
            this.radialGauge.AddScale(scale);

            TKRange[] ranges = new TKRange[] { new TKRange(new NSNumber(0), new NSNumber(60)),
                                               new TKRange(new NSNumber(61), new NSNumber(120)),
                                                new TKRange(new NSNumber(121), new NSNumber(180))};

            UIColor[] colors = new UIColor[] {new UIColor(0.522f, 0.522f, 0.522f, 1.00f),
                new UIColor(0.200f, 0.200f, 0.200f, 1.00f),
                new UIColor(0.886f, 0.329f, 0.353f, 1.00f)};
            nint i = 0;
            foreach (TKRange range in ranges) {
                TKGaugeSegment segment = new TKGaugeSegment(range);
                segment.Width = 0.02f;
                segment.Fill = new TKSolidFill(colors[i]);
                scale.AddSegment(segment);
                i++;
            }

            TKGaugeNeedle needle = new TKGaugeNeedle();
            needle.Length = 0.8f;
            needle.Width = 3;
            needle.TopWidth = 3;
            needle.ShadowOffset = new CGSize(1, 1);
            needle.ShadowOpacity = 0.8f;
            needle.ShadowRadius = 1.5f;
            scale.AddIndicator(needle);
        }
Пример #24
0
        void CreateRadialGauge()
        {
            this.radialGauge = new TKRadialGauge ();
            this.View.AddSubview(this.radialGauge);

            TKGaugeRadialScale scale = new TKGaugeRadialScale ();
            scale.Radius = 0.76f;
            scale.Ticks.Position = TKGaugeTicksPosition.Outer;
            scale.Labels.Position = TKGaugeLabelsPosition.Outer;
            scale.Labels.Offset = 0.15f;
            scale.Ticks.Offset = 0.05f;

            this.radialGauge.AddScale (scale);

            for (int i = 0; i < 3; i++) {
                TKGaugeSegment segment = new TKGaugeSegment (this.redValues[i], this.redValues[i+1]);
                segment.Fill = new TKSolidFill(this.redColors[i]);
                segment.Location = 0.76f;
                segment.Cap = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++) {
                TKGaugeSegment segment = new TKGaugeSegment (this.greenValues[i], this.greenValues[i+1]);
                segment.Fill = new TKSolidFill(this.greenColors[i]);
                segment.Location = 0.64f;
                segment.Cap = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++) {
                TKGaugeSegment segment = new TKGaugeSegment (this.blueValues[i], this.blueValues[i+1]);
                segment.Fill = new TKSolidFill(this.blueColors[i]);
                segment.Location = 0.52f;
                segment.Cap = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            nfloat[] lengths = new nfloat[]{ 0.76f, 0.64f, 0.52f };

            for (int i = 0; i < 3 ; i++) {
                TKGaugeNeedle needle = new TKGaugeNeedle ();
                needle.Value =  this.r.Next (100);
                needle.Fill = new TKSolidFill(UIColor.Gray);
                needle.Length =  lengths[i];
                scale.AddIndicator(needle);
            }
        }