- Home
- Forum
- Xamarin.Android
- Cant update gauge value
Cant update gauge value
Hello. I have a problem with my Gauge. I have I Gauge graph and I am calling running a method every one minute to pass new value to gauge graph. The problem is that the value is not updating. This is the method that I am calling every one minute. The Console.Writeline print correctly the values but there is no graph update with the new values.
private void SetRealTimeerGraph(double status)
{
SfCircularGauge erCircularGauge = new SfCircularGauge(Activity);
ObservableCollection<CircularScale> erScales = new ObservableCollection<CircularScale>();
CircularScale erScale = new CircularScale();
{
SfCircularGauge erCircularGauge = new SfCircularGauge(Activity);
ObservableCollection<CircularScale> erScales = new ObservableCollection<CircularScale>();
CircularScale erScale = new CircularScale();
Console.WriteLine("er status: " + status);
erScale.StartValue = 0;
erScale.EndValue = 100;
erScale.ShowTicks = false;
erScale.StartAngle = 160;
erScale.SweepAngle = 220;
erScale.ShowLabels = false;
erScale.RimColor = Color.ParseColor("#1aea1c8b");
erScale.ScaleStartOffset = 1;
erScale.ScaleEndOffset = 0.6;
CircularRange erRange = new CircularRange();
erRange.StartValue = 0;
erRange.EndValue = status;
erRange.Width = 14;
erRange.Offset = 1;
erRange.OuterStartOffset = 1;
erRange.OuterEndOffset = 0.6;
erScale.CircularRanges.Add(erRange);
erScale.EndValue = 100;
erScale.ShowTicks = false;
erScale.StartAngle = 160;
erScale.SweepAngle = 220;
erScale.ShowLabels = false;
erScale.RimColor = Color.ParseColor("#1aea1c8b");
erScale.ScaleStartOffset = 1;
erScale.ScaleEndOffset = 0.6;
CircularRange erRange = new CircularRange();
erRange.StartValue = 0;
erRange.EndValue = status;
erRange.Width = 14;
erRange.Offset = 1;
erRange.OuterStartOffset = 1;
erRange.OuterEndOffset = 0.6;
erScale.CircularRanges.Add(erRange);
Console.WriteLine("12345 "+erRange.EndValue);
ObservableCollection<GaugeGradientStop> gradientColor1 = new ObservableCollection<GaugeGradientStop>();
GaugeGradientStop gaugeGradientStop = new GaugeGradientStop();
gaugeGradientStop.Value = 0;
gaugeGradientStop.Color = Color.ParseColor("#fdc8e9");
gradientColor1.Add(gaugeGradientStop);
gaugeGradientStop.Value = 0;
gaugeGradientStop.Color = Color.ParseColor("#fdc8e9");
gradientColor1.Add(gaugeGradientStop);
GaugeGradientStop gaugeGradientStop1 = new GaugeGradientStop();
gaugeGradientStop1.Value = status;
gaugeGradientStop1.Color = Color.ParseColor("#9d1141");
gradientColor1.Add(gaugeGradientStop1);
gaugeGradientStop1.Value = status;
gaugeGradientStop1.Color = Color.ParseColor("#9d1141");
gradientColor1.Add(gaugeGradientStop1);
erRange.GradientStops = gradientColor1;
erScales.Add(erScale);
erCircularGauge.CircularScales = erScales;
real_er_grapg.AddView(erCircularGauge);
real_er_grapg.AddView(erCircularGauge);
SIGN IN To post a reply.
5 Replies
SG
Sri Gayathri Gopalakrishnan
Syncfusion Team
June 4, 2018 09:00 AM UTC
Query: Can’t update gauge value
We have analyzed your query, the circular gauge instance is created every time newly while calling method and added in layout view. Hence recently added circular gauge placed under old views(gauge) in layout and old view is visible on every time. So, gauge values seem to be not updated. To resolve this please remove old view (circular gauge) in layout before adding a new view. We have prepared sample based on your codesnippet. Please download the sample from the below link,
Also, we would like to suggest you update only new value properties in method rather than creating new circular gauge instance on every time for better performance. In SetRealTimeerGraph() method, you can update range and GaugeGradientStop’s value property for your requirement.
Regards,
Sri Gayathri. G
US
Usha
August 12, 2020 04:27 PM UTC
Can I achieve same in normal wpf desktop application ?
Can you please provide sample code ?
RS
Ramya Soundar Rajan
Syncfusion Team
August 13, 2020 07:43 AM UTC
Hi Usha,
We have prepared based on your requirement to update the value of the range and GaugeGradientStop’s properties in time delay. Please refer the sample from below location.
Regards,
Ramya S
US
Usha
August 13, 2020 09:26 AM UTC
Hi ,
Attachment: Gauge_64b51fb.zip
I have attached the code snippet. I have defined multiple circular pointers inside circular gauge .
Only one particular pointer is not getting update at runtime ,Can you please look at this ?
Thanks
Attachment: Gauge_64b51fb.zip
RS
Ramya Soundar Rajan
Syncfusion Team
August 14, 2020 09:53 AM UTC
We have checked with the provided code snippet and changed the value of the pointer dynamically in a time delay. But that is worked at our side. Please find the sample from below location.
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/GaugeWPFSample-863565342
Tested Video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/GAUGEP~1-1977384292
Can you please share the current Syncfusion version? Could you please check the issue with the attached sample and let us know whether it is reproduced or not? If the issue was not reproduced, please revert us by modifying the sample. This will be helpful for us to investigate further and provide you with a better solution at the earliest.
Regards,
Ramya S
SIGN IN To post a reply.
- 5 Replies
- 4 Participants
-
KE Konstantinos Evangelidis
- Jun 1, 2018 02:31 PM UTC
- Aug 14, 2020 09:53 AM UTC