Large number of labels on X axis compressing the size of the chart

Thread is closed for posting
2 posts, 0 answers
  1. Misha
    Misha avatar
    2 posts
    Member since:
    Jan 2014

    Posted 21 Feb 2014 Link to this post

    I have telerik bar chart series which i am using as a control in pivot page. Height of the graph is defined as 246.
    <phone:PivotItem Header="Net Seat Adds" Margin="-18,20,40,1">
                    <StackPanel Orientation="Vertical" Margin="0.241,-12,-0.241,37" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto">
                            <CompositeTransform SkewX="0.952" TranslateX="2.483"/>
                        <telerikChart:RadCartesianChart Margin="12,0,0,0" x:Name="radChart1" Background="White" Height="246">
                                <telerikChart:CartesianChartGrid MajorLinesVisibility="Y" StripLinesVisibility="Y">

                                        <SolidColorBrush Color="#33666666"/>
                                        <SolidColorBrush Color="Transparent"/>
                                <telerikChart:CategoricalAxis  LineStroke="Black" ElementBrush="Black" LabelFitMode="Rotate">
                                <telerikChart:LinearAxis Minimum="0"
                            <telerikChart:BarSeries Background ="White" CategoryBinding="GeographyName"  ValueBinding="NSA_MTD" ItemsSource="{Binding}">
                                        <Rectangle Fill="Blue"/>
                            <telerikChart:LineSeries StrokeThickness="5" Stroke="DarkCyan" CategoryBinding="GeographyName"  ValueBinding="NSA_MTD" ItemsSource="{Binding}"/>
                        <!--<telerikPrimitives: LegendProvider="{Binding ElementName=chart}">
                                    <StackPanel Orientation="Vertical"/>
                                    <StackPanel Orientation="Horizontal">
                                        <Ellipse Fill="{Binding Fill}" Stroke="{Binding Stroke}"
                             StrokeThickness="1" Width="10" Height="10"/>
                                        <TextBlock Text="{Binding Title}" Foreground="{Binding Fill}"
                               Margin="10" FontStyle="Italic"/>
                        <StackPanel Orientation="Horizontal" Height="111" RenderTransformOrigin="0.499,0.622">
                            <Button x:Name="QTD" Content="QTD" Background="Black" Width="125" Margin="0,0,0,29" Padding="0" />
                            <Button x:Name="MTD" Content="MTD" Background="Black" Width="125" Margin="0,0,0,29" Padding="0"/>
                            <Button x:Name="YTD" Content="YTD" Background="Black" Width="125" Margin="0,0,0,29" Padding="0"/>

    But since I've more than 15 points on X axis i cannot see my graph as attached. Is it because of height being hardcoded? How can I dynamically adjust the graph?

    Second ques, I want to use the legend? Is there any API available for windows phone 8? I know there is primitive API available for windows 8.
  2. Rosy Topchiyska
    Rosy Topchiyska avatar
    586 posts

    Posted 24 Feb 2014 Link to this post

    Hi Misha,

    Thank you for contacting us.

    If I understand you correctly, the problem is that the height of the chart area is too small. As I see from the attached image, your labels are a bit long and take most of the space leaving almost no space for the series. The height of the chart control includes the chart area, the axes, the titles and the labels. The chart internally takes care of its content and since it has to provide space for the labels, the plot area gets very small. There is no way to set the height of the plot area only and hence you may consider setting larger height of the chart control or shortening the labels.

    As to the legend control, unfortunately, at this moment we do not provide such functionality. Here is a link to another thread in the forum with information about how you can implement your own legend control.

    I hope this was useful. Please, let us know if you have further questions.

    Rositsa Topchiyska
    If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
Back to Top