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

Question about ChartAdornmentInfo SymbolTemplate

Hello,

I try to migrate my Telerik chart to Syncfusion in order to just use Syncfusion as library and I have some problems

I attached two files :
- Current.png - Syncfusion actual rendering
- Wanted.png - Telerik actual rendering

My problems :
- How to set the SymbolTemplate Width the same with as the ColumnSegment
- How to bind SymbolTemplate to ColumSegment DataContext
- How to add centered label to the colum segment ?



My code is :

<charts:SfChart Width="{x:Bind ViewModel.ChartWidth, Mode=OneWay}" AreaBorderThickness="0">
                        <charts:SfChart.SecondaryAxis>
                            <charts:NumericalAxis Visibility="Collapsed" ShowGridLines="False" />
                        </charts:SfChart.SecondaryAxis>
                        <charts:SfChart.PrimaryAxis>
                            <charts:CategoryAxis Visibility="Collapsed" ShowGridLines="False" />
                        </charts:SfChart.PrimaryAxis>
                        <charts:SfChart.Series>
                            <charts:ColumnSeries EnableAnimation="True" XBindingPath="Name" YBindingPath="Difference" ItemsSource="{x:Bind ViewModel.ChartParticipants, Mode=OneWay}">
                                <charts:ColumnSeries.CustomTemplate>
                                    <DataTemplate x:DataType="charts:ColumnSegment">
                                        <Canvas>
                                            <Rectangle Canvas.Left="{x:Bind RectX, Mode=OneWay}" Canvas.Top="{x:Bind RectY, Mode=OneWay}" Height="{x:Bind Height, Mode=OneWay}" Width="{x:Bind Width, Mode=OneWay}" Stretch="Fill" Fill="{x:Bind Item, Converter={StaticResource ParticipantToBrushConverter}}" />
                                        </Canvas>
                                    </DataTemplate>
                                </charts:ColumnSeries.CustomTemplate>
                                <charts:ColumnSeries.AdornmentsInfo>
                                    <charts:ChartAdornmentInfo AdornmentsPosition="Top" ShowLabel="True" ShowMarker="True" LabelPosition="Center" SegmentLabelContent="YValue">
                                        <charts:ChartAdornmentInfo.SymbolTemplate>
                                            <DataTemplate x:DataType="charts:ChartAdornmentInfo">
                                                <controls:ParticipantImage HasImage="False" Initial="GT" Height="{x:Bind  SymbolWidth, Mode=OneWay}" Width="{x:Bind SymbolWidth, Mode=OneWay}" />
                                            </DataTemplate>
                                        </charts:ChartAdornmentInfo.SymbolTemplate>
                                    </charts:ChartAdornmentInfo>
                                </charts:ColumnSeries.AdornmentsInfo>
                            </charts:ColumnSeries>
                        </charts:SfChart.Series>
                       
                    </charts:SfChart>

Thanks in advance,
Geoffrey

Attachment: Desktop_3be4e67f.zip

1 Reply

DA Devi Aruna Maharasi Murugan Syncfusion Team September 30, 2016 01:21 PM UTC

Hi Geoffery, 
  
Thanks for contacting Syncfusion Support. 
  
By default, the chart adornment symbol will render within the segment area. However, we have achieved your requirement by using the scatter series. 
  
We have prepared a demo sample for your reference and it can be downloaded from below link, 
  
  
Regards, 
Devi 




Loader.
Live Chat Icon For mobile
Up arrow icon