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);
        }
Beispiel #2
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
        }
Beispiel #3
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);
			}
		}
Beispiel #4
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);
		}
Beispiel #5
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;
            }
        }
        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);
            }
        }
Beispiel #7
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);

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

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

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

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

		}
Beispiel #8
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);
        }
        void CreateRadialGauge()
        {
            // >> gauge-radial-cs
            radialGauge = new TKRadialGauge();
            this.radialGauge.Delegate = new GaugeDelegate();
            this.View.AddSubview(this.radialGauge);
            // << gauge-radial-cs

            // >> gauge-radial-scale-cs
            TKGaugeRadialScale scale = new TKGaugeRadialScale(new NSNumber(0), new NSNumber(6));

            this.radialGauge.AddScale(scale);
            // << gauge-radial-scale-cs

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