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

[Solved] barchart label doesn't show entirely

2 Answers 151 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.
Yiqing
Top achievements
Rank 1
Yiqing asked on 27 Aug 2013, 11:07 PM
Hi ,

I've used RadCatesianChart to dynamicly display some data, but the problem is that the label is not shown entirely sometimes. I attached the picture so you can refer to it. My XAML code is as below, I don't know where should I modify to make it work.


<Chart:RadCartesianChart x:Name="mybarchart" HorizontalAlignment="Left"
                                Height="420" Margin="140,55,20,20" Grid.Row="1"
                                VerticalAlignment="Top" Width="670"
                                PaletteName="DefaultDark"
                                Foreground="Black" FontWeight="ExtraBold" FontSize="25">
 
           <Chart:RadCartesianChart.VerticalAxis >
               <Chart:LinearAxis>
                   <Chart:LinearAxis.LineStyle>
                       <Style TargetType="Line">
                           <Setter Property="Stroke" Value="Black"/>
                           <Setter Property="StrokeThickness" Value="2"/>
                       </Style>
                   </Chart:LinearAxis.LineStyle>
                   <Chart:LinearAxis.LabelStyle>
                       <Style TargetType="TextBlock">
                           <Setter Property="FontSize" Value="20"/>
                           <Setter Property="FontWeight" Value="Bold"/>
                           <Setter Property="Foreground" Value="Black"/>
                           <Setter Property="Margin" Value="20"/>
                       </Style>
                   </Chart:LinearAxis.LabelStyle>
               </Chart:LinearAxis>
           </Chart:RadCartesianChart.VerticalAxis>
 
           <Chart:RadCartesianChart.HorizontalAxis>
               <Chart:CategoricalAxis>
                   <Chart:CategoricalAxis.LineStyle>
                       <Style TargetType="Line">
                           <Setter Property="Stroke" Value="Black"/>
                           <Setter Property="StrokeThickness" Value="2"/>
                       </Style>
                   </Chart:CategoricalAxis.LineStyle>
                   <Chart:CategoricalAxis.LabelStyle>
                       <Style TargetType="TextBlock">
                           <Setter Property="FontSize" Value="20"/>
                           <Setter Property="FontWeight" Value="Bold"/>
                           <Setter Property="Foreground" Value="Black"/>
                       </Style>
                   </Chart:CategoricalAxis.LabelStyle>
               </Chart:CategoricalAxis>
 
           </Chart:RadCartesianChart.HorizontalAxis>
           <Chart:RadCartesianChart.Behaviors>
               <Chart:ChartSelectionBehavior SelectionChanged="ChartSelectionBehavior_SelectionChanged_1"/>
           </Chart:RadCartesianChart.Behaviors>
           
           <Chart:BarSeries ItemsSource="{Binding barchart}" ShowLabels="True">
               <Chart:BarSeries.ValueBinding>
                   <Chart:PropertyNameDataPointBinding PropertyName="count"/>
               </Chart:BarSeries.ValueBinding>
               <Chart:BarSeries.CategoryBinding>
                   <Chart:PropertyNameDataPointBinding PropertyName="ProcessName"/>
               </Chart:BarSeries.CategoryBinding>
           </Chart:BarSeries>
       </Chart:RadCartesianChart>



Thanks,
Yiqing
<Chart:RadCartesianChart x:Name="mybarchart" HorizontalAlignment="Left"
                                Height="420" Margin="140,55,20,20" Grid.Row="1"
                                VerticalAlignment="Top" Width="670"
                                PaletteName="DefaultDark"
                                Foreground="Black" FontWeight="ExtraBold">
<Chart:RadCartesianChart x:Name="mybarchart" HorizontalAlignment="Left"
                                Height="420" Margin="140,55,20,20" Grid.Row="1"
                                VerticalAlignment="Top" Width="670"
                                PaletteName="DefaultDark"
                                Foreground="Black" FontWeight="ExtraBold">

2 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 28 Aug 2013, 08:26 AM
Hello Yiqing,

From the given picture, I can see that the labels of the Horizontal axis do not fit in the bounds of the chart. To avoid this, you can either set RadCartesianChart.ClipToBounds to false(thus the labels will be visible when they are out of the chart's bounds), or modify the CategoricalAxis.LabelStyle.
Also, I can see that the labels of the BarSeries do not fit in the PlotArea, so you can either set BarSeries.ClipToPlotArea to false(thus the labels will be visible although they are out of the PlotArea's bounds), or use the BarSeries.LabelDefinitions property and create a ChartSeriesLabelDefinition to change the appearance of the labels. More information about LabelDefinitions can be found in our online documentation - http://www.telerik.com/help/windows-8-xaml/radchart-labels-chartserieslabeldefinition.html.

I hope this helps. Let me know should you have any other questions.

 

Regards,
Ivaylo Gergov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Yiqing
Top achievements
Rank 1
answered on 28 Aug 2013, 11:46 PM
Hey Ivaylo,
That works perfect!!!

Thanks so much! I like telerik's technical support very much!

Yiqing
Tags
Chart for XAML
Asked by
Yiqing
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Yiqing
Top achievements
Rank 1
Share this question
or