Is this possible?

4 posts, 0 answers
  1. Tim
    Tim avatar
    9 posts
    Member since:
    Jun 2012

    Posted 07 Oct 2009 Link to this post

    Ok I have a cool idea but I don't know if I can pull it off...

    I have a chart for a dashboard that displays metrics data in a stack for every day of the current week. 
    I load all of the days of the week except for the current day using a query into an archive data warehouse table.
    I pull the current days data from current tables.

    This works well but my goal is to display this data on a dash console in the office and update the chart every 15 seconds.  
    I only want to update the current day's bar though....  I don't want to refresh the whole control.

    i.e.

    if today is Tuesday I want to display Sat, Sun, Mon, Tue values but I want to refresh Tue every 15 seconds and only re-paint the bars for Tuesday.

    Is this possible?
    Thanks,
    Tim
  2. Tim
    Tim avatar
    9 posts
    Member since:
    Jun 2012

    Posted 07 Oct 2009 Link to this post

    I just had an epiphany!
    What if I used 2 series mappings?
    Can I setup a series map for the old data and then add another series map for the current day and just remove and add the series map for the current day.  Will this cause only the series map for the current day to be repainted without repainting the old series map?

  3. Tim
    Tim avatar
    9 posts
    Member since:
    Jun 2012

    Posted 07 Oct 2009 Link to this post

    Ok now I'm on a new idea.....
    Based on some helpful links from a previous post, I am at least aware that the controls can be used with the INotifyCollectionChaged event.  I'm assuming that means if I bind my data to the object that it will update itself...

    Very cool are there any examples that anyone has seen of this?
    Thanks,
    Tim
  4. Velin
    Admin
    Velin avatar
    391 posts

    Posted 09 Oct 2009 Link to this post

    Hello Tim,

    Indeed the current version of the control supports automatic updates to change notifications coming from the items source. Here is the sample code:
        ObservableCollection<ChartData> data;
        public Page()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(Page_Loaded);
        }
     
        void Page_Loaded(object sender, RoutedEventArgs e)
        {
     
            data = new ObservableCollection<ChartData>()
                                {
                                    new ChartData(5, 5, Colors.Brown),
                                    new ChartData(6, 6, Colors.Blue),
                                    new ChartData(7, 7, Colors.Cyan)
                                };
     
            SeriesMapping m = new SeriesMapping();
            m.SeriesDefinition = new BarSeriesDefinition();
     
            m.ItemMappings.Add(new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "YValue" });
            RadChart1.SeriesMappings.Add(m);
            RadChart1.ItemsSource = data;
        }
    }

    Where the ChartData type implements the INotifyPropertyChanged interface.

    Attached is the sample application as well.

    All the best,
    Velin
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top