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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Refreshing chart on Save

Thread ID:





132273 Aug 24,2017 01:26 AM UTC Aug 24,2017 10:23 AM UTC Xamarin.Forms 1
Tags: SfChart
Julie Misson
Asked On August 24, 2017 01:26 AM UTC

I have an sfChart for Xamarin forms.

How do I add a new value, click a save button and have the chart refreshed.

This is my ViewModel

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using BeatPain.Database;
using System.Linq;

namespace BeatPain
    public class PainScoreViewModel

        public RewardDatabase database;

        public ObservableCollection<PainScoreDB> Items { getset; }
        public PainScoreViewModel()
            database = new RewardDatabase();
            Items = new ObservableCollection<PainScoreDB>();

                   var items = (from i in database.GetItems<PainScoreDB>()
                orderby i.PainDateSetDB
                select i);

                foreach (var item in items)

My chart XAML

<chart:SfChart Grid.Row="6" x:Name="painChart">







                <chart:NumericalAxis Minimum="0" Maximum="10" Interval="1">

                 <chart:ChartAxisTitle Text="Pain Score"></chart:ChartAxisTitle>



         <chart:ColumnSeries ItemsSource="{Binding Items}" XBindingPath="PainDateSetDB" YBindingPath="ScoreDB" Color="{StaticResource PositiveBackgroundColorUnselected}"

            <chart:ChartColorModel Palette="None"/>



    <chart:ChartDataMarker ShowLabel="True"/>





I have attached a screen shot.  What I wish to do, is change the range, click on the save button, and for the chart on the same page to be refreshed.


Attachment: Screen_Shot_20170824_at_11.23.28_am_72799400.zip

Sivaram Ganesan [Syncfusion]
Replied On August 24, 2017 10:23 AM UTC

Hi Julie,

Thanks for contacting Syncfusion support.

Chart will be automatically refreshed if we add, remove, insert and clear the data from ItemsSource at any time if the data is type of ObservableCollection.

We have prepared a sample based on this and it can be downloaded from below location.

Sample link: http://www.syncfusion.com/downloads/support/forum/132273/ze/ItemsSourceSample1256786745

Please get back to us on further assistance on this.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon