We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Using legend text in Adornments

I am trying to create a doughnut series graph without a legend (to save space), so I want to use the text that normally appears in the legend in the Adornments. I can get the XValue and YValue to appear, but not the text. How do I do this?

2 Replies

KV Karthikeyan V Syncfusion Team February 20, 2014 01:30 PM UTC

Hi Colin,

 

Thank you for using Syncfusion products.

 

We have analysed the reported query. You can achieve your requirement by setting the SegmentLabelContent property as LabelContentPath and overriding the Label Template in AdornmentInfo.

 

Code snippet [XAML]:

 

<syncfusion:DoughnutSeries.AdornmentsInfo>

                    <syncfusion:ChartAdornmentInfo ShowLabel="True" SegmentLabelContent="LabelContentPath" LabelTemplate="{StaticResource labelkey}"  />

                    </syncfusion:DoughnutSeries.AdornmentsInfo>

        <DataTemplate x:Key="labelkey">

                <Grid   >

                    <Grid.ColumnDefinitions>

                        <ColumnDefinition></ColumnDefinition>

                        <ColumnDefinition></ColumnDefinition>

                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>

                        <RowDefinition></RowDefinition>

                        <RowDefinition></RowDefinition>

                    </Grid.RowDefinitions>

                    <TextBlock  Text="XValue   |" Margin="5" Grid.Row="0" Grid.Column="0"></TextBlock>

                    <TextBlock  Text="{Binding Item.ProductName}" Margin="5" Grid.Row="0" Grid.Column="1"></TextBlock>

                    <TextBlock  Text="YValue   |" Grid.Row="1" Margin="5" Grid.Column="0"></TextBlock>

                    <TextBlock  Text="{Binding YData}" Margin="5" Grid.Row="1" Grid.Column="1"></TextBlock>

                </Grid>

            </DataTemplate>

 

We have prepared a sample based on this. You can download sample under the following location.

 

Please let us know if you require further assistance on this.

 

Thanks,

Karthikeyan V.



KV Karthikeyan V Syncfusion Team February 20, 2014 01:31 PM UTC


Loader.
Live Chat Icon For mobile
Up arrow icon