Example #1
0
        public override void SetupGaugeCore(ASPxGaugeControl gaugeContainer)
        {
            CircularGauge circularGauge = (CircularGauge)gaugeContainer.AddGauge(GaugeType.Circular);

            // Add the default elements (a scale, background layer, needle and spindle cap).
            circularGauge.AddDefaultElements();
            // Change the background layer's paint style.
            ArcScaleBackgroundLayer backgroundCircular = circularGauge.BackgroundLayers[0];

            backgroundCircular.ShapeType = BackgroundLayerShapeType.CircularFull_Style3;
            // Customize the scale's settings.
            ArcScaleComponent scaleCircular = circularGauge.Scales[0];

            BindableComponent                            = scaleCircular;
            scaleCircular.MinValue                       = 0;
            scaleCircular.MaxValue                       = 100;
            scaleCircular.Value                          = 0;
            scaleCircular.MajorTickCount                 = 6;
            scaleCircular.MajorTickmark.FormatString     = "{0:F0}";
            scaleCircular.MajorTickmark.ShapeType        = TickmarkShapeType.Circular_Style2_2;
            scaleCircular.MajorTickmark.ShapeOffset      = -9;
            scaleCircular.MajorTickmark.AllowTickOverlap = true;
            scaleCircular.MinorTickCount                 = 3;
            scaleCircular.MinorTickmark.ShapeType        = TickmarkShapeType.Circular_Style2_1;
            // Change the needle's paint style.
            ArcScaleNeedleComponent needle = circularGauge.Needles[0];

            needle.ShapeType = NeedleShapeType.CircularFull_Style3;
        }
        public override void SetupGaugeCore(ASPxGaugeControl gaugeContainer)
        {
            LinearGauge linearGauge = (LinearGauge)gaugeContainer.AddGauge(GaugeType.Linear);

            // Add the default elements (a scale, background layer and level bar).
            linearGauge.AddDefaultElements();
            // Change the background layer's paint style.
            LinearScaleBackgroundLayer backgroundLinear = linearGauge.BackgroundLayers[0];

            backgroundLinear.ShapeType = BackgroundLayerShapeType.Linear_Style3;
            // Customize the scale's settings.
            LinearScaleComponent scaleLinear = linearGauge.Scales[0];

            BindableComponent                      = scaleLinear;
            scaleLinear.MinValue                   = 0;
            scaleLinear.MaxValue                   = 100;
            scaleLinear.Value                      = 0;
            scaleLinear.MajorTickCount             = 6;
            scaleLinear.MajorTickmark.FormatString = "{0:F0}";
            scaleLinear.MajorTickmark.ShapeType    = TickmarkShapeType.Linear_Style6_3;
            scaleLinear.MinorTickCount             = 3;
            scaleLinear.MinorTickmark.ShapeType    = TickmarkShapeType.Linear_Style5_2;
            // Shift tick marks to the right.
            scaleLinear.MajorTickmark.ShapeOffset = 5f;
            scaleLinear.MinorTickmark.ShapeOffset = 5f;
            // Change the levelBar's paint style.
            LinearScaleLevelComponent levelBar = linearGauge.Levels[0];

            levelBar.ShapeType = LevelShapeSetType.Style3;
            // Shift the background layer up and to the left.
            backgroundLinear.ScaleStartPos = new PointF2D(backgroundLinear.ScaleStartPos.X - 0.005f,
                                                          backgroundLinear.ScaleStartPos.Y - 0.015f);
            backgroundLinear.ScaleEndPos = new PointF2D(backgroundLinear.ScaleEndPos.X - 0.005f,
                                                        backgroundLinear.ScaleEndPos.Y);
        }
    private void CreateCircularGauge()
    {
        ASPxGaugeControl gaugeControl = new ASPxGaugeControl();
        CircularGauge    gauge        = (CircularGauge)gaugeControl.AddGauge(GaugeType.Circular);

        gauge.AddDefaultElements();
        ArcScaleComponent scale = gauge.Scales[0];

        scale.BeginUpdate();
        scale.Ranges.AddRange(CreateRanges(scale.MaxValue - scale.MinValue, scale.MinValue));
        scale.EndUpdate();
        Page.Form.Controls.Add(gaugeControl);
    }
Example #4
0
        public override void SetupGaugeCore(ASPxGaugeControl gaugeContainer)
        {
            DigitalGauge digitalGauge = (DigitalGauge)gaugeContainer.AddGauge(GaugeType.Digital);

            // The number of digits.
            digitalGauge.DigitCount = 14;
            // Use 14 segment display mode.
            digitalGauge.DisplayMode = DigitalGaugeDisplayMode.FourteenSegment;
            // Add a background layer and set its painting style.
            DigitalBackgroundLayerComponent backgroundDigital = digitalGauge.AddBackgroundLayer();

            BindableComponent           = digitalGauge;
            backgroundDigital.ShapeType = DigitalBackgroundShapeSetType.Style2;
            // Set the color of digits.
            digitalGauge.AppearanceOn.ContentBrush = new SolidBrushObject(Color.Red);
        }
Example #5
0
        private IGauge AddGauge(ASPxGaugeControl gaugeControl, int score)
        {
            var gauge = (CircularGauge)gaugeControl.AddGauge(GaugeType.Circular);
            var scale = gauge.AddScale();

            //Set angles so gauge fills from "North" in the clockwise direction
            scale.StartAngle = -90;
            scale.EndAngle   = 270;

            //Set range and current value to scale
            var scaleValue = (float)Math.Max(score, 0.1);

            scale.Renderable = false;
            scale.MinValue   = 0;
            if (scaleValue <= 10)
            {
                scale.MaxValue = scaleValue;
            }
            else
            {
                scale.MaxValue = 100;
            }
            scale.Value = scaleValue;                     //If the score is zero, we still want some red to show
            scale.DataBind();

            //Set colors on ranges
            var backRange = gauge.AddRangeBar();

            backRange.AppearanceRangeBar.ContentBrush = new SolidBrushObject()
            {
                Color = _indicatorService.GetColorByScore(-1)
            };
            backRange.Value       = 100;
            backRange.StartOffset = 80;
            backRange.EndOffset   = -12;

            var frontRange = gauge.AddRangeBar();

            frontRange.AppearanceRangeBar.ContentBrush = new SolidBrushObject()
            {
                Color = _indicatorService.GetColorByScore(score)
            };
            frontRange.StartOffset = 80;
            frontRange.EndOffset   = -12;

            return(gauge);
        }
Example #6
0
        public override void SetupGaugeCore(ASPxGaugeControl gaugeContainer)
        {
            StateIndicatorGauge     siGauge        = (StateIndicatorGauge)gaugeContainer.AddGauge(GaugeType.StateIndicator);
            StateIndicatorComponent stateIndicator = siGauge.AddIndicator();

            stateIndicator.BeginUpdate();
            BindableComponent = stateIndicator;
            StateIndicatorShapeType[] shapes = new StateIndicatorShapeType[] {
                StateIndicatorShapeType.TrafficLight2,
                StateIndicatorShapeType.TrafficLight3,
                StateIndicatorShapeType.TrafficLight4,
            };
            stateIndicator.States.Clear();
            foreach (StateIndicatorShapeType shape in shapes)
            {
                IndicatorStateWeb state = new IndicatorStateWeb(shape);
                stateIndicator.States.Add(state);
            }
            stateIndicator.Size = new SizeF(100, 200);
        }