public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_gauge_getting_started, container, false); // >> radial-gauge-load RadRadialGaugeView gauge = (RadRadialGaugeView)rootView.FindViewById(Resource.Id.radial_gauge); // << radial-gauge-load // >> radial-scale-setup GaugeRadialScale scale = new GaugeRadialScale(this.Context); scale.Minimum = 0; scale.Maximum = 6; scale.MajorTicksCount = 7; scale.MinorTicksCount = 9; scale.LabelsCount = 7; scale.LineVisible = false; scale.Radius = 0.95f; scale.TicksOffset = 0; // << radial-scale-setup // >> radial-indicators-setup int[] colors = new int[] { Color.Rgb(221, 221, 221), Color.Rgb(157, 202, 86), Color.Rgb(240, 196, 77), Color.Rgb(226, 118, 51), Color.Rgb(167, 1, 14) }; float rangeWidth = scale.Maximum / colors.Length; float start = 0; foreach (var color in colors) { GaugeRadialBarIndicator indicator = new GaugeRadialBarIndicator(this.Context); indicator.Minimum = start; indicator.Maximum = start + rangeWidth; indicator.FillColor = color; scale.AddIndicator(indicator); start += rangeWidth; } GaugeRadialNeedle needle = new GaugeRadialNeedle(this.Context); needle.Value = 2; scale.AddIndicator(needle); // << radial-indicators-setup // >> add-radial-scale gauge.AddScale(scale); // << add-radial-scale return(rootView); }
public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_gauge_customization, container, false); gauge = (RadRadialGaugeView)rootView.FindViewById(Resource.Id.radial_gauge); GaugeRadialScale scale = new GaugeRadialScale(Activity); scale.StartAngle = 0; scale.SweepAngle = 360; scale.LineVisible = false; scale.SetRange(0, 100); scale.TicksVisible = false; scale.LabelsVisible = false; // >> gauges-indicators-bars int[] transparentColors = new int[] { Color.Argb(100, 224, 151, 36), Color.Argb(100, 196, 241, 57), Color.Argb(100, 132, 235, 247) }; int[] colors = new int[] { Color.Argb(255, 224, 151, 36), Color.Argb(255, 196, 241, 57), Color.Argb(255, 132, 235, 247) }; for (int i = 0; i < 3; i++) { GaugeRadialBarIndicator trnspIndicator = new GaugeRadialBarIndicator(Activity); trnspIndicator.Minimum = 0; trnspIndicator.Maximum = 100; trnspIndicator.FillColor = transparentColors[i]; trnspIndicator.BarWidth = 0.2f; trnspIndicator.Location = 0.5f + i * 0.25f; scale.AddIndicator(trnspIndicator); GaugeRadialBarIndicator indicator = new GaugeRadialBarIndicator(Activity); indicator.Minimum = 0; Random r = new Random(); indicator.Maximum = r.Next(100); indicator.Animated = true; indicator.AnimationDuration = 500; indicator.BarWidth = 0.2f; indicator.Location = 0.5f + i * 0.25f; indicator.FillColor = colors[i]; indicator.Cap = GaugeBarIndicatorCapMode.Round; scale.AddIndicator(indicator); } // << gauges-indicators-bars gauge.AddScale(scale); return(rootView); }
public override View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_gauge_animations, container, false); RadRadialGaugeView gauge = (RadRadialGaugeView)rootView.FindViewById(Resource.Id.radial_gauge); SetupGauge(gauge); RadioButton btn60 = (RadioButton)rootView.FindViewById(Resource.Id.radio_60); btn60.Click += (sender, e) => { needle.Value = 60; }; RadioButton btn80 = (RadioButton)rootView.FindViewById(Resource.Id.radio_80); btn80.Click += (sender, e) => { needle.Value = 80; }; RadioButton btn120 = (RadioButton)rootView.FindViewById(Resource.Id.radio_120); btn120.Click += (sender, e) => { needle.Value = 120; }; RadioButton btn160 = (RadioButton)rootView.FindViewById(Resource.Id.radio_160); btn160.Click += (sender, e) => { needle.Value = 160; }; return(rootView); }
public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_gauge_scales, container, false); RadRadialGaugeView gauge = (RadRadialGaugeView)rootView.FindViewById(Resource.Id.radial_gauge); // >> radial-scale-instantiate GaugeRadialScale scale1 = new GaugeRadialScale(Activity); scale1.LineVisible = true; scale1.Minimum = 34; scale1.Maximum = 40; // << radial-scale-instantiate // >> radial-scale-config scale1.Radius = 0.6f; scale1.StrokeWidth = 2; // << radial-scale-config // >> radial-scale-config-ticks-labels scale1.LabelsColor = Color.Gray; scale1.LabelsCount = 7; scale1.MajorTicksCount = 7; scale1.LabelsPaint.TextSize = 30; scale1.TicksOffset = 0; scale1.LabelsOffset = 0.1f; // << radial-scale-config-ticks-labels // >> radial-scale-config2 GaugeRadialScale scale2 = new GaugeRadialScale(Activity); scale2.LineVisible = true; scale2.StrokeWidth = 2; scale2.Radius = 0.7f; scale2.SetRange(93.2f, 104); scale2.TicksLayoutMode = GaugeScaleTicksLayoutMode.Outer; scale2.MajorTicksCount = 7; scale2.MinorTicksCount = 20; scale2.LabelsCount = 7; scale2.LabelsLayoutMode = GaugeScaleLabelsLayoutMode.Outer; scale2.LabelsPaint.TextSize = 30; scale2.LabelsColor = Color.Gray; scale2.TicksOffset = 0; scale2.LabelsOffset = 0.1f; // << radial-scale-config2 // >> add-scale-to-gauge gauge.AddScale(scale1); gauge.AddScale(scale2); // << add-scale-to-gauge // >> add-indicators-to-scale GaugeRadialNeedle needle = new GaugeRadialNeedle(Activity); needle.Value = 36.5f; needle.Length = 0.5f; needle.TopWidth = 8; needle.BottomWidth = 8; scale1.AddIndicator(needle); scale1.AddIndicator(GetIndicator(34, 36, Color.Blue)); scale1.AddIndicator(GetIndicator(36.05f, 40, Color.Red)); // << add-indicators-to-scale // >> gauge-set-title gauge.Title.Text = "celsius"; gauge.Subtitle.Text = "fahrenheit"; gauge.TitleVerticalOffset = 90; // << gauge-set-title return(rootView); }