Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

Ultragauge databinding

Last post 05-06-2008 14:33 by [Infragistics] David Negley. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 02-27-2008 17:19

    • BKardon
    • Not Ranked
    • Joined on 02-27-2008
    • Points 40

    Ultragauge databinding

    I am testing out NetAdvantage for ASP.NET to see if it meets my needs for a dashboard project.  I need to be able to display data-bound gauges.  In testing out the UltraGauges, I can't seem to figure out how to bind the controls to data.  For example, I hypothetically need a gauge to show the number of safety incidents in a facility, based on data from a proprietary database.  Is this possible with the UltraGauges?  Do they have the ability to bind to data?  In the Infra Dashboard sample that is provided, the Gauge on the page doesn't seem to show any data.

    Surely this must be possible as I don't see the point of the gauges otherwise.  Can anybody point me in the right direction?

    • Post Points: 20
  • 03-03-2008 17:42 In reply to

    Re: Ultragauge databinding

    since most gauges are bound to a single value, there is no need for databinding, and thus it is not a feature of the ultragauge control.  you can simply fetch the (single) value from your data source and assign it to the Value property of the marker in context. 

    • Post Points: 35
  • 04-29-2008 17:02 In reply to

    • clively
    • Not Ranked
    • Joined on 04-29-2008
    • Points 70

    Re: Ultragauge databinding

    Provided of course that you aren't using sharepoint.  In which case the "simply fetch the value..." statement becomes a days worth of work.

     

     

    • Post Points: 5
  • 05-06-2008 10:59 In reply to

    • cgoodman
    • Top 150 Contributor
    • Joined on 05-06-2008
    • Points 335

    Re: Ultragauge databinding

     I too am a newbie, and evaluating the control.  I do not understand exactly how to set the value of the marker. 

    [Infragistics] David Negley:
    you can simply fetch the (single) value from your data source and assign it to the Value property of the marker in context. 
      I am not clear on where to get the value property.  My gauge has no Context or Marker property...  What would the C# code be to set the value.

    • Post Points: 20
  • 05-06-2008 12:48 In reply to

    • clively
    • Not Ranked
    • Joined on 04-29-2008
    • Points 70

    Re: Ultragauge databinding

    cgoodman:
    What would the C# code be to set the value

    Assuming your UltraGauge is named gauge, something along the lines of the following would set all Gauges in a Gauge:


    foreach (Infragistics.UltraGauge.Resources.Gauge g in gauge.Gauges) {
     if (g is Infragistics.UltraGauge.Resources.RadialGauge) {
      Infragistics.UltraGauge.Resources.RadialGauge rg = (Infragistics.UltraGauge.Resources.RadialGauge)g;

      rg.Scales[0].Markers[0].Value = value;

     } // if radial

    } // foreach gauge

    ---------------------------
    In other words, it's buried pretty far down which is probably the real reason data binding isn't supported.

    • Post Points: 20
  • 05-06-2008 13:59 In reply to

    • cgoodman
    • Top 150 Contributor
    • Joined on 05-06-2008
    • Points 335

    Re: Ultragauge databinding

     That's awesome.  Thank you... But it seems to me that if DataBind() isn't supported, then you should support setting the value in a much easier way.  Just my thoughts.  Thank you again and thanks for being quick.

    • Post Points: 20
  • 05-06-2008 14:33 In reply to

    Re: Ultragauge databinding

    try wrapping the UltraGauge control in a class like this to simplify setting the value:

    internal class MiniGauge : UltraGauge
    {
        public MiniGauge()
            : base()
        {
            RadialGauge rad = new RadialGauge();
            this.Gauges.Add(rad);
            SolidFillBrushElement dialBrush = new SolidFillBrushElement(Color.SkyBlue);
            rad.Dial.BrushElement = dialBrush;
            rad.Scales.Add(new RadialGaugeScale());
            rad.Scales[0].Axis = new NumericAxis();
            RadialGaugeNeedle needle = new RadialGaugeNeedle();
            rad.Scales[0].Markers.Add(needle);
            SolidFillBrushElement needleBrush = new SolidFillBrushElement(Color.Black);
            needle.BrushElement = needleBrush;
            rad.Scales[0].Labels.BrushElement = needleBrush;
            rad.Scales[0].MajorTickmarks.BrushElement = needleBrush;
        }
        public virtual double Value
        {

            get
            {
                return (double)((RadialGauge)this.Gauges[0]).Scales[0].Markers[0].Value;

            }

            set
            {
                ((RadialGauge)this.Gauges[0]).Scales[0].Markers[0].Value = value;

            }

        }

    }
     

    • Post Points: 5
Page 1 of 1 (7 items)
Powered by Community Server (Commercial Edition), by Telligent Systems