Max and min for DateTimeCategoricalAxis

2 posts, 0 answers
  1. Rickard
    Rickard avatar
    5 posts
    Member since:
    Jun 2012

    Posted 13 Sep 2013 Link to this post

    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
  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 18 Sep 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top