Articles in this section
Category / Section

How to display the labels inside segments in WPF Chart (SfChart)?

3 mins read

This article explains how to place labels inside the column segments using ChartAdornmentWPF Chart (SfChart) series adornments are used to display values associated with a ChartSegment. The ChartAdornmentsInfo class is used to display chart series adornments. These adornments can be customized through properties like SegmentLabelContentConnectorLineStyleSymbolTemplate, and LabelTemplate. The AdornmentsPosition property determines the positioning of adornments within the series. Below is a code example demonstrating the use of the LabelTemplate property to display labels inside chart segment.


XAML

<Syncfusion:ColumnSeries.AdornmentsInfo>
    <Syncfusion:ChartAdornmentInfo SegmentLabelContent="LabelContentPath" ShowLabel="True" AdornmentsPosition="TopAndBottom" >
         <Syncfusion:ChartAdornmentInfo.LabelTemplate>
              <DataTemplate>
                   <!--LabelTemplate for Segments.A TextBlock inside each Segments--> 
                   <TextBlock Foreground="White" FontSize="25" FontWeight="Bold" Text="{Binding Item.CompanyName}" RenderTransformOrigin="0.5,0.5">
                        <TextBlock.RenderTransform>
                             <RotateTransform Angle="-90"></RotateTransform>
                        </TextBlock.RenderTransform>
                   </TextBlock>
              </DataTemplate>
         </Syncfusion:ChartAdornmentInfo.LabelTemplate>
    </Syncfusion:ChartAdornmentInfo>
</Syncfusion:ColumnSeries.AdornmentsInfo>

 Output:


WPF Chart displays Label Segment


Conclusion

I hope you enjoyed learning about how to display the labels inside segments in WPF Chart (SfChart)?.

You can refer to our WPF Chart’s feature tour page to know about its other groundbreaking feature representations. You can also explore our   WPF Chart documentation to understand how to present and manipulate data.


For current customers, you can check out our WPF components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our WPF Chart and other WPF components.


If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied