I was having trouble getting Dundas Gauge for ASP.NET to reflect the value that I was assigning it. For some reason, the needle always pointed to the default 0. I was using this code:
//create circular gauge
GaugeContainer gauge = new GaugeContainer();
CircularGauge circleGauge = new CircularGauge();
gauge.CircularGauges.Add(circleGauge);
//scale
CircularScale scale = new CircularScale();
scale.Minimum = -100;
scale.Maximum = 100;
circleGauge.Scales.Add(scale);
//pointer
CircularPointer pointer = new CircularPointer();
pointer.Type = CircularPointerType.Needle;
pointer.Value = 10;
circleGauge.Pointers.Add(pointer);
//display
gauge.ImageType = ImageType.Png;
gauge.Width = new Unit(200);
gauge.Height = new Unit(200);
gauge.Page = Page;
gauge.RenderType = Dundas.Gauges.WebControl.RenderType.BinaryStreaming;
gauge.RenderControl(writer);
So "pointer.Value = 10;" was not working. After looking at some examples, I figured out that this worked:
gauge.CircularGauges[0].Pointers[0].Value = 10;
I'm not sure what the difference is, but give it a try if you're having a similar problem.
Leave a Reply