Data points on time bar do not seem to line up

4 posts, 0 answers
  1. Patrick
    Patrick avatar
    1 posts
    Member since:
    Mar 2009

    Posted 13 Feb 2012 Link to this post

    Team, I am using the time bar to visualize some data but for some reason, the data points do not line up.
    My data looks like
    rundte             overallVulnCount   overallVulnRemediated gap
    2012-02-06 00:00:00 81577       16370                                           65207
    2012-02-07 00:00:00 86131      22833                                           63298
    2012-02-08 00:00:00 86131      22833                        63298
    2012-02-09 00:00:00 86131   22833   63298
    2012-02-10 00:00:00 86131   22833   63298
    2012-02-11 00:00:00 86131   22833   63298
    2012-02-12 00:00:00 86131   22833   63298
    2012-02-13 00:00:00 86131   22833   63298


    but when I link the data, I have data points showing up in january of 2012. and when I compress the timebar, those dates do not go away.

    here is my binding, class and code.
    DateTime nudte = (DateTime)item.rundte;
                    trenditems nutrnd = new trenditems();
      
      
      
      
                    if (nudte < startDate)
                    {
                        startDate = nudte.AddDays(-7);
                    }
                    int totalvulncount = (int)item.overallVulnCount;
                    int totalremcount = (int)item.overallVulnRemediated;
                    nutrnd.itemdte = nudte;
                    nutrnd.remainingcnt = totalremcount;
                    nutrnd.overallcount = totalvulncount;
                    nutrnd.gapcount = (int)item.gap;
      
                    trndlist.Add(nutrnd);
      
                    if (totalremcount > totalvulncount)
                    {
                        bool itemfail = true;
                    }
      
                    totalvuln.Add(nudte, totalvulncount);
                    totalremediated.Add(nudte, totalremcount);
      
      
      
                }
      
      
      
      
                timeSelector.PeriodStart = startDate.AddMonths(-2);
                timeSelector.PeriodEnd = endDate;
                timeSelector.VisiblePeriodStart = endDate.AddMonths(-1);
                timeSelector.VisiblePeriodEnd = endDate;
      
                timeSelector.SelectionStart = endDate.AddDays(-14);
                timeSelector.SelectionEnd = endDate;
      
      
      
                timeSelectSpark.XValuePath = "itemdte";
                timeSelectSpark.YValuePath = "gapcount";
                timeSelectSpark.ItemsSource = trndlist;


    Here is the data class I am using
    public class trenditems
    {
        public DateTime itemdte { get; set; }
        public int overallcount { get; set; }
        public int remainingcnt { get; set; }
        public int gapcount { get; set; }
        public trenditems()
        {
        }
    }

    And here is the xaml
    <telerik:RadTimeBar Grid.Row="0"
                                           Name="timeSelector"
                                           Height="150"
                                           VerticalAlignment="Top"
                                           Margin="6"
                                           IsSnapToIntervalEnabled="True">
                           <telerik:RadTimeBar.Intervals>
                               <telerik:MonthInterval />
                               <telerik:WeekInterval />
                               <telerik:DayInterval />
                           </telerik:RadTimeBar.Intervals>
                          
                                
                               <telerik:RadLinearSparkline Name="timeSelectSpark"
                                                           Margin="5,75,5,5"
                                                           ShowHighPointIndicators="True"
                                                           Foreground="Red"
                                                           BorderBrush="Red"
                                                           OpacityMask="Red"
                                                           FirstPointBrush="Red"
                                                           AxisStroke="Red"
                                                           LineStroke="Red"
                                                           
                                                           ShowMarkers="True"
                                                           AutoRange="False" />
                           
                       </telerik:RadTimeBar>
  2. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 16 Feb 2012 Link to this post

    Hi Patrick,

    RadTimeBar is a content control and currently it doesn't know much about its content. That's why when you have a sparkline it is up to you to match the data that the sparkline shows with the period the timebar shows. You can try setting manual range on your sparkline. This way the sparkline will use your range on the X-axis and the gap will be displayed. Manual range is set first by disabling AutoRange and then by setting these properties: MinXValueMaxXValueMinYValueMaxYValue

    Greetings,
    Yavor
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Ben
    Ben avatar
    2 posts
    Member since:
    May 2011

    Posted 14 Jun 2012 Link to this post

    Hi Yavor,

    Could you provide me with an example on how you manually set the range on a sparkline?
    The properties MinXValueMaxXValueMinYValueMaxYValue got me puzzled.
    I can't get my sparklines to appear.

    Thanks,
    Ben
  5. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 19 Jun 2012 Link to this post

    Hello Ben,

    I have created for you a small demo application that shows how you can use these properties. Each one of them is auxiliary, so if you want to configure the range on the X you don't need to specify range for the Y.

    If you have more questions don't hesitate to contact us!

    Greetings,
    Yavor
    the Telerik team

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

Back to Top