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

Data points on time bar do not seem to line up

3 Answers 127 Views
TimeBar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Patrick
Top achievements
Rank 1
Patrick asked on 13 Feb 2012, 11:02 PM
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>

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 16 Feb 2012, 01:47 PM
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 >>
0
Ben
Top achievements
Rank 1
answered on 14 Jun 2012, 09:51 AM
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
0
Yavor
Telerik team
answered on 19 Jun 2012, 08:12 AM
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 >>

Tags
TimeBar
Asked by
Patrick
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Ben
Top achievements
Rank 1
Share this question
or