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

Max and min for DateTimeCategoricalAxis

1 Answer 232 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Rickard
Top achievements
Rank 1
Rickard asked on 13 Sep 2013, 02:25 PM
Hi,

I'm rather new to the ChartView component, so bear with me.

I have a RadCartesianChart that displays runtime values (a double and a DateTime essentially) on a LineSeries and is refreshed roughly once a second. The horizontal axis is a DateTimeCategoricalAxis and the vertical axis is a LinearAxis. The application is set up so that the user can display values from the last 30 seconds, 1 minute, 5 minutes or 30 minutes. However, as far as I can see, there is no way to force the chart to display a set time span, e.g. from DateTime.Now-30 seconds to DateTime.Now. Rather, the chart renders the horizontal axis according to what's in the data.

To accommodate this, I have had to implement logic that pushes and pops values from the databound ItemsSource so that it contains roughly the amount of values that I want to plot (30 seconds, 1 minute etc). However, as there is no guarantee that values come in at a fixed interval and "on the second", this results in the horizontal axis and chart as a whole "shifting about" a bit. It's also somewhat computationally intensive.

Is there any way to archive what I'm after using the RadCartesianChart?

Best regards,
Rickard

1 Answer, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 18 Sep 2013, 08:58 PM
Hi Rickard,

Instead of using DateTimeCategoricalAxis, you can use the DateTimeContinuousAxis, which provides two bindable properties Minimum and Maximum. You can use these properties to set the range of the axis from the ViewModel as per your requirements.

I have attached a sample project demonstrating that.
 
Regards,
Petar Kirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ChartView
Asked by
Rickard
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Share this question
or