RadCartesianChart Event

2 posts, 0 answers
  1. Lee
    Lee avatar
    30 posts
    Member since:
    Apr 2014

    Posted 03 Nov 2014 Link to this post

    Hi.

    Additionally, I have a question.

    It is event about RadCartesianChart.

    I want to occur event when data of chart is changed.

    example code part. 

    ------------------------------------------------------------------------------------------------------------------------

    chart.xaml
    <telerik:RadCartesianChart.SeriesProvider>
                    <telerik:ChartSeriesProvider Source="{Binding Series}">
                        <telerik:ChartSeriesProvider.SeriesDescriptors>
                            <telerik:CategoricalSeriesDescriptor ItemsSourcePath="Data" ValuePath="Value" CategoryPath="LocalTime" >


    chartViewModel.cs
    Series type is ObservableCollection<TrendSeries>

        public class TrendSeries
        {
            public string Name { get; set; }
            public ObservableCollection<TrendData> Data { get; set; }
            public string Unit { get; set; }
            public short Place { get; set; }
        }

        public class TrendData
        {
            public double Value { get; set; }
            public short Place { get; set; }
            public string LineName { get; set; }
            public string Time { get; set; }
            public string Color { get; set; }
            public DateTime LocalTime { get; set; }
        }

    in timer event(tick)

    ........
    ObservableCollection<TrendData> data = Series[i].Data;

    data.Add(....)

    ------------------------------------------------------------------------------------------------------------------------

    Finally, when 'data' is changed, some event occur.

    What should I do for it?
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 06 Nov 2014 Link to this post

    Hi,

    Your custom TrendSeries class should implement the INotifyPropertyChanged interface. You can find guidelines on the matter in this article. Another way would be to take advantage of our ViewModelBase class. It implements the interface and you need to subclass it only.

    I hope this information will get you started.

    Regards,
    Pavel R. Pavlov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top