public override View GetSampleContent(Context con) { SfCircularGauge sfCircularGauge = new SfCircularGauge(con); ObservableCollection <CircularScale> circularScales = new ObservableCollection <CircularScale>(); scale = new CircularScale(); scale.StartValue = 0; scale.EndValue = 240; scale.Interval = 20; scale.StartAngle = 135; scale.SweepAngle = 270; scale.RimColor = Color.ParseColor("#C62E0A"); scale.LabelColor = Color.ParseColor("#C62E0A"); scale.LabelOffset = 0.88; scale.ScaleStartOffset = 0.7; scale.ScaleEndOffset = 0.69; scale.MinorTicksPerInterval = 1; scale.MajorTickSettings.StartOffset = 0.7; scale.MajorTickSettings.EndOffset = 0.77; scale.MajorTickSettings.Width = 2; scale.MajorTickSettings.Color = Color.ParseColor("#C62E0A"); scale.MinorTickSettings.StartOffset = 0.7; scale.MinorTickSettings.EndOffset = 0.75; scale.MinorTickSettings.Width = 2; scale.MinorTickSettings.Color = Color.ParseColor("#C62E0A"); ObservableCollection <CircularPointer> pointers = new ObservableCollection <CircularPointer>(); MarkerPointer markerPointer = new MarkerPointer(); markerPointer.Value = 120; markerPointer.Color = Color.ParseColor("#C62E0A"); markerPointer.Offset = 0.69; markerPointer.MarkerShape = Com.Syncfusion.Gauges.SfCircularGauge.Enums.MarkerShape.InvertedTriangle; markerPointer.EnableAnimation = false; pointers.Add(markerPointer); scale.CircularPointers = pointers; circularScales.Add(scale); circularScale2 = new CircularScale(); circularScale2.StartAngle = 135; circularScale2.SweepAngle = 270; circularScale2.StartValue = 0; circularScale2.EndValue = 160; circularScale2.Interval = 40; circularScale2.MinorTicksPerInterval = 1; circularScale2.RimColor = Color.ParseColor("#333333"); circularScale2.LabelOffset = 0.45; circularScale2.LabelColor = Color.ParseColor("#333333"); circularScale2.ScaleStartOffset = 0.65; circularScale2.ScaleEndOffset = 0.64; circularScale2.MajorTickSettings.StartOffset = 0.64; circularScale2.MajorTickSettings.EndOffset = 0.57; circularScale2.MajorTickSettings.Width = 2; circularScale2.MajorTickSettings.Color = Color.ParseColor("#333333"); circularScale2.MinorTickSettings.StartOffset = 0.64; circularScale2.MinorTickSettings.EndOffset = 0.59; circularScale2.MinorTickSettings.Width = 2; circularScale2.MinorTickSettings.Color = Color.ParseColor("#333333"); ObservableCollection <CircularPointer> circularPointers = new ObservableCollection <CircularPointer>(); MarkerPointer markerPointer1 = new MarkerPointer(); markerPointer1.Value = 80; markerPointer1.Color = Color.ParseColor("#333333"); markerPointer1.Offset = 0.65; markerPointer1.MarkerShape = Com.Syncfusion.Gauges.SfCircularGauge.Enums.MarkerShape.Triangle; markerPointer1.EnableAnimation = false; circularPointers.Add(markerPointer1); circularScale2.CircularPointers = circularPointers; circularScales.Add(circularScale2); 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); }
public override View GetSampleContent (Context con) { circularGauge = new SfCircularGauge(con); ObservableCollection<CircularScale> _circularScales = new ObservableCollection<CircularScale>(); ObservableCollection<CircularPointer> _circularPointers = new ObservableCollection<CircularPointer>(); ObservableCollection<Header> _gaugeHeaders = new ObservableCollection<Header>(); // adding new CircularScale circularScale = new CircularScale(); circularScale.StartValue = 0; circularScale.EndValue = 100; circularScale.StartAngle = 130; circularScale.SweepAngle = 280; circularScale.RimWidth = 10; circularScale.RimColor = Color.ParseColor("#D14646"); circularScale.MinorTicksPerInterval = 0; circularScale.LabelOffset = labelsOffset; circularScale.LabelTextSize = 18; //adding major ticks majorTickstings = new TickSetting(); majorTickstings.Color = Color.ParseColor("#444444"); majorTickstings.Size = 15; majorTickstings.Offset = ticksOffset; circularScale.MajorTickSettings = majorTickstings; //adding minor ticks TickSetting minorTickstings = new TickSetting(); minorTickstings.Color = Color.Gray; circularScale.MinorTickSettings = minorTickstings; // adding needle Pointer needlePointer = new NeedlePointer(); needlePointer.Value = pointerValue; needlePointer.KnobColor = Color.ParseColor("#2BBFB8"); needlePointer.KnobRadius = 20; needlePointer.Type = NeedleType.Bar; needlePointer.LengthFactor = 0.8; needlePointer.Width = 3; needlePointer.Color = Color.Gray; _circularPointers.Add(needlePointer); // adding range Pointer rangePointer = new RangePointer(); rangePointer.Value = pointerValue; rangePointer.Color = Color.ParseColor("#2BBFB8"); rangePointer.Width = 10; _circularPointers.Add(rangePointer); circularScale.CircularPointers = _circularPointers; _circularScales.Add(circularScale); //adding header Header circularGaugeHeader = new Header(); circularGaugeHeader.Text = "Speedometer"; circularGaugeHeader.TextColor = Color.Gray; circularGaugeHeader.Position = new PointF((float)0.38, (float)0.7); circularGaugeHeader.TextSize = 20; _gaugeHeaders.Add(circularGaugeHeader); circularGauge.Headers = _gaugeHeaders; circularGauge.CircularScales = _circularScales; circularGauge.SetBackgroundColor(Color.White); LinearLayout linearLayout = new LinearLayout(con); linearLayout.AddView(circularGauge); linearLayout.SetPadding(30, 30, 30, 30); linearLayout.SetBackgroundColor(Color.White); return linearLayout; }
public override View GetSampleContent(Context con) { DisplayMetrics displayMetrics = con.Resources.DisplayMetrics; float screenHeight = displayMetrics.HeightPixels; SfCircularGauge sfCircularGauge = new SfCircularGauge(con); ObservableCollection <Header> headers = new ObservableCollection <Header>(); header = new Header(); header.Text = Math.Round((double)800, 2) + " GB"; header.TextSize = 24; header.TextColor = Color.Black; header.Position = new PointF((float)0.5, (float)0.1); headers.Add(header); sfCircularGauge.Headers = headers; ObservableCollection <CircularScale> circularScales = new ObservableCollection <CircularScale>(); CircularScale scale = new CircularScale(); scale.StartAngle = 210; scale.SweepAngle = 120; scale.StartValue = 0; scale.EndValue = 1000; scale.Interval = 500; scale.ShowLabels = false; scale.ShowTicks = false; scale.ShowRim = false; scale.MinorTicksPerInterval = 0; ObservableCollection <CircularRange> ranges = new ObservableCollection <CircularRange>(); circularRange = new CircularRange(); circularRange.StartValue = 0; circularRange.EndValue = 1000; circularRange.Color = Color.ParseColor("#E0E0E0"); circularRange.Offset = 0.7; circularRange.Width = 30; ranges.Add(circularRange); scale.CircularRanges = ranges; ObservableCollection <CircularPointer> pointers = new ObservableCollection <CircularPointer>(); rangePointer = new RangePointer(); rangePointer.Value = 800; rangePointer.Color = Color.ParseColor("#FFDD00"); rangePointer.Width = 30; rangePointer.Offset = 0.7; rangePointer.EnableAnimation = false; pointers.Add(rangePointer); needlePointer = new NeedlePointer(); needlePointer.Value = 800; needlePointer.Color = Color.ParseColor("#424242"); needlePointer.Type = Com.Syncfusion.Gauges.SfCircularGauge.Enums.NeedleType.Triangle; needlePointer.LengthFactor = 0.7; needlePointer.Width = 10; needlePointer.KnobRadiusFactor = 0.1; needlePointer.KnobColor = Color.ParseColor("#424242"); pointers.Add(needlePointer); scale.CircularPointers = pointers; circularScales.Add(scale); sfCircularGauge.CircularScales = circularScales; sfCircularGauge.SetBackgroundColor(Color.White); SfCircularGauge circularGauge = new SfCircularGauge(con); ObservableCollection <Header> headers1 = new ObservableCollection <Header>(); header1 = new Header(); header1.Text = Math.Round((double)800, 2) + " GB"; header1.TextSize = 24; header1.TextColor = Color.Black; header1.Position = new PointF((float)0.5, (float)0.5); headers1.Add(header1); Header header2 = new Header(); header2.Text = "Used"; header2.TextSize = 18; header2.TextColor = Color.Gray; header2.Position = new PointF((float)0.5, (float)0.6); headers1.Add(header2); circularGauge.Headers = headers1; ObservableCollection <CircularScale> circularScales1 = new ObservableCollection <CircularScale>(); CircularScale scale1 = new CircularScale(); scale1.StartAngle = 90; scale1.SweepAngle = 360; scale1.StartValue = 0; scale1.EndValue = 1000; scale1.Interval = 500; scale1.ShowLabels = false; scale1.ShowTicks = false; scale1.ShowRim = false; scale1.MinorTicksPerInterval = 0; ObservableCollection <CircularRange> ranges1 = new ObservableCollection <CircularRange>(); circularRange1 = new CircularRange(); circularRange1.StartValue = 0; circularRange1.EndValue = 999.9; circularRange1.Color = Color.ParseColor("#E0E0E0"); circularRange1.Offset = 0.8; circularRange1.Width = 30; ranges1.Add(circularRange1); scale1.CircularRanges = ranges1; ObservableCollection <CircularPointer> pointers1 = new ObservableCollection <CircularPointer>(); rangePointer1 = new RangePointer(); rangePointer1.Value = 800; rangePointer1.Color = Color.ParseColor("#FFDD00"); rangePointer1.Width = 30; rangePointer1.Offset = 0.8; rangePointer1.EnableAnimation = false; pointers1.Add(rangePointer1); scale1.CircularPointers = pointers1; circularScales1.Add(scale1); circularGauge.CircularScales = circularScales1; circularGauge.SetBackgroundColor(Color.White); LinearLayout outerLinearLayout = (LinearLayout)sfCircularGauge.FindViewById(Resource.Id.linearLayout); LinearLayout linearLayout = new LinearLayout(con); linearLayout.Orientation = Orientation.Vertical; linearLayout.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); linearLayout.AddView(sfCircularGauge, LayoutParams.WrapContent, (int)(screenHeight / 2.7)); linearLayout.AddView(circularGauge, LayoutParams.WrapContent, (int)(screenHeight / 2.7)); linearLayout.SetBackgroundColor(Color.White); linearLayout.SetPadding(30, 30, 30, 30); ScrollView mainView = new ScrollView(con); mainView.AddView(linearLayout); return(mainView); }
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); }
public override View GetSampleContent(Context con) { circularGauge = new SfCircularGauge(con); ObservableCollection <CircularScale> _circularScales = new ObservableCollection <CircularScale>(); ObservableCollection <CircularPointer> _circularPointers = new ObservableCollection <CircularPointer>(); ObservableCollection <Header> _gaugeHeaders = new ObservableCollection <Header>(); // adding new CircularScale circularScale = new CircularScale(); circularScale.StartValue = 0; circularScale.EndValue = 100; circularScale.StartAngle = 130; circularScale.SweepAngle = 280; circularScale.RimWidth = 10; circularScale.RimColor = Color.ParseColor("#D14646"); circularScale.MinorTicksPerInterval = 0; circularScale.LabelOffset = labelsOffset; circularScale.LabelTextSize = 18; //adding major ticks majorTickstings = new TickSetting(); majorTickstings.Color = Color.ParseColor("#444444"); majorTickstings.Size = 15; majorTickstings.Offset = ticksOffset; circularScale.MajorTickSettings = majorTickstings; //adding minor ticks TickSetting minorTickstings = new TickSetting(); minorTickstings.Color = Color.Gray; circularScale.MinorTickSettings = minorTickstings; // adding needle Pointer needlePointer = new NeedlePointer(); needlePointer.Value = pointerValue; needlePointer.KnobColor = Color.ParseColor("#2BBFB8"); needlePointer.KnobRadius = 20; needlePointer.Type = NeedleType.Bar; needlePointer.LengthFactor = 0.8; needlePointer.Width = 3; needlePointer.Color = Color.Gray; _circularPointers.Add(needlePointer); // adding range Pointer rangePointer = new RangePointer(); rangePointer.Value = pointerValue; rangePointer.Color = Color.ParseColor("#2BBFB8"); rangePointer.Width = 10; _circularPointers.Add(rangePointer); circularScale.CircularPointers = _circularPointers; _circularScales.Add(circularScale); //adding header Header circularGaugeHeader = new Header(); circularGaugeHeader.Text = "Speedometer"; circularGaugeHeader.TextColor = Color.Gray; circularGaugeHeader.Position = new PointF((float)0.38, (float)0.7); circularGaugeHeader.TextSize = 20; _gaugeHeaders.Add(circularGaugeHeader); circularGauge.Headers = _gaugeHeaders; circularGauge.CircularScales = _circularScales; circularGauge.SetBackgroundColor(Color.White); LinearLayout linearLayout = new LinearLayout(con); linearLayout.AddView(circularGauge); linearLayout.SetPadding(30, 30, 30, 30); linearLayout.SetBackgroundColor(Color.White); return(linearLayout); }
public override View GetSampleContent(Context con) { SfCircularGauge sfCircularGauge = new SfCircularGauge(con); ObservableCollection <CircularScale> circularScales = new ObservableCollection <CircularScale>(); CircularScale scale = new CircularScale(); scale.StartAngle = 270; scale.StartValue = 0; scale.EndValue = 16; scale.Interval = 2; scale.LabelOffset = 0.75; scale.SweepAngle = 360; scale.MinorTicksPerInterval = 1; scale.ShowLastLabel = false; scale.ScaleStartOffset = 0.99; scale.ScaleEndOffset = 0.9; scale.LabelCreated += Scale_LabelCreated; scale.RimColor = Color.ParseColor("#E0E0E0"); scale.LabelColor = Color.ParseColor("#4B4B4B"); scale.MajorTickSettings.StartOffset = 0.9; scale.MajorTickSettings.EndOffset = 0.83; scale.MajorTickSettings.Width = 2; scale.MajorTickSettings.Color = Color.ParseColor("#9E9E9E"); scale.MinorTickSettings.StartOffset = 0.9; scale.MinorTickSettings.EndOffset = 0.85; scale.MinorTickSettings.Width = 2; scale.MinorTickSettings.Color = Color.ParseColor("#9E9E9E"); ObservableCollection <CircularPointer> pointers = new ObservableCollection <CircularPointer>(); pointer = new NeedlePointer(); pointer.Value = 14; pointer.Color = Color.ParseColor("#f03e3e"); pointer.Type = Com.Syncfusion.Gauges.SfCircularGauge.Enums.NeedleType.Triangle; pointer.LengthFactor = 0.65; pointer.Width = 20; pointer.KnobRadiusFactor = 0; pointer.KnobColor = Color.White; pointer.KnobStrokeWidth = 3; pointer.KnobStrokeColor = Color.White; pointer.EnableAnimation = false; pointers.Add(pointer); NeedlePointer needlePointer = new NeedlePointer(); needlePointer.Value = 6; needlePointer.Type = Com.Syncfusion.Gauges.SfCircularGauge.Enums.NeedleType.Triangle; needlePointer.LengthFactor = 0.65; needlePointer.Width = 20; needlePointer.Color = Color.ParseColor("#9E9E9E"); needlePointer.KnobRadiusFactor = 0.11; needlePointer.KnobColor = Color.White; needlePointer.KnobStrokeWidth = 3; needlePointer.KnobStrokeColor = Color.White; needlePointer.EnableAnimation = false; pointers.Add(needlePointer); 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); }
/// <summary> /// Initializes the log. /// </summary> public void InitializeLog() { m_scale = new CircularScale(); m_scale.ShadowOffset = 1; m_scale.Minimum = 0; m_scale.Maximum = 100; m_scale.MinorIntervalValue = 5; m_scale.MajorIntervalValue = 20; m_scale.StartAngle = 120; m_scale.GapSweepAngle = 300; m_scale.ScaleBarSize = 7; m_scale.Radius = 60; m_scale.BorderWidth = 1.0; m_scale1 = new CircularScale(); m_scale1.ShadowOffset = 1; m_scale1.Minimum = 0; m_scale1.Maximum = 100; m_scale1.MinorIntervalValue = 5; m_scale1.MajorIntervalValue = 10; m_scale1.StartAngle = 120; m_scale1.GapSweepAngle = 300; m_scale1.ScaleBarSize = 0.5; m_scale1.Radius = 40; m_scale1.BorderWidth = 1.2; this.circularGauge1.Scales.Add(m_scale); this.circularGauge1.Scales.Add(m_scale1); CircularLabelTick majorLabelTick = new CircularLabelTick(); majorLabelTick.FontSize = 13; majorLabelTick.TickStyle = TickStyle.MajorTick; majorLabelTick.TickPlacement = ScalePlacement.Inside; majorLabelTick.DistanceFromScale = 5; CircularMarkTick majorTick = new CircularMarkTick(); majorTick.TickWidth = 5; majorTick.TickHeight = 10; majorTick.TickStyle = TickStyle.MajorTick; majorTick.TickShape = TickShape.RoundedRectangle; CircularMarkTick minorTick = new CircularMarkTick(); minorTick.TickWidth = 1; minorTick.TickHeight = 4; minorTick.TickStyle = TickStyle.MinorTick; CircularLabelTick majorLabelTick1 = new CircularLabelTick(); majorLabelTick1.FontSize = 11; majorLabelTick1.TickStyle = TickStyle.MajorTick; majorLabelTick1.TickPlacement = ScalePlacement.Inside; majorLabelTick1.DistanceFromScale = 5; CircularMarkTick majorTick1 = new CircularMarkTick(); majorTick1.TickWidth = 4; majorTick1.TickHeight = 9; majorTick1.TickStyle = TickStyle.MajorTick; majorTick1.TickShape = TickShape.Ellipse; CircularMarkTick minorTick1 = new CircularMarkTick(); minorTick1.TickWidth = 1; minorTick1.TickHeight = 4; minorTick1.TickStyle = TickStyle.MinorTick; m_scale.Ticks.Add(minorTick); m_scale.Ticks.Add(majorTick); m_scale.Ticks.Add(majorLabelTick); m_scale1.Ticks.Add(minorTick1); m_scale1.Ticks.Add(majorTick1); m_scale1.Ticks.Add(majorLabelTick1); m_scale.PointerCap.PointerCapRadius = 7; m_scale1.PointerCap.PointerCapRadius = 7; CircularPointer pointer1 = new CircularPointer(); pointer1.BorderWidth = 0.3; pointer1.PointerLength = 40; pointer1.PointerWidth = 10; pointer1.PointerPlacement = ScalePlacement.Outside; CircularPointer pointer3 = new CircularPointer(); pointer3.BorderWidth = 0.3; pointer3.PointerLength = 70; pointer3.PointerWidth = 10; pointer3.Value = 50; pointer3.PointerPlacement = ScalePlacement.Outside; m_scale.Pointers.Add(pointer1); m_scale1.Pointers.Add(pointer3); // Subscribe GapSweepAngle property changed event m_scale.GapSweepAngleChanged += new PropertyChangedCallback(m_scale_GapSweepAngleChanged); // Subscribe GapSweepAngle property changed event m_scale1.GapSweepAngleChanged += new PropertyChangedCallback(m_scale1_GapSweepAngleChanged); // Subscribe Location property changed event m_scale.LocationChanged += new PropertyChangedCallback(m_scale_LocationChanged); // Subscribe Location property changed event m_scale1.LocationChanged += new PropertyChangedCallback(m_scale1_LocationChanged); // Subscribe Maximum property changed event m_scale.MaximumChanged += new PropertyChangedCallback(m_scale_MaximumChanged); // Subscribe Maximum property changed event m_scale1.MaximumChanged += new PropertyChangedCallback(m_scale1_MaximumChanged); // Subscribe Minimum property changed event m_scale1.MinimumChanged += new PropertyChangedCallback(m_scale1_MinimumChanged); // Subscribe Minimum property changed event m_scale.MinimumChanged += new PropertyChangedCallback(m_scale_MinimumChanged); // Subscribe MajorIntervalValue property changed event m_scale.MajorIntervalValueChanged += new PropertyChangedCallback(m_scale_MajorIntervalValueChanged); // Subscribe MinorIntervalValue property changed event m_scale.MinorIntervalValueChanged += new PropertyChangedCallback(m_scale1_MinorIntervalValueChanged); // Subscribe StartAngle property changed event m_scale.StartAngleChanged += new PropertyChangedCallback(m_scale_StartAngleChanged); // Subscribe StartAngle property changed event m_scale1.StartAngleChanged += new PropertyChangedCallback(m_scale1_StartAngleChanged); // Subscribe Radius property changed event m_scale.RadiusChanged += new PropertyChangedCallback(m_scale_RadiusChanged); // Subscribe Radius property changed event m_scale1.RadiusChanged += new PropertyChangedCallback(m_scale1_RadiusChanged); // Subscribe BorderWidth property changed event //m_scale.BorderWidthChanged += new PropertyChangedCallback(m_scale_BorderWidthChanged); // Subscribe BorderWidth property changed event //m_scale1.BorderWidthChanged += new PropertyChangedCallback(m_scale1_BorderWidthChanged); // Subscribe ScaleBarSize property changed event m_scale.ScaleBarSizeChanged += new PropertyChangedCallback(m_scale_ScaleBarSizeChanged); // Subscribe ScaleBarSize property changed event m_scale1.ScaleBarSizeChanged += new PropertyChangedCallback(m_scale1_ScaleBarSizeChanged); // Subscribe Value property changed event (m_scale.Pointers[0] as CircularPointer).ValueChanged += new PropertyChangedCallback(Changed); ScaleRadiusSlider.Value = 90; ScaleRadiusSlider1.Value = 60; }
public void SetGuageLayout2(GaugeContainer iGauge, GAUGE_COLOR_TYPE iColorType, double iRate) { Font fntDefault = new Font("", 12f, FontStyle.Regular, GraphicsUnit.Pixel); // Gauge 기본설정 iGauge.Height = Unit.Pixel(130); iGauge.Width = Unit.Pixel(200); iGauge.AutoLayout = true; iGauge.BackFrame.BorderColor = Color.FromArgb(212, 208, 200); iGauge.BackFrame.BorderWidth = 0; iGauge.BackFrame.FrameWidth = 0f; iGauge.BackFrame.FrameStyle = BackFrameStyle.None; iGauge.BackFrame.FrameShape = BackFrameShape.AutoShape; iGauge.BackFrame.ShadowOffset = 0f; iGauge.BackFrame.BorderStyle = GaugeDashStyle.NotSet; //iGauge.MapAreas.Clear(); //iGauge.StateIndicators.Clear(); // 원형게이지 설정 iGauge.CircularGauges.Clear(); iGauge.CircularGauges.Add("Default"); CircularGauge cclg = iGauge.CircularGauges[0]; cclg.Size.Width = 100f; cclg.Size.Height = 96f; cclg.PivotPoint.X = 50f; cclg.PivotPoint.Y = 87f; cclg.BackFrame.BackGradientType = Dundas.Gauges.WebControl.GradientType.None; cclg.BackFrame.BorderColor = Color.Transparent; cclg.BackFrame.BorderWidth = 0; cclg.BackFrame.FrameGradientType = Dundas.Gauges.WebControl.GradientType.None; cclg.BackFrame.FrameStyle = BackFrameStyle.None; cclg.BackFrame.FrameShape = BackFrameShape.AutoShape; cclg.BackFrame.FrameWidth = 0f; cclg.Location.X = 0f; cclg.Location.Y = 0f; cclg.Knobs.Clear(); cclg.Ranges.Clear(); // 게이지 제목 설정 iGauge.Labels.Clear(); iGauge.Labels.Add("Default"); GaugeLabel gglt = iGauge.Labels[0]; gglt.BackColor = Color.Transparent; gglt.BackGradientType = Dundas.Gauges.WebControl.GradientType.None; //gglt.Parent = cclg.Name; gglt.Text = "달성율(%)"; gglt.TextAlignment = ContentAlignment.MiddleCenter; gglt.Size.Height = 11f; gglt.Size.Width = 30f; gglt.Location.X = 36f; gglt.Location.Y = 46f; gglt.Font = fntDefault; // 게이지 눈금 설정 cclg.Scales.Clear(); cclg.Scales.Add("Default"); CircularScale ccls = cclg.Scales[0]; ccls.BorderColor = Color.Gray; ccls.FillColor = ColorTranslator.FromHtml("#5A78AF"); // #ADC9DC ccls.Radius = 73f; ccls.ShadowOffset = 0f; ccls.StartAngle = 80f; ccls.SweepAngle = 200f; ccls.Width = 25f; ccls.FillGradientType = Dundas.Gauges.WebControl.GradientType.None; ccls.FillHatchStyle = GaugeHatchStyle.None; ccls.LabelStyle.DistanceFromScale = 5f; ccls.LabelStyle.Placement = Placement.Inside; ccls.LabelStyle.TextColor = Color.Black; ccls.LabelStyle.Font = fntDefault; ccls.MajorTickMark.BorderColor = ColorTranslator.FromHtml("#E0E8F3"); ccls.MajorTickMark.BorderWidth = 0; ccls.MajorTickMark.DistanceFromScale = 1f; ccls.MajorTickMark.FillColor = ColorTranslator.FromHtml("#E0E8F3"); ccls.MajorTickMark.Length = ccls.Width; ccls.MajorTickMark.Placement = Placement.Cross; ccls.MajorTickMark.Shape = Dundas.Gauges.WebControl.MarkerStyle.None; ccls.MajorTickMark.Width = 5f; ccls.MajorTickMark.EnableGradient = false; ccls.MinorTickMark.Visible = false; ccls.MinorTickMark.BorderColor = ccls.MajorTickMark.BorderColor; ccls.MinorTickMark.BorderWidth = 1; ccls.MinorTickMark.DistanceFromScale = 1f; ccls.MinorTickMark.FillColor = ccls.MajorTickMark.FillColor; ccls.MinorTickMark.Length = 7f; ccls.MinorTickMark.Placement = Placement.Outside; ccls.MinorTickMark.Shape = Dundas.Gauges.WebControl.MarkerStyle.Wedge; ccls.MinorTickMark.Width = 2f; ccls.MinorTickMark.EnableGradient = false; // 게이지 바늘 설정 cclg.Pointers.Clear(); cclg.Pointers.Add("Default"); CircularPointer cclp = cclg.Pointers[0]; cclp.BorderWidth = 0; cclp.FillGradientEndColor = Color.MediumTurquoise; cclp.DistanceFromScale = 1f; cclp.FillColor = Color.Red; cclp.FillGradientEndColor = Color.Pink; cclp.FillGradientType = Dundas.Gauges.WebControl.GradientType.LeftRight; cclp.NeedleStyle = NeedleStyle.NeedleStyle4; cclp.Placement = Placement.Cross; cclp.Width = 2f; cclp.ShadowOffset = 3f; cclp.CapFillColor = ColorTranslator.FromHtml("#DFE8ED"); cclp.CapFillGradientEndColor = ColorTranslator.FromHtml("#508EBF"); cclp.CapFillGradientType = Dundas.Gauges.WebControl.GradientType.DiagonalLeft; cclp.CapReflection = true; cclp.CapWidth = 50f; double dMax = iRate; if (100 < iRate) { dMax = (iRate - (iRate % 20)) + 20; //dMax = Math.Round(iRate,0); } else { dMax = 100; } cclp.Value = iRate; ccls.Maximum = dMax; ccls.Minimum = 0; ccls.Interval = Math.Round(dMax / 10); gglt.Text = Math.Round(iRate, 0).ToString() + "%"; }
/// <summary> /// 주요지표 스키마 추가 및 데이터 바인딩 /// YMD | E | G | W | A | 매출액 | 공급량 | ... /// </summary> /// <returns></returns> //public DataTable GetGradeSchema(DataTable iDt) //{ // DateTime startYM = (DateTime.ParseExact(this.IYmd, "yyyyMM", null)).AddYears(-1); // DataTable dtGrade = iDt; // Biz_Bsc_Kpi_Dashboard objTC = new Biz_Bsc_Kpi_Dashboard(); // DataSet dsGrade = objTC.GetDashBoardKpiList(this.IEstTermRefID); // DataRow drGrade = null; // iRow = dsGrade.Tables[0].Rows.Count; // for (int i = 0; i < iRow; i++) // { // DataColumn dc = dtGrade.Columns.Add(dsGrade.Tables[0].Rows[i]["KPI_REF_ID"].ToString(), typeof(decimal)); // dc.Caption = dsGrade.Tables[0].Rows[i]["NAME_KNAME"].ToString(); // } // DataSet actDs = new DataSet(); // string sKpiNm = ""; // string sUnitNm = ""; // decimal dTarget = 0; // decimal dResult = 0; // double dAVRate = 0; // string sColT = (this.ISumType == "MS") ? "TARGET_MS" : "TARGET_TS"; // string sColR = (this.ISumType == "MS") ? "RESULT_MS" : "RESULT_TS"; // string sColA = (this.ISumType == "MS") ? "ACHV_RATE_MS" : "ACHV_RATE_TS"; // if (dsGrade.Tables.Count > 0) // { // iRow = dsGrade.Tables[0].Rows.Count; // for (int i = 0; i < iRow; i++) // { // this.IKpiRefID = int.Parse(dsGrade.Tables[0].Rows[i]["KPI_REF_ID"].ToString()); // actDs = objTC.GetDashBoardForKpiAnalysis( this.IEstTermRefID, this.IKpiRefID // , base.GetYMDFromDateTime(startYM, "").Substring(0, 6) // , this.IYmd, this.ISumType); // if (actDs.Tables.Count > 0) // { // if (actDs.Tables[0].Rows.Count > 0) // { // string sYmd = ""; // for (int k = 0; k < dtGrade.Rows.Count; k++) // { // if (sYmd.Equals(dtGrade.Rows[k][COL_KEY.KEY_FIELD.ToString()].ToString()) && dtGrade.Columns.Contains(sKey)) // { // dtGrade.Rows[k][sKey] = dVal; // } // } // dTarget = decimal.Parse(actDs.Tables[0].Rows[0][sColT].ToString()); // dResult = decimal.Parse(actDs.Tables[0].Rows[0][sColR].ToString()); // dAVRate = double.Parse(actDs.Tables[0].Rows[0][sColA].ToString()); // } // } // } // } // return dtGrade; //} #endregion #region [지표현황 - 게이지 설정] public void SetGuageLayout(GaugeContainer iGauge, GAUGE_COLOR_TYPE iColorType) { iGauge.Height = Unit.Pixel(130); iGauge.Width = Unit.Pixel(240); iGauge.AutoLayout = false; iGauge.BackFrame.BorderColor = Color.FromArgb(212, 208, 200); iGauge.BackFrame.BorderWidth = 0; iGauge.BackFrame.FrameWidth = 0f; iGauge.BackFrame.FrameStyle = BackFrameStyle.None; iGauge.BackFrame.FrameShape = BackFrameShape.AutoShape; iGauge.BackFrame.ShadowOffset = 0f; iGauge.BackFrame.BorderStyle = GaugeDashStyle.NotSet; iGauge.CircularGauges.Clear(); iGauge.CircularGauges.Add("Default"); CircularGauge cclg = iGauge.CircularGauges[0]; cclg.Size.Width = 100f; cclg.Size.Height = 96f; cclg.PivotPoint.X = 50f; cclg.PivotPoint.Y = 87f; cclg.BackFrame.BackColor = arrColor[(int)iColorType, 0]; cclg.BackFrame.BackGradientEndColor = arrColor[(int)iColorType, 1]; cclg.BackFrame.BackGradientType = Dundas.Gauges.WebControl.GradientType.TopBottom; cclg.BackFrame.BorderColor = Color.DarkGray; cclg.BackFrame.BorderWidth = 2; cclg.BackFrame.FrameGradientType = Dundas.Gauges.WebControl.GradientType.None; cclg.BackFrame.FrameStyle = BackFrameStyle.Edged; cclg.BackFrame.FrameShape = BackFrameShape.AutoShape; cclg.BackFrame.FrameWidth = 0f; cclg.Location.X = 0f; cclg.Location.Y = 0f; cclg.Ranges.Clear(); //cclg.Ranges.Add("Alert"); //CircularRange cclr = cclg.Ranges[0]; //cclr.StartValue = 0; //cclr.EndValue = 50; //cclr.StartWidth = 200f; //cclr.EndWidth = 200f; iGauge.Labels.Clear(); iGauge.Labels.Add("Default"); GaugeLabel gglt = iGauge.Labels[0]; gglt.BackColor = Color.Transparent; gglt.BackGradientType = Dundas.Gauges.WebControl.GradientType.None; //gglt.Parent = cclg.Name; gglt.Text = "단위"; gglt.TextAlignment = ContentAlignment.MiddleCenter; gglt.Size.Height = 11f; gglt.Size.Width = 30f; gglt.Location.X = 36f; gglt.Location.Y = 46f; cclg.Scales.Clear(); cclg.Scales.Add("Default"); CircularScale ccls = cclg.Scales[0]; ccls.BorderColor = Color.Gray; ccls.FillColor = Color.Black; ccls.Radius = 58f; ccls.ShadowOffset = 0f; ccls.StartAngle = 90f; ccls.SweepAngle = 180f; ccls.Width = 1f; ccls.LabelStyle.DistanceFromScale = 5f; ccls.LabelStyle.Placement = Placement.Outside; ccls.LabelStyle.TextColor = Color.Black; ccls.MajorTickMark.BorderColor = Color.Black; ccls.MajorTickMark.BorderWidth = 1; ccls.MajorTickMark.DistanceFromScale = 1f; ccls.MajorTickMark.FillColor = Color.Black; ccls.MajorTickMark.Length = 10f; ccls.MajorTickMark.Placement = Placement.Outside; ccls.MajorTickMark.Shape = Dundas.Gauges.WebControl.MarkerStyle.Wedge; ccls.MajorTickMark.Width = 2f; ccls.MinorTickMark.BorderColor = ccls.MajorTickMark.BorderColor; ccls.MinorTickMark.BorderWidth = 1; ccls.MinorTickMark.DistanceFromScale = 1f; ccls.MinorTickMark.FillColor = ccls.MajorTickMark.FillColor; ccls.MinorTickMark.Length = 7f; ccls.MinorTickMark.Placement = Placement.Outside; ccls.MinorTickMark.Shape = Dundas.Gauges.WebControl.MarkerStyle.Wedge; ccls.MinorTickMark.Width = 2f; ccls.MinorTickMark.EnableGradient = false; cclg.Pointers.Clear(); CircularPointer cclp = cclg.Pointers[0]; cclp.BorderWidth = 0; cclp.CapFillColor = Color.Silver; cclp.FillGradientEndColor = Color.MediumTurquoise; cclp.CapReflection = true; cclp.CapWidth = 20f; cclp.DistanceFromScale = 1f; cclp.FillColor = Color.Red; cclp.FillGradientEndColor = Color.Pink; cclp.FillGradientType = Dundas.Gauges.WebControl.GradientType.LeftRight; cclp.NeedleStyle = NeedleStyle.NeedleStyle4; cclp.Placement = Placement.Outside; cclp.Width = 13f; cclp.SnappingEnabled = true; cclp.SnappingInterval = 1; cclp.Value = 50; ccls.Maximum = 100; ccls.Minimum = 0; }
public override View GetSampleContent(Context con) { SfCircularGauge sfCircularGauge = new SfCircularGauge(con); ObservableCollection <Header> headers = new ObservableCollection <Header>(); Header header = new Header(); header.Text = "Inverted Traingle"; header.TextSize = 18; header.TextColor = Color.Black; header.Position = new PointF((float)0.5, (float)0.6); headers.Add(header); sfCircularGauge.Headers = headers; ObservableCollection <CircularScale> circularScales = new ObservableCollection <CircularScale>(); CircularScale scale = new CircularScale(); scale.StartAngle = 180; scale.SweepAngle = 180; scale.ScaleStartOffset = 0.7; scale.ScaleEndOffset = 0.68; scale.StartValue = 0; scale.EndValue = 100; scale.RimColor = Color.Gray; scale.Interval = 50; scale.ShowLabels = false; scale.ShowTicks = false; scale.MinorTicksPerInterval = 0; ObservableCollection <CircularPointer> pointers = new ObservableCollection <CircularPointer>(); MarkerPointer markerPointer = new MarkerPointer(); markerPointer.Value = 80; markerPointer.Color = Color.ParseColor("#00bdae"); markerPointer.Offset = 0.7; markerPointer.MarkerShape = Com.Syncfusion.Gauges.SfCircularGauge.Enums.MarkerShape.InvertedTriangle; pointers.Add(markerPointer); scale.CircularPointers = pointers; circularScales.Add(scale); sfCircularGauge.CircularScales = circularScales; sfCircularGauge.SetBackgroundColor(Color.White); //triangle SfCircularGauge sfCircularGauge1 = new SfCircularGauge(con); ObservableCollection <Header> headers1 = new ObservableCollection <Header>(); Header header1 = new Header(); header1.Text = "Traingle"; header1.TextSize = 18; header1.TextColor = Color.Black; header1.Position = new PointF((float)0.5, (float)0.6); headers1.Add(header1); sfCircularGauge1.Headers = headers1; ObservableCollection <CircularScale> circularScales1 = new ObservableCollection <CircularScale>(); CircularScale scale1 = new CircularScale(); scale1.StartAngle = 180; scale1.SweepAngle = 180; scale1.ScaleStartOffset = 0.7; scale1.ScaleEndOffset = 0.68; scale1.StartValue = 0; scale1.EndValue = 100; scale1.RimColor = Color.Gray; scale1.Interval = 50; scale1.ShowLabels = false; scale1.ShowTicks = false; scale1.MinorTicksPerInterval = 0; ObservableCollection <CircularPointer> pointers1 = new ObservableCollection <CircularPointer>(); MarkerPointer markerPointer1 = new MarkerPointer(); markerPointer1.Value = 80; markerPointer1.Color = Color.Green; markerPointer1.Offset = 0.68; markerPointer1.MarkerShape = Com.Syncfusion.Gauges.SfCircularGauge.Enums.MarkerShape.Triangle; pointers1.Add(markerPointer1); scale1.CircularPointers = pointers1; circularScales1.Add(scale1); sfCircularGauge1.CircularScales = circularScales1; sfCircularGauge1.SetBackgroundColor(Color.White); //range pointer SfCircularGauge sfCircularGauge2 = new SfCircularGauge(con); ObservableCollection <Header> headers2 = new ObservableCollection <Header>(); Header header2 = new Header(); header2.Text = "Range Pointer"; header2.TextSize = 18; header2.TextColor = Color.Black; header2.Position = new PointF((float)0.5, (float)0.6); headers2.Add(header2); sfCircularGauge2.Headers = headers2; ObservableCollection <CircularScale> circularScales2 = new ObservableCollection <CircularScale>(); CircularScale scale2 = new CircularScale(); scale2.StartAngle = 180; scale2.SweepAngle = 180; scale2.StartValue = 0; scale2.EndValue = 100; scale2.RadiusFactor = 0.7; scale2.RimColor = Color.Gray; scale2.Interval = 50; scale2.ShowLabels = false; scale2.ShowTicks = false; scale2.RimWidth = 3; scale2.MinorTicksPerInterval = 0; ObservableCollection <CircularPointer> pointers2 = new ObservableCollection <CircularPointer>(); RangePointer rangePointer = new RangePointer(); rangePointer.Value = 60; rangePointer.Color = Color.ParseColor("#FF2680"); rangePointer.Offset = 0.6; rangePointer.Width = 20; rangePointer.EnableAnimation = false; pointers2.Add(rangePointer); scale2.CircularPointers = pointers2; circularScales2.Add(scale2); sfCircularGauge2.CircularScales = circularScales2; sfCircularGauge2.SetBackgroundColor(Color.White); //needlepointer SfCircularGauge sfCircularGauge3 = new SfCircularGauge(con); ObservableCollection <Header> headers3 = new ObservableCollection <Header>(); Header header3 = new Header(); header3.Text = "Needle Pointer"; header3.TextSize = 18; header3.TextColor = Color.Black; header3.Position = new PointF((float)0.5, (float)0.6); headers3.Add(header3); sfCircularGauge3.Headers = headers3; ObservableCollection <CircularScale> circularScales3 = new ObservableCollection <CircularScale>(); CircularScale scale3 = new CircularScale(); scale3.StartAngle = 180; scale3.SweepAngle = 180; scale3.StartValue = 0; scale3.EndValue = 100; scale3.RadiusFactor = 0.7; scale3.RimColor = Color.Gray; scale3.Interval = 50; scale3.ShowLabels = false; scale3.ShowTicks = false; scale3.RimWidth = 3; scale3.MinorTicksPerInterval = 0; ObservableCollection <CircularPointer> pointers3 = new ObservableCollection <CircularPointer>(); NeedlePointer needlePointer = new NeedlePointer(); needlePointer.Value = 80; needlePointer.Color = Color.Purple; needlePointer.LengthFactor = 0.7; needlePointer.KnobRadius = 0; needlePointer.Width = 10; needlePointer.Type = NeedleType.Triangle; pointers3.Add(needlePointer); scale3.CircularPointers = pointers3; circularScales3.Add(scale3); sfCircularGauge3.CircularScales = circularScales3; sfCircularGauge3.SetBackgroundColor(Color.White); SfCircularGauge sfCircularGauge4 = new SfCircularGauge(con); ObservableCollection <Header> headers4 = new ObservableCollection <Header>(); Header header4 = new Header(); header4.Text = "Multiple Needle"; header4.TextSize = 18; header4.TextColor = Color.Black; header4.Position = new PointF((float)0.5, (float)0.7); headers4.Add(header4); sfCircularGauge4.Headers = headers4; ObservableCollection <CircularScale> circularScales4 = new ObservableCollection <CircularScale>(); CircularScale scale4 = new CircularScale(); scale4.StartAngle = 180; scale4.SweepAngle = 180; scale4.StartValue = 0; scale4.EndValue = 100; scale4.RadiusFactor = 0.7; scale4.RimColor = Color.Gray; scale4.Interval = 50; scale4.ShowLabels = false; scale4.ShowTicks = false; scale4.RimWidth = 3; scale4.MinorTicksPerInterval = 0; ObservableCollection <CircularPointer> pointers4 = new ObservableCollection <CircularPointer>(); NeedlePointer needlePointer1 = new NeedlePointer(); needlePointer1.Value = 40; needlePointer1.Color = Color.ParseColor("#ed7d31"); needlePointer1.LengthFactor = 0.5; needlePointer1.KnobRadiusFactor = 0.05; needlePointer1.KnobColor = Color.White; needlePointer1.Width = 10; needlePointer1.Type = NeedleType.Triangle; needlePointer1.TailStrokeColor = Color.ParseColor("#ed7d31"); needlePointer1.KnobStrokeWidth = 2; needlePointer1.KnobStrokeColor = Color.ParseColor("#ed7d31"); pointers4.Add(needlePointer1); NeedlePointer needlePointer2 = new NeedlePointer(); needlePointer2.Value = 70; needlePointer2.Color = Color.ParseColor("#ed7d31"); needlePointer2.LengthFactor = 0.6; needlePointer2.KnobRadiusFactor = 0.05; needlePointer2.KnobColor = Color.White; needlePointer2.Width = 10; needlePointer2.Type = NeedleType.Triangle; needlePointer2.TailStrokeColor = Color.ParseColor("#ed7d31"); needlePointer2.KnobStrokeWidth = 2; needlePointer2.KnobStrokeColor = Color.ParseColor("#ed7d31"); pointers4.Add(needlePointer2); scale4.CircularPointers = pointers4; circularScales4.Add(scale4); sfCircularGauge4.CircularScales = circularScales4; sfCircularGauge4.SetBackgroundColor(Color.White); LinearLayout linearLayout = new LinearLayout(con); linearLayout.Orientation = Orientation.Vertical; linearLayout.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); linearLayout.AddView(sfCircularGauge, LayoutParams.WrapContent, (int)(250 * con.Resources.DisplayMetrics.Density)); linearLayout.AddView(sfCircularGauge1, LayoutParams.WrapContent, (int)(250 * con.Resources.DisplayMetrics.Density)); linearLayout.AddView(sfCircularGauge2, LayoutParams.WrapContent, (int)(250 * con.Resources.DisplayMetrics.Density)); linearLayout.AddView(sfCircularGauge3, LayoutParams.WrapContent, (int)(250 * con.Resources.DisplayMetrics.Density)); linearLayout.AddView(sfCircularGauge4, LayoutParams.WrapContent, (int)(250 * con.Resources.DisplayMetrics.Density)); linearLayout.SetPadding(30, 30, 30, 30); ScrollView mainView = new ScrollView(con); mainView.AddView(linearLayout); return(mainView); }
///////////////////////////////////////////////////////////////////////////////////////////////////// // NON-PUBLIC PROCEDURES ///////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Called when the control has loaded. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void OnLoaded(object sender, EventArgs e) { // Create the main CircularGauge and add it to the target panel CircularGauge circularGauge = new CircularGauge() { Width = 220, Height = 220, Radius = 110, HorizontalAlignment = HorizontalAlignment.Center, Background = new SolidColorBrush(Color.FromArgb(0xff, 0xee, 0xee, 0xe3)), RimBrush = new SolidColorBrush(Color.FromArgb(0xff, 0xf4, 0xf3, 0xf8)), FrameType = CircularFrameType.CircularGear, IsBackgroundEffectEnabled = false, }; this.targetPanel.Children.Insert(0, circularGauge); // Create and add a CircularScale to the CircularGauge CircularScale circularScale = new CircularScale() { Radius = 75, StartAngle = 30, SweepAngle = 330, BarExtent = 1 }; circularGauge.Scales.Add(circularScale); // Create and add a CircularTickSet to the CircularScale CircularTickSet circularTickSet = new CircularTickSet() { MajorInterval = 10, MinorInterval = 2 }; circularScale.TickSets.Add(circularTickSet); // Create and add two CircularRanges to the CircularTickSet circularTickSet.Ranges.Add(new CircularRange() { ScalePlacement = ScalePlacement.Inside, StartValue = 80, EndValue = 100, HasDropShadow = false, StartExtent = 15, EndExtent = 15, Background = LinearGradientBrushExtension.CreateBrush(Colors.Red, Colors.DarkRed, LinearGradientType.LeftToRight), }); circularTickSet.Ranges.Add(new CircularRange() { ScalePlacement = ScalePlacement.Inside, StartValue = 0, EndValue = 20, HasDropShadow = false, StartExtent = 15, EndExtent = 15, Background = LinearGradientBrushExtension.CreateBrush(Colors.Green, Colors.DarkGreen, LinearGradientType.LeftToRight) }); // Create and add a CircularTickMarkMajor and CircularTickMarkMinor to the CircularTickSet circularTickSet.Ticks.Add(new CircularTickMarkMajor() { TickMarkExtent = 10, TickMarkAscent = 4, TickMarkType = TickMarkType.SwordBlunt, Background = LinearGradientBrushExtension.CreateBrush(Colors.Black, Colors.DarkGray, LinearGradientType.TopToBottom) }); circularTickSet.Ticks.Add(new CircularTickMarkMinor() { TickMarkExtent = 7, TickMarkAscent = 4, TickMarkType = TickMarkType.TriangleSharp, Background = LinearGradientBrushExtension.CreateBrush(Colors.Black, Colors.DarkGray, LinearGradientType.TopToBottom) }); // Create and add a CircularTickLabelMajor to the CircularTickSet circularTickSet.Ticks.Add(new CircularTickLabelMajor() { Foreground = new SolidColorBrush(Color.FromArgb(0xff, 0x0c, 0x09, 0x09)), FontSize = 10, ScalePlacement = ScalePlacement.Outside, ScaleOffset = 5, TextOrientation = TextOrientation.Rotated }); // Create and add a CircularPointerNeedle and CircularPointerCap to the CircularTickSet CircularPointerNeedle circularPointerNeedle = new CircularPointerNeedle() { NeedleType = PointerNeedleType.TriangleSharp, PointerExtent = 75, PointerAscent = 10, Background = LinearGradientBrushExtension.CreateBrush(Color.FromArgb(0xff, 0xe1, 0x61, 0x79), Color.FromArgb(0xff, 0x9a, 0x12, 0x25), LinearGradientType.LeftToRight), }; circularTickSet.Pointers.Add(circularPointerNeedle); // Binding the needle to the value slider circularPointerNeedle.SetBinding(CircularPointerNeedle.ValueProperty, new Binding("Value") { Source = this, Mode = BindingMode.TwoWay }); // Create and add a CircularPointerCap to the CircularTickSet circularTickSet.Pointers.Add(new CircularPointerCap() { PointerExtent = 25, CapType = PointerCapType.CircleConvex, Background = new SolidColorBrush(Color.FromArgb(0xff, 0x9a, 0x12, 0x25)) }); }