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?
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; } }}
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.
cgoodman said: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.
I too am a newbie, and evaluating the control. I do not understand exactly how to set the value of the marker.
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.
Provided of course that you aren't using sharepoint. In which case the "simply fetch the value..." statement becomes a days worth of work.