public GradientRange()
        {
            gauge = new SFCircularGauge();
            gauge.BackgroundColor = UIColor.White;

            ObservableCollection <SFCircularScale> scales = new ObservableCollection <SFCircularScale>();

            SFCircularScale scale = new SFCircularScale();

            scale.StartValue = 0;
            scale.EndValue   = 100;
            scale.Interval   = 10;
            scale.ShowRim    = false;
            scale.ShowTicks  = false;
            scale.ShowLabels = false;

            SFCircularRange range = new SFCircularRange();

            range.Offset     = 0.8f;
            range.StartValue = 0;
            range.EndValue   = 100;
            range.Width      = 25;

            GaugeGradientStop color1 = new GaugeGradientStop();

            color1.Value = 0;
            color1.Color = UIColor.FromRGB(240, 62, 62);
            range.GradientStops.Add(color1);

            GaugeGradientStop color2 = new GaugeGradientStop();

            color2.Value = 35;
            color2.Color = UIColor.FromRGB(255, 221, 0);
            range.GradientStops.Add(color2);

            GaugeGradientStop color3 = new GaugeGradientStop();

            color3.Value = 75;
            color3.Color = UIColor.FromRGB(255, 221, 0);
            range.GradientStops.Add(color3);

            GaugeGradientStop color4 = new GaugeGradientStop();

            color4.Value = 100;
            color4.Color = UIColor.FromRGB(48, 179, 45);
            range.GradientStops.Add(color4);
            scale.Ranges.Add(range);

            ObservableCollection <SFMarkerPointer> pointers = new ObservableCollection <SFMarkerPointer>();
            SFMarkerPointer pointer = new SFMarkerPointer();

            pointer.MarkerShape  = MarkerShape.InvertedTriangle;
            pointer.Offset       = 0.8f;
            pointer.Value        = 55;
            pointer.MarkerWidth  = 15;
            pointer.MarkerHeight = 15;
            pointer.Color        = UIColor.Red;
            pointers.Add(pointer);
            scale.Pointers.Add(pointer);

            SFGaugeHeader header1 = new SFGaugeHeader();

            header1.Text      = (Foundation.NSString) "0";
            header1.TextColor = UIColor.FromRGB(240, 62, 62);
            header1.Position  = new CGPoint(0.28, 0.86);
            header1.TextStyle = UIFont.BoldSystemFontOfSize(12);
            gauge.Headers.Add(header1);

            SFGaugeHeader header2 = new SFGaugeHeader();

            header2.Text      = (Foundation.NSString) "100";
            header2.TextColor = UIColor.FromRGB(48, 179, 45);
            header2.Position  = new CGPoint(0.75, 0.86);
            header2.TextStyle = UIFont.BoldSystemFontOfSize(12);
            gauge.Headers.Add(header2);

            SFGaugeHeader header3 = new SFGaugeHeader();

            header3.Text      = (Foundation.NSString) "55%";
            header3.TextColor = UIColor.FromRGB(240, 62, 62);
            header3.Position  = new CGPoint(0.5, 0.5);
            header1.TextStyle = UIFont.BoldSystemFontOfSize(16);
            gauge.Headers.Add(header3);

            scales.Add(scale);


            gauge.Scales = scales;
            this.AddSubview(gauge);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SfCircularGauge circularGauge = new SfCircularGauge(this);

            circularGauge.SetBackgroundColor(Color.White);
            ObservableCollection <CircularScale> scales = new ObservableCollection <CircularScale>();



            CircularScale scale1 = new CircularScale();

            scale1.ShowTicks        = false;
            scale1.StartValue       = 0;
            scale1.EndValue         = 100;
            scale1.StartAngle       = 160;
            scale1.SweepAngle       = 220;
            scale1.ShowLabels       = false;
            scale1.RimColor         = Color.ParseColor("#f4deeb");
            scale1.ScaleStartOffset = 0.9;
            scale1.ScaleEndOffset   = 0.5;


            CircularRange range1 = new CircularRange();

            range1.StartValue       = 0;
            range1.EndValue         = 70;
            range1.OuterStartOffset = 0.9;
            range1.OuterEndOffset   = 0.9;
            range1.InnerStartOffset = 0.7;
            range1.InnerEndOffset   = 0.7;
            scale1.CircularRanges.Add(range1);

            ObservableCollection <GaugeGradientStop> gradientColor1 = new ObservableCollection <GaugeGradientStop>();

            GaugeGradientStop gaugeGradientStop = new GaugeGradientStop();

            gaugeGradientStop.Value = 0;
            gaugeGradientStop.Color = Color.WhiteSmoke;
            gradientColor1.Add(gaugeGradientStop);

            GaugeGradientStop gaugeGradientStop1 = new GaugeGradientStop();

            gaugeGradientStop1.Value = 50;
            gaugeGradientStop1.Color = Color.Olive;
            gradientColor1.Add(gaugeGradientStop1);

            CircularRange range2 = new CircularRange();

            range2.StartValue       = 0;
            range2.EndValue         = 40;
            range2.OuterStartOffset = 0.7;
            range2.OuterEndOffset   = 0.7;
            range2.InnerStartOffset = 0.5;
            range2.InnerEndOffset   = 0.5;


            ObservableCollection <GaugeGradientStop> gradientColor2 = new ObservableCollection <GaugeGradientStop>();


            GaugeGradientStop gaugeGradientStop2 = new GaugeGradientStop();

            gaugeGradientStop2.Value = 0;
            gaugeGradientStop2.Color = Color.ParseColor("#d5f7cd");
            gradientColor2.Add(gaugeGradientStop2);

            GaugeGradientStop gaugeGradientStop3 = new GaugeGradientStop();

            gaugeGradientStop3.Value = 20;
            gaugeGradientStop3.Color = Color.ParseColor("#5af736");
            gradientColor2.Add(gaugeGradientStop3);

            GaugeGradientStop gaugeGradientStop4 = new GaugeGradientStop();

            gaugeGradientStop4.Value = 35;
            gaugeGradientStop4.Color = Color.DarkGreen;
            gradientColor2.Add(gaugeGradientStop4);

            range1.GradientStops = gradientColor1;
            range2.GradientStops = gradientColor2;

            scale1.CircularRanges.Add(range1);
            scale1.CircularRanges.Add(range2);

            scales.Add(scale1);



            circularGauge.CircularScales = scales;

            SetContentView(circularGauge);
        }
