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

RadSparkLine has different visualization for different query results

3 Answers 73 Views
Sparkline
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 04 Oct 2011, 04:25 PM
I'm using a RadTimeBar in combination with a RadSparkline to choose the items that appear in a RadGridView. This is my issue...

I have a collection of objects of type "ParsTask" that I pull for a user and I use that collection to pull tasks that are over due with this code:

         OverdueTasks.Clear()
       Dim overDueList As IEnumerable(Of ParsTask) = From t As ParsTask In TaskList Where t.End < DateTime.Today And (t.TaskStatus = "Opened" Or t.TaskStatus = "Pending")
 
       For Each p As ParsTask In overDueList
           OverdueTasks.Add(p)
       Next
 
       OverDueTasksEarliestDate = GetEarliestDate(OverdueTasks) 'gets earliest date in results
       OverDueTasksLatestDate = GetLatestDate(OverdueTasks) 'gets latest date in results
       TimeBarOverDueSelectionStart = OverDueTasksEarliestDate
       TimeBarOverDueSelectionEnd = OverDueTasksLatestDate

And with this code my bar/sparkline looks like the capture1.png that is attached. It has a line that goes up and down, which appears "normal", but it also has a line that starts out on the top that is thick and thins out at the top. So it looks like there are two lines appearing in my sparkline.

When I add this code to the linq query:

Dim overDueList As IEnumerable(Of ParsTask) = From t As ParsTask In TaskList Where t.End < DateTime.Today And (t.TaskStatus = "Opened" Or t.TaskStatus = "Pending" Or t.TaskStatus = "OnHold")

The only difference is: t.TaskStatus = "OnHold", but I get only one sparkline - the one that goes up and down and looks "normal". Like capture2.png that is attached. There is only a difference of 3 extra objects with this additional query parameter.

Can you tell me why this is happening?

The xaml for the timebar/sparkline is here:

<telerik:RadTimeBar telerik:StyleManager.Theme="Windows7"
Name="timebarOverdue"
Height="130"            
PeriodStart="{Binding Source={StaticResource MainViewModel}, Path=OverDueTasksEarliestDate, Mode=TwoWay, UpdateSourceTrigger=Default}"
PeriodEnd="{Binding Source={StaticResource MainViewModel}, Path=OverDueTasksLatestDate, Mode=TwoWay, UpdateSourceTrigger=Default}"
SelectionStart="{Binding Source={StaticResource MainViewModel}, Path=TimeBarOverDueSelectionStart, Mode=TwoWay, UpdateSourceTrigger=Default}"
SelectionEnd="{Binding Source={StaticResource MainViewModel}, Path=TimeBarOverDueSelectionEnd, Mode=TwoWay, UpdateSourceTrigger=Default}"
MinSelectionRange="1"
MaxSelectionRange="7"
IsSnapToIntervalEnabled="True">
 
<telerik:RadTimeBar.Intervals>
<telerik:YearInterval />
<telerik:MonthInterval />
<telerik:WeekInterval />
<telerik:DayInterval />
</telerik:RadTimeBar.Intervals>
 
<telerik:RadAreaSparkline
Name="AreaSparkLine1"
Height="70"
Margin="0,3"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ItemsSource="{Binding Source={StaticResource MainViewModel}, Path=OverdueTasks, Mode=TwoWay, UpdateSourceTrigger=Default}"
XValuePath="End" YValuePath="EstDuration"
Background="#FF5A6378"
PositiveAreaFill="White"
AxisOriginValue="0">
</telerik:RadAreaSparkline>
</telerik:RadTimeBar>



3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 05 Oct 2011, 12:33 PM
Hello Barry,

Thank you for your detailed report! We might need a sample of your data and also the configuration of the timebar (period start/end, visible period start/end) that causes the behavior you mentioned. This additional information will help us better understand what's going on.

Kind regards,
Yavor
the Telerik team

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

0
Barry
Top achievements
Rank 1
answered on 05 Oct 2011, 06:26 PM
I made a test app with just the timebar and sparkline so I could show you how it makes funny looking lines all over the place and in that application I added some test data (just dates and doubles) for the sparkline. It turns out that the sparkline looked fine... so I did some more fooling around and noticed that my test data was sorted by date and my real data was not. Once I sorted my real data by date and fed it to the sparkline everything looked fine.

In my real data, sometimes the collections were sorted by date (by chance) and sometimes they were not, so the sparkline ended up looking fine sometimes and funky other times, but now everything looks good all the time because I sort the collection by date before I give it to the sparkline.

I'm a little upset about this because I don't see anywhere that says that the data has to be sorted by date before being passed to the sparkline. I read this over and over trying to figure out what was wrong, but nothing is said about sorting your collection by date: http://www.telerik.com/help/silverlight/radsparkline_overview.html. I spent several days banging my head against a wall and all it would have taken is one line in your instructions telling me to sort my CLR objects by the date that I want to use in the sparkline. Please add this to your instructions. I just figured that the control would automatically put the first date first... instead of the first object first, I never thought about the date needing to be sorted.
0
Yavor
Telerik team
answered on 06 Oct 2011, 12:05 PM
Hi Barry,

Currently the RadSparklines don't sort their data. The data is displayed in the order in which the items were added to the collection. I will make sure that this will be noted in the sparklines documentation. Thank you for your feedback and please excuse us for the inconvenience caused!

Best wishes,
Yavor
the Telerik team

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

Tags
Sparkline
Asked by
Barry
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Barry
Top achievements
Rank 1
Share this question
or