We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

MVVM Binding data

Dear Syncfusion,

I am affected by new problems using SFLinearGauge and SFChart both related to binding data.

I managed to bind value showed on SFCircularGauge to my ViweModel (still some problems with rendering - mentioned in different topic). Unfortunately the same approach does not work with Linear version of Gauge.

My View (ContentPage) is auto-wired to my ViewModel using Prism. All bindings used in e.g. Labels works without any problems. When I bind in my LinearGauge the value is always 0.
When I set Value manually in XAML it displays correctly. Also coping binding from Gauges Value to Labels Text shows correct value. The variable is of double type. I tried both BarPointer and SymbolPointer.
<gauge:SfLinearGauge HeightRequest="60" Orientation="OrientationHorizontal" BackgroundColor="White">
                <gauge:LinearScale MinimumValue="0" MaximumValue="550" Interval="50" LabelColor="Gray" LabelOffset="0.2" ScaleBarSize="10" ScalePosition="Forward" ScaleBarColor="Transparent" FrameOffset="0.1">
                        <gauge:SymbolPointer Value="{Binding MyValue}" Color="#0091DC" />
                        <!--<gauge:BarPointer Thickness="15" Value="{Binding MyValue}" Color="#0091DC" />-->

And in ViewModel it is declared like Prism recommends:
private double _myValue;
public double MyValue
    get { return _myValue; }
    set { SetProperty(ref _myValue, value); }

Is there any difference between Linear and Circular Gauge?

I created simple PieChart and populated it with my Custom data (of course all using MVVM approach) (all based on great samples: https://help.syncfusion.com/xamarin/sfchart/overview)
In my constructor of ViewModel I populate data:
PieData = new ObservableCollection<PieChartLabel>();
PieData.Add(new PieChartLabel("Valid", 10));
PieData.Add(new PieChartLabel("Invalid", 20));
PieData.Add(new PieChartLabel("Standstill", 30));

And it shows this data as supposed to. The problem is that the App is going to be a live data app and data showed on Pie chart will change.
Unfortunately changing directly one element:
PieData[index].Value = newData.Value;

Or changing whole collestion:
var pieData = PieData;
pieData[index].Value = newData.Value;
PieData = pieData;
is not working. I can only see first data set in contructor of my VM

I will appreciate all the help.

Best regards,

1 Reply

PK Pavendhan Kumar Syncfusion Team September 20, 2016 04:07 AM UTC

Hi Grzegorz Bojarczuk,

Thanks for contacting Syncfusion support.

Query regarding SFChart:

You can achieve this requirement using ‘ListenPropertyChange’ property of ChartSeries. We have prepared a sample as per your requirement. Please find the sample from the below location.

Sample : http://www.syncfusion.com/downloads/support/forum/125996/ze/SimpleSample-34646017

Query regarding SFLinearGauge

We were able to reproduce the issue " reported binding issue in LinearGauge” and have logged defect report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates.


Pavendhan K. 

Live Chat Icon For mobile
Up arrow icon