#if __UNIFIED__
using Foundation; 
using UIKit; 
using CoreGraphics; 

#else
using MonoTouch.Foundation; 
using MonoTouch.UIKit; 
using MonoTouch.CoreGraphics; 
using nint = System.Int32; 
using nuint = System.Int32; 
using CGSize = System.Drawing.SizeF; 
using CGRect = System.Drawing.RectangleF; 
using nfloat = System.Single; 
#endif
using Syncfusion.SfGauge.iOS; 
namespace SampleBrowser
 { 
 public class ScaleandPointers : SampleView
    { 
 SFLinearGauge linearGauge; 
 SFLinearScale scale; 
 UIPickerView opposed; 
 UIPickerView rangeCap; 
 UIPickerView markerShape; 
 UIView option = new UIView(); 
 SFSymbolPointer pointer; 
 SFBarPointer pointer1; 

 static bool UserInterfaceIdiomIsPhone
        { 
 get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; } 
 } 

        #region View lifecycle
 public override void LayoutSubviews() 
        { 
 foreach(var view in this.Subviews) 
                { 
 view.Frame = Bounds; 
 linearGauge.Frame = new CGRect(0, -20, this.Frame.Size.Width, this.Frame.Size.Height + 20); 
 } 
 
 base.LayoutSubviews(); 
 } 
 public ScaleandPointers() 
        { 
 opposed = new UIPickerView(); 
 rangeCap = new UIPickerView(); 
 markerShape = new UIPickerView(); 

                                                                                                                                                                                                                                          //LinearGauge
            this.BackgroundColor = UIColor.White;

            linearGauge = new SFLinearGauge();
            linearGauge.BackgroundColor = UIColor.White;
            linearGauge.Header = new SFLinearLabel();


			scale  = new SFLinearScale();
            scale.Minimum = 0;
            scale.Maximum = 100;
            scale.Interval = 10;
            scale.CornerRadius = 20;
            scale.CornerRadiusType = CornerRadiusType.End;
            scale.ScaleBarSize = 40;
            scale.LabelColor = UIColor.FromRGB(66, 66, 66);
            scale.LabelFont = UIFont.FromName("Helvetica", 14f);
            scale.MinorTicksPerInterval = 1;
			scale.MinorTickSettings.Length = 8;
            scale.ScaleBarColor = UIColor.FromRGB(224,233,249);

            SFLinearTickSettings major = new SFLinearTickSettings();
            major.Thickness = 1f;
            major.Length = 10;
            major.Color = UIColor.FromRGB(158, 158, 158);
            scale.MajorTickSettings = major;


            pointer = new SFSymbolPointer();
            pointer.SymbolPosition = SymbolPointerPosition.Away;
            pointer.Thickness = 12;
            pointer.Value = 30;
            pointer.Color = UIColor.FromRGB(91, 134, 229);
			pointer.MarkerShape = MarkerShape.Triangle;
            scale.Pointers.Add(pointer);

            pointer1 = new SFBarPointer();
            pointer1.Value = 75;
            pointer1.CornerRadiusValue = 15;
            pointer1.CornerRadiusType = CornerRadiusType.End;
			pointer1.Thickness = 30;

            GaugeGradientStop color1 = new GaugeGradientStop();
            color1.Value = 0;
            color1.Color = UIColor.FromRGB(54, 209, 220);
            pointer1.GradientStops.Add(color1);

            GaugeGradientStop color2 = new GaugeGradientStop();
            color2.Value = 75;
            color2.Color = UIColor.FromRGB(91, 134, 229);
            pointer1.GradientStops.Add(color2);

            scale.Pointers.Add(pointer1);

            linearGauge.Scales.Add(scale);

            this.AddSubview(linearGauge);
			CreateOptionView();
			this.OptionView = option;
        }

		private void CreateOptionView()
		{

			UILabel text1 = new UILabel();
			text1.Text = "Opposite position";
			text1.TextAlignment = UITextAlignment.Left;
			text1.TextColor = UIColor.Black;
			text1.Frame = new CGRect(10, 10, 320, 40);
			text1.Font = UIFont.FromName("Helvetica", 14f);

			List<string> position = new List<string> { "True", "False" };
			var picker = new OpposedPickerModel(position);

			opposed.Model = picker;
			opposed.SelectedRowInComponent(0);
Exemple #4
0
        public Ranges()
        {
            this.BackgroundColor = UIColor.White;

            linearGauge = new SFLinearGauge();
            linearGauge.BackgroundColor = UIColor.White;
            linearGauge.Header          = new SFLinearLabel();

            SFLinearScale scale = new SFLinearScale();

            scale.Minimum       = 0;
            scale.Maximum       = 100;
            scale.Interval      = 25;
            scale.LabelOffset   = 10;
            scale.LabelColor    = UIColor.FromRGB(66, 66, 66);
            scale.LabelFont     = UIFont.FromName("Helvetica", 14f);
            scale.ShowTicks     = false;
            scale.ScaleBarColor = UIColor.Clear;

            SFSymbolPointer pointer = new SFSymbolPointer();

            pointer.SymbolPosition = SymbolPointerPosition.Far;
            pointer.Thickness      = 12;
            pointer.Value          = 35;
            pointer.Color          = UIColor.Black;
            pointer.MarkerShape    = MarkerShape.InvertedTriangle;
            scale.Pointers.Add(pointer);

            SFLinearRange range1 = new SFLinearRange();

            range1.StartValue = 0;
            range1.EndValue   = 25;
            range1.StartWidth = 20;
            range1.EndWidth   = 20;
            range1.Color      = UIColor.FromRGB(26, 35, 126);
            scale.Ranges.Add(range1);

            SFLinearRange range2 = new SFLinearRange();

            range2.StartValue = 25;
            range2.EndValue   = 50;
            range2.StartWidth = 20;
            range2.EndWidth   = 20;
            range2.Color      = UIColor.FromRGB(40, 53, 147);
            scale.Ranges.Add(range2);

            SFLinearRange range3 = new SFLinearRange();

            range3.StartValue = 50;
            range3.EndValue   = 75;
            range3.StartWidth = 20;
            range3.EndWidth   = 20;
            range3.Color      = UIColor.FromRGB(63, 81, 181);
            scale.Ranges.Add(range3);

            SFLinearRange range4 = new SFLinearRange();

            range4.StartValue = 75;
            range4.EndValue   = 100;
            range4.StartWidth = 20;
            range4.EndWidth   = 20;
            range4.Color      = UIColor.FromRGB(92, 107, 192);
            scale.Ranges.Add(range4);

            linearGauge.Scales.Add(scale);


            linearGauge1 = new SFLinearGauge();
            linearGauge1.BackgroundColor = UIColor.White;
            linearGauge1.Header          = new SFLinearLabel();

            SFLinearScale scale1 = new SFLinearScale();

            scale1.Minimum       = 0;
            scale1.Maximum       = 100;
            scale1.Interval      = 25;
            scale1.LabelOffset   = 20;
            scale1.LabelColor    = UIColor.FromRGB(66, 66, 66);
            scale1.LabelFont     = UIFont.FromName("Helvetica", 14f);
            scale1.ShowTicks     = false;
            scale1.ScaleBarColor = UIColor.Clear;

            SFSymbolPointer pointer1 = new SFSymbolPointer();

            pointer1.SymbolPosition = SymbolPointerPosition.Far;
            pointer1.Thickness      = 12;
            pointer1.Value          = 35;
            pointer1.Color          = UIColor.Black;
            pointer1.MarkerShape    = MarkerShape.InvertedTriangle;
            scale1.Pointers.Add(pointer1);

            SFLinearRange range5 = new SFLinearRange();

            range5.StartValue = 0;
            range5.EndValue   = 25;
            range5.StartWidth = 10;
            range5.EndWidth   = 15;
            range5.Color      = UIColor.FromRGB(109, 229, 0);
            scale1.Ranges.Add(range5);

            SFLinearRange range6 = new SFLinearRange();

            range6.StartValue = 25;
            range6.EndValue   = 50;
            range6.StartWidth = 15;
            range6.EndWidth   = 20;
            range6.Color      = UIColor.FromRGB(83, 173, 0);
            scale1.Ranges.Add(range6);

            SFLinearRange range7 = new SFLinearRange();

            range7.StartValue = 50;
            range7.EndValue   = 75;
            range7.StartWidth = 20;
            range7.EndWidth   = 25;
            range7.Color      = UIColor.FromRGB(0, 145, 72);
            scale1.Ranges.Add(range7);

            SFLinearRange range8 = new SFLinearRange();

            range8.StartValue = 75;
            range8.EndValue   = 100;
            range8.StartWidth = 25;
            range8.EndWidth   = 30;
            range8.Color      = UIColor.FromRGB(2, 102, 35);
            scale1.Ranges.Add(range8);

            linearGauge1.Scales.Add(scale1);


            linearGauge2 = new SFLinearGauge();
            linearGauge2.BackgroundColor = UIColor.White;
            linearGauge2.Header          = new SFLinearLabel();

            SFLinearScale scale2 = new SFLinearScale();

            scale2.Minimum       = 0;
            scale2.Maximum       = 100;
            scale2.Interval      = 25;
            scale2.LabelOffset   = 20;
            scale2.LabelColor    = UIColor.FromRGB(66, 66, 66);
            scale2.LabelFont     = UIFont.FromName("Helvetica", 14f);
            scale2.ShowTicks     = false;
            scale2.ScaleBarColor = UIColor.Clear;

            SFSymbolPointer pointer2 = new SFSymbolPointer();

            pointer2.SymbolPosition = SymbolPointerPosition.Far;
            pointer2.Thickness      = 12;
            pointer2.Value          = 35;
            pointer2.Color          = UIColor.Black;
            pointer2.MarkerShape    = MarkerShape.InvertedTriangle;
            scale2.Pointers.Add(pointer2);

            SFLinearRange range9 = new SFLinearRange();

            range9.StartValue = 0;
            range9.EndValue   = 100;
            range9.StartWidth = 20;
            range9.EndWidth   = 20;

            GaugeGradientStop color3 = new GaugeGradientStop();

            color3.Value = 0;
            color3.Color = UIColor.FromRGB(255, 249, 194);

            GaugeGradientStop color4 = new GaugeGradientStop();

            color4.Value = 100;
            color4.Color = UIColor.FromRGB(253, 145, 215);
            range9.GradientStops.Add(color3);
            range9.GradientStops.Add(color4);
            scale2.Ranges.Add(range9);


            linearGauge2.Scales.Add(scale2);


            this.AddSubview(linearGauge);
            this.AddSubview(linearGauge1);
            this.AddSubview(linearGauge2);
        }
Exemple #5
0
        public override View GetSampleContent(Context con)
        {
            SfCircularGauge sfCircularGauge = new SfCircularGauge(con);

            ObservableCollection <Header> headers = new ObservableCollection <Header>();
            Header header = new Header();

            header.Text      = "0";
            header.TextSize  = 20;
            header.TextColor = Color.ParseColor("#F03E3E");
            header.Position  = new PointF((float)0.28, (float)0.86);
            headers.Add(header);

            Header header1 = new Header();

            header1.Text      = "100";
            header1.TextSize  = 20;
            header1.TextColor = Color.ParseColor("#30B32D");
            header1.Position  = new PointF((float)0.75, (float)0.86);
            headers.Add(header1);

            Header header2 = new Header();

            header2.Text      = "55%";
            header2.TextSize  = 20;
            header2.TextColor = Color.ParseColor("#F03E3E");
            header2.Position  = new PointF((float)0.5, (float)0.5);
            headers.Add(header2);
            sfCircularGauge.Headers = headers;

            ObservableCollection <CircularScale> circularScales = new ObservableCollection <CircularScale>();
            CircularScale scale = new CircularScale();

            scale.StartValue = 0;
            scale.EndValue   = 100;
            scale.Interval   = 10;
            scale.ShowRim    = false;
            scale.ShowTicks  = false;
            scale.ShowLabels = false;

            ObservableCollection <CircularRange> ranges = new ObservableCollection <CircularRange>();
            CircularRange circularRange = new CircularRange();

            circularRange.Offset     = 0.8;
            circularRange.StartValue = 0;
            circularRange.EndValue   = 100;
            circularRange.Width      = 25;

            ObservableCollection <GaugeGradientStop> gradients = new ObservableCollection <GaugeGradientStop>();
            GaugeGradientStop gaugeGradientStop = new GaugeGradientStop();

            gaugeGradientStop.Value = 0;
            gaugeGradientStop.Color = Color.ParseColor("#F03E3E");
            gradients.Add(gaugeGradientStop);
            GaugeGradientStop gaugeGradientStop1 = new GaugeGradientStop();

            gaugeGradientStop1.Value = 35;
            gaugeGradientStop1.Color = Color.ParseColor("#FFDD00");
            gradients.Add(gaugeGradientStop1);
            GaugeGradientStop gaugeGradientStop2 = new GaugeGradientStop();

            gaugeGradientStop2.Value = 75;
            gaugeGradientStop2.Color = Color.ParseColor("#FFDD00");
            gradients.Add(gaugeGradientStop2);
            GaugeGradientStop gaugeGradientStop3 = new GaugeGradientStop();

            gaugeGradientStop3.Value = 100;
            gaugeGradientStop3.Color = Color.ParseColor("#30B32D");
            gradients.Add(gaugeGradientStop3);
            circularRange.GradientStops = gradients;
            ranges.Add(circularRange);
            scale.CircularRanges = ranges;

            ObservableCollection <CircularPointer> pointers = new ObservableCollection <CircularPointer>();
            MarkerPointer markerPointer = new MarkerPointer();

            markerPointer.MarkerShape  = Com.Syncfusion.Gauges.SfCircularGauge.Enums.MarkerShape.InvertedTriangle;
            markerPointer.Offset       = 0.8;
            markerPointer.MarkerHeight = 15;
            markerPointer.MarkerWidth  = 15;
            markerPointer.Value        = 55;
            markerPointer.Color        = Color.Red;
            pointers.Add(markerPointer);

            scale.CircularPointers = pointers;
            circularScales.Add(scale);
            sfCircularGauge.CircularScales = circularScales;

            sfCircularGauge.SetBackgroundColor(Color.White);

            LinearLayout linearLayout = new LinearLayout(con);

            linearLayout.AddView(sfCircularGauge);
            linearLayout.SetPadding(30, 30, 30, 30);
            linearLayout.SetBackgroundColor(Color.White);
            return(linearLayout);
        }