Sampling with DateTime in the XAxis

2 posts, 0 answers
  1. Dunya
    Dunya avatar
    1 posts
    Member since:
    May 2012

    Posted 04 May 2012 Link to this post

    Hello,

    I am trying to draw a graph with possibly many thousands of data points, bound using the SeriesMapping/ItemMapping method. Both axes are bound as Value type data points (XValue & YValue).

    My problem is that when sampling is turned on, my X axis displays values beginning from 0 in DateTime (31.12.1899, 1.1.1900... etc). When I turn off sampling (or zoom in enough that there are less data points than the sampling threshold), the graph draws just fine with tooltips etc working perfectly, but when it is turned on, the X axis values and tooltips are broken. The data points show up where they should though.

    I've tried setting IsDateTime on and off (which should only be necessary for DataPoint binding anyway, according to the docs). IsZeroBased for XAxis is set to false as well. I also tried setting the AxisX.MinValue and MaxValue properties manually (which I believe shouldn't work when AutoRange isn't set to false) to no avail.

    Any solutions?
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 08 May 2012 Link to this post

    Hi Dunya,

    1. X axis displays values beginning from 0 in DateTime
    I was not able to reproduce this. I created a simple project and it plots the dates correctly. I have attached the project to this post (also included a snapshot of the output, look for attachment XAxisSampleDateTime1), so that you can test it and see if you get the same results. If you get correct results with the sample project I have provided and errenous results with your project I suggest that you compare the code to find the differences and hopefully discover what causes the incorrect labels' text.

    When data is sampled a few data items are clustered (summarized) into a single data point. This is the reason the DataItem of the data point is null, which results in invalid tooltips. I can suggest that you use the Custom Sampling Functions to be able to show proper information in the tool tips. I have also attached a project that demonstrates this(attachment CustomSamplingFunctionsAndToolTips) to get you started.

    I hope the above is of help.  

    Greetings,
    Petar Marchev
    the Telerik team

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

  3. DevCraft banner
Back to Top