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

RadColumnSparkline: Declarative Example ?

4 Answers 140 Views
Sparkline
This is a migrated thread and some comments may be shown as answers.
Guido
Top achievements
Rank 1
Guido asked on 11 Mar 2011, 03:45 PM
Hi all,
can you give an example for binding a RadColumnSparkline to data ? I got the RadLinearSparkline working, but the RadColumnSparkline seems to need a different data format.

Thanks in advance
Guido

4 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 16 Mar 2011, 10:44 AM
Hi Guido,

RadColumnSparklines can be configured in the same way as RadLinearSparkline, RadAreaSparkline, etc. Your markup can look like this:

<telerik:RadLinearSparkline ItemsSource="{Binding Data}" XValuePath="TimeStamp" YValuePath="Value" />
<telerik:RadColumnSparkline ItemsSource="{Binding Data}" XValuePath="TimeStamp" YValuePath="Value" />
As you can see except for the name of the control all other attributes are the same.

Please take e look on this example in our online demos.


Kind regards,
Yavor Ivanov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Guido
Top achievements
Rank 1
answered on 16 Mar 2011, 12:03 PM
Hi Yavor,
thank you for your answer. You told me exactly what I'm hoping for. But unfortunately it currently doens't work in my scenario.
Perhaps you'll see the reason.

you were referring to Silverlight examples, I'm using WPF. This might not make a difference, but it could be one reason, why it's not working.

I use exactly the same markup for RadColumn and RadLinearSparkline:

                            
<telerik:RadColumnSparkline<BR>                                
x:Name="PART_SparkbarControl"<BR>                                
telerik:StyleManager.Theme="Office_Blue"<BR>                                
ShowAxis="False"<BR>                                
Visibility="Visible"<BR>                                
ItemsSource="{Binding 
ActualMeasure}"<BR>                                
XValuePath="Cost"<BR>                                
YValuePath="UnitCost"<BR>                                
HorizontalAlignment="Left"<BR>                                
Margin="0"<BR>                                
VerticalAlignment="Top" 
<BR>                                
/><BR>                               
<telerik:RadLinearSparkline<BR>                                
x:Name="PART_SparklineControl"<BR>                                
ShowAxis="False"<BR>                                
Visibility="Visible"<BR>                                
ItemsSource="{Binding 
ActualMeasure}"<BR>                                
XValuePath="Cost"<BR>                                
YValuePath="UnitCost"<BR>                                
ShowHighPointIndicators="True"<BR>                                
ShowLowPointIndicators="True"<BR>                                
HorizontalAlignment="Left"<BR>                                
Margin="0"<BR>                                
VerticalAlignment="Top"<BR>                               
/><BR>                           

The LinearSparkline is showing, the The ColumnsSparkline is not.
What could be the problem ?

Best regards,
Guido
0
Accepted
Yavor
Telerik team
answered on 18 Mar 2011, 11:19 AM
Hi Guido,

I have attached a runnable version of your code that demonstrates how to load your sparklines with sample data. Perhaps the problem could be in the data that you are loading your sparklines with.

Best wishes,
Yavor Ivanov
the Telerik team
0
Guido
Top achievements
Rank 1
answered on 30 Mar 2011, 11:18 AM
You are right, both controls can display the same data.
My misconception was, that I expected spark controls to accept timestamps as x-values (as other chart controls do). But that was where I was wrong.
Now I bind the X-values to integers and everything works as expected.
Thanks.
Tags
Sparkline
Asked by
Guido
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Guido
Top achievements
Rank 1
Share this question
or