hello.
im new to this product, and am now evaluation it.
is there a guide or some other document that explaines basics on how to:
Create a guage
connect gauge to DB
use as real time guage
same goes for charts,
i havnt been able to find anything at the documentaions.
thanks for any help
Hi,
I suppose it returns null because you didn't set it nowhere in the code. if you stop it with debugger you will probably see that the marker object is defined, but marker.Value will be null. So I suggest you to try that way:
In the pageLoad add this:
if (!IsPostBack)
{
LinearGauge myLinearGauge = new LinearGauge();
myLinearGauge.Key =
"linear";
myLinearGauge.Orientation =
LinearOrientation.Vertical;
myLinearGauge.BrushElement =
new SolidFillBrushElement(Color.White);
myLinearGauge.BoundsMeasure =
Measure.Percent;
myLinearGauge.Bounds =
new Rectangle(60, 30, 10, 40);
myLinearGauge.Scales.Add(
new LinearGaugeScale());
myLinearGauge.Scales[0].Axis =
new NumericAxis(0.0, 100.0, 20.0);
myLinearGauge.Scales[0].StartExtent = 0.0;
myLinearGauge.Scales[0].EndExtent = 100.0;
myLinearGauge.Scales[0].InnerExtent = 0.0;
myLinearGauge.Scales[0].OuterExtent = 100.0;
myLinearGauge.Scales[0].StrokeElement.Color =
Color.Black;
myLinearGauge.Scales[0].MajorTickmarks.StrokeElement.Color =
myLinearGauge.Scales[0].MajorTickmarks.ZPosition =
LinearTickmarkZPosition.BelowMarkers;
myLinearGauge.Scales[0].MajorTickmarks.StartExtent = 0.0;
myLinearGauge.Scales[0].MajorTickmarks.EndExtent = 100.0;
LinearGaugeBarMarker barMarker = myLinearGauge.Scales[0].Markers.AddBarMarker();
barMarker.InnerExtent = 10.0;
barMarker.OuterExtent = 90.0;
barMarker.BrushElement =
new SolidFillBrushElement(Color.Red);
barMarker.Value = 72.0;
this.UltraGauge1.Gauges.Add(myLinearGauge);
this.UltraGauge1.Gauges.FromKey("linear").Visible = true;
}
Here is the EventHandler:
protected void UltraGauge1_AsyncRefresh(object sender,
Infragistics.WebUI.UltraWebGauge.
RefreshEventArgs e)
LinearGauge gauge = this.UltraGauge1.Gauges[0] as LinearGauge;
LinearGaugeBarMarker marker = gauge.Scales[0].Markers[0] as LinearGaugeBarMarker;
int value = Convert.ToInt32(marker.Value);
Is that you are trying?
Keep in mind that if you have more than one gauges you have to get the LinearGauge, or it will throw an exception.
Thanks,
so.. any ideas?
hi, i am trying to do somthing very simple - test the real time abilitys of the product.
i have a simple liner gauge. after using one of the presets, i went to its property (from desigen mode) and addded in events in asyncRefresh a handler.
the weird thing is that now i do see it going into the event at the server side:
protected void UltraGauge1_AsyncRefresh(object sender,Infragistics.WebUI.UltraWebGauge.RefreshEventArgs e)
LinearGaugeMarker marker = gauge.Scales[0].Markers[0];
marker.Value = value + 5;}
but at this code: int value = Convert.ToInt32(marker.Value);
it thrwos an expexption of Object reference not set to an instance of an object.
What are you trying to do with that code? And did you bind the event handler to some event?
hi. thanks for the help..
small q,
i set a refreshIntreval to 10 seconds.
and added this:
tho this dos nothing. in debug i notice that there is no event fired (the brakepoint isnt reached).
whats worng?