This is a migrated thread and some comments may be shown as answers.

RadCartesianChart Event

1 Answer 68 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Lee
Top achievements
Rank 1
Lee asked on 04 Nov 2014, 03:09 AM
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?

1 Answer, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 06 Nov 2014, 01:09 PM
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.

 
Tags
Chart
Asked by
Lee
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or