Wrong DateTime on x-axis with ItemMapping on XCategory

6 posts, 0 answers
  1. Robert
    Robert avatar
    23 posts
    Member since:
    Jun 2012

    Posted 05 Jul 2012 Link to this post

    Hi there,

    I'm trying to get a consistent stepline visualization of data consisting of a DateTime and a value. First, I tried the mapping like that:

    sm.ItemMappings.Add(New ItemMapping("dt", DataPointMember.XValue))
    sm.ItemMappings.Add(New ItemMapping("value", DataPointMember.YValue))

    That worked, but only as long as I didn't use zooming and scrolling - I always ended up with "No Data Series" for no obvious reasons - I guess the chart doesn't interpolate any missing values. This is bad and annoying. Try to explain a customer why he can't zoom into an area when he actually clearly sees that there IS data to see in an earlier zoom level.

    When I changed the mapping from XValue to XCategory things got better, scrolling and zooming worked perfectly without ever showing me a "No Data Series". But there's another problem with that: the datasource consists of appr. 10.000 datapoints which I display with a samplingThreshold of 30. So in the first (unzoomed) view of the chart, no actual "real" data is shown, and all the dates resp. labels on the x-axis show the same datetime. When I zoom in several times until I dig down to the real data, where the sampling doesn't apply, the correct datetimes show up.

    Although the latter way seems to be the more promising approach on the first look, it at the same time denies using multiple series in one chart, as the underlying data of the different series isn't temporally synchronized. So I would have to use an ItemMapping via XValue, but then zooming and scrolling doesn't work properly.

    PS: I know that this strange behaviour is caused by the charts underlying filtering techniques for zooming and scrolling, and "technically" it may behave as expected - but from a user's point of view this behaviour is counter-intuitive and strange. It would be great if you could provide a solution for that dilemma.

    Best regards,
    Robert
  2. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 10 Jul 2012 Link to this post

    Hello Robert,

    Whether you are using XCategory or XValue, really depends on what type of series you are using and what do you want to visualize. For example, for bar series it is more appropriate to use XCategory, because you are displaying data for a specific category, or for a specific time like Day 1, Day 2 and so on. If you use XValue, it means that you do not have only Day 1, Day 2 and so forth, but you could also have Day 1.023, Day 1.072 i.e. infinitely many "days" between Day 1 and Day 2.

    The problem with the zooming is that you are zooming in too much and  you reach a value like Day 1.000002, where apparently you do not have any data points. To avoid this you can set the MinZoomRange which specifies the minimal range that can be visible in the ChartArea. For example, a minimal range of 0.1 will display 10% of the whole series (the series will get zoomed 10x). You can set any value rangin between 0 and 1.
    this.radChart.DefaultView.ChartArea.ZoomScrollSettingsX.MinZoomRange = 0.1;

    In you case with the many datapoints, you need the XValue. To avoid the "No data" message all you need to do is to set the MinZoomRange. I hope this solves you dillema.

    Regards,
    Rosko
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Robert
    Robert avatar
    23 posts
    Member since:
    Jun 2012

    Posted 11 Jul 2012 Link to this post

    Thanks for your reply! I do understand now why it doesn't work as expected. But somehow it still seems strange: when I zoom into a line series with, let's say x(10:32:00 a.m.)=10 and x(10:32:10 a.m.)=10 in the TimeBar, so that the selection starts at, let's say 10:32:02 and ends at 10:32:08, there is no data in that interval. Still I would like to see a constant linear line in the detail chart, even if there's no data in that specific interval. It would be great if that was possible as it looks & feels way more natural.

    Regards,
    Rob
  5. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 13 Jul 2012 Link to this post

    Hi Robert,

    I regret to tell you that the only way to avoid this issue is to set the MinZoomRange. The better improved RadChartView behaves the way you like, but for the time being, it lacks some of the features of RadChart, like the integration with TimeBar. You need to do this manually. I have attached a sample project where you can see how it is done. I hope it helps.

    Rosko
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Robert
    Robert avatar
    23 posts
    Member since:
    Jun 2012

    Posted 13 Jul 2012 Link to this post

    Thanks for your answer and the sample project, I will have a deeper look at it at the weekend. The only reason I do not use RadChartView at the moment is its lack of a stepLine series, which is essential for visualizing our kind of industrial sensor data. I alreade tried to simulate a stepLine by adding additional datapoints to a standard lineSeries - it works but results in poor performance as it doubles the amount of data. Besides that, it's not very elegant. Are you planning to implement the stepLine series to RadChartView in the foreseeable future?

    Have a nive weekend!
    Robert
  7. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 18 Jul 2012 Link to this post

    Hi Robert,

    I regret to tell you that for the time being a step line series is not planned to be implmented.

    All the best,
    Rosko
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner