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

How to make sparklines

1 Answer 95 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Robert
Top achievements
Rank 1
Robert asked on 17 Dec 2012, 10:28 PM
I want to include a "sparkline" in my application.  In other tools (SSRS and Visifire) I do this by making a line chart with no axis labels, and make it very narrow from top-to-bottom. 

I am trying the same in Telerik Chart for XAML, and I can make the chart, but I cannot seem to get the vertical size "short enough".  I feel maybe it is my own lack of skills in XAML, but I really would appreciate a hint.

Below is a snippit from my overall XAML.  The code below is inside a table.  I'm trying all types of guesses how to get the chart to fit a MaxHeight of "30".  I've tried a lot of ways (like using MaxHeight, and putting a grid around it with a RowDefinition Height=30, etc.).  

The result of this is that the chart seems to be drawn at the height of the enclosing table's row (60), and I end up with the chart being "clipped" so I can see only the top 30 pixels of it.  What I want is the entire chart drawn with a height of 30.

I can repro a simple example if needed, but I am hoping this is something someone else has done and can give me some advice how to accomplish it?

 

<Border Style="{StaticResource ChartCellRightBorder}" Grid.Row="1" Grid.Column="7">

<Grid>

<Grid.RowDefinitions>

<RowDefinition Height="30"/>

</Grid.RowDefinitions>

<telerik:RadCartesianChart x:Name="areaChart2" PaletteName="DefaultLight" MaxHeight="30">

<telerik:RadCartesianChart.VerticalAxis>

<telerik:LinearAxis Visibility="Collapsed"/>

</telerik:RadCartesianChart.VerticalAxis>

<telerik:RadCartesianChart.HorizontalAxis>

<telerik:CategoricalAxis />

</telerik:RadCartesianChart.HorizontalAxis>

<telerik:LineSeries ItemsSource="{Binding}" >

<telerik:LineSeries.CategoryBinding>

<telerik:PropertyNameDataPointBinding PropertyName="Category"/>

</telerik:LineSeries.CategoryBinding>

<telerik:LineSeries.ValueBinding>

<telerik:PropertyNameDataPointBinding PropertyName="Value"/>

</telerik:LineSeries.ValueBinding>

</telerik:LineSeries>

</telerik:RadCartesianChart>

</Grid>

</Border>

1 Answer, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 18 Dec 2012, 01:02 PM
Hi Robert,

Thank you for using our RadControls for Windows 8!

Our RadChart has a MinHeight="100" by default so in order to change its Height to 30 you need to change its MinHeight to 30 or less.

I hope this helps. Let me know if I can assist you any further.

 

Regards,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Chart for XAML
Asked by
Robert
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Share this question
or