Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
465
Displaying Gauges in a Gauge Collection
posted

How do I display a collection of horizontal linear gauges, vertically (one on top of the other).  When I run my test code, only one gauge is displayed.  Below is my test code which creates a gauge collection with two linear gauges (myLinearGauge and myLinearGauge2) .  Thanks for the assistance!

              Infragistics.WebUI.UltraWebGauge.UltraGauge ultraGauge1 =

 

              new Infragistics.WebUI.UltraWebGauge.UltraGauge();

            LinearGauge myLinearGauge = new LinearGauge();

            LinearGauge myLinearGauge2 = new LinearGauge();

            LinearGaugeScale myScale = new LinearGaugeScale();

            NumericAxis numericAxis1 = new NumericAxis();

            LinearGaugeBarMarker barMarker = new LinearGaugeBarMarker();

            LinearGaugeNeedle needleMarker = new LinearGaugeNeedle();

            SolidFillBrushElement transparentBrushElement = new SolidFillBrushElement();

            SolidFillBrushElement blackBrushElement = new SolidFillBrushElement();

            SolidFillBrushElement grayBrushElement = new SolidFillBrushElement();

            SolidFillBrushElement greenBrushElement = new SolidFillBrushElement();

            SolidFillBrushElement mySolidFillBrushElement4 = new SolidFillBrushElement();

            SolidFillBrushElement redBrushElement = new SolidFillBrushElement();

            SimpleGradientBrushElement mySimpleGradientBrushElement = new SimpleGradientBrushElement();

 

            transparentBrushElement.Color = System.Drawing.Color.Transparent;

            blackBrushElement.Color = System.Drawing.Color.Black;

            grayBrushElement.Color = System.Drawing.Color.Gray;

            greenBrushElement.Color = System.Drawing.Color.Green;

            redBrushElement.Color = System.Drawing.Color.Red;

 

            mySimpleGradientBrushElement.StartColor = System.Drawing.Color.LightSteelBlue;

            mySimpleGradientBrushElement.EndColor = System.Drawing.Color.White;

            mySimpleGradientBrushElement.GradientStyle = Infragistics.UltraGauge.Resources.Gradient.BackwardDiagonal;

 

            //Set the background color 

            //myLinearGauge.BrushElement = transparentBrushElement;

 

            //Set the corner extent and orientation of Linear gauge

            //myLinearGauge.CornerExtent = 50;

            //myLinearGauge.Orientation = LinearOrientation.Horizontal;

 

            //Set the end value of the axis to 1

            numericAxis1.EndValue = 1;

            numericAxis1.TickmarkInterval = 0.1;

            myScale.Axes.Add(numericAxis1);

 

            //Set the following Scale properties:

            myLinearGauge.BrushElement = mySimpleGradientBrushElement;

            myScale.EndExtent = 95;

            myScale.InnerExtent = 24;

            myScale.StartExtent = 5;

            myScale.OuterExtent = 36;

 

            //Set the following Labels properties:

            myScale.Labels.BrushElement = blackBrushElement;

            myScale.Labels.Extent = 11;

            myScale.Labels.Font =

              new System.Drawing.Font("Arial", 8F,

              System.Drawing.FontStyle.Regular);

            myScale.Labels.Frequency = 1;

            myScale.Labels.FormatString = "<DATA_VALUE:>";

 

            //Set the following major Tickmark properties:

            myScale.MajorTickmarks.BrushElement = grayBrushElement;

            myScale.MajorTickmarks.EndExtent = 47;

            myScale.MajorTickmarks.EndWidth = 2;

            myScale.MajorTickmarks.Frequency = 0;

            myScale.MajorTickmarks.StartExtent = 26;

            myScale.MajorTickmarks.StartWidth = 2;

 

            //Set the following minor Tickmark properties:

            myScale.MinorTickmarks.BrushElement = grayBrushElement;

            myScale.MinorTickmarks.EndExtent = 30;

            myScale.MinorTickmarks.EndWidth = 2;

            myScale.MinorTickmarks.Frequency = .2;

            myScale.MinorTickmarks.StartExtent = 42;

            myScale.MinorTickmarks.StartWidth = 2;

 

            //Set the following Marker properties:

         

           

            barMarker.InnerExtent = 50;

            barMarker.OuterExtent = 140;

            //myMarker.SegmentSpan = 1;

            //myMarker.StartExtent = 0;

            barMarker.Value = .85;

            barMarker.Precision = 0;

            if (Convert.ToSingle(barMarker.Value) < .9)

            {

                barMarker.BrushElement = redBrushElement;

            }

            else

            {

                barMarker.BrushElement = greenBrushElement;

            }

            myScale.Markers.Add(barMarker);

            needleMarker.StartExtent = 86;

            needleMarker.MidExtent = 86;

            needleMarker.EndExtent = 52;

            needleMarker.StartWidth = 5;

            needleMarker.MidWidth = 17;

            needleMarker.EndWidth = 0;

            //myMarker.SegmentSpan = 1;

            //myMarker.StartExtent = 0;

            needleMarker.Value = .9;

            needleMarker.Precision = 0;

            needleMarker.BrushElement = greenBrushElement;

          

            myScale.Markers.Add(needleMarker);

 

            //Add scale to the scales collection and gauge to the Gauges collection.

            myLinearGauge.Scales.Add(myScale);

            myLinearGauge2.Scales.Add(myScale);

            ultraGauge1.Gauges.Add(myLinearGauge);

            ultraGauge1.Gauges.Add(myLinearGauge2);

            ultraGauge1.ID = "ultraGauge1";

            ultraGauge1.Height = Unit.Pixel(69);

            ultraGauge1.Width = Unit.Pixel(450);

            ultraGauge1.TabIndex = 0;

            this.Controls.Add(ultraGauge1);

 

 

Parents Reply Children
No Data