HorizontalLineAnnotation cannot display full value

Hi, pls help me to find the way to show full value on this kind of Annotation on Y-Axis.
The value should be 1.2101, but it always displays as 2 decimal

<syncfusion:HorizontalLineAnnotation  
                    Name="CurrentPrice" 
                    ShowAxisLabel="True" 
                    HorizontalTextAlignment="Center"
                    >

this.CurrentPrice.Y1 = Convert.ToDecimal("1.2101");



1 Reply

DS Durgadevi Selvaraj Syncfusion Team January 3, 2018 12:06 PM UTC

Hi Hung, 
 
Thanks for contacting Syncfusion Support. 
 
We have analyzed the reported problem (axis label in annotation displaying with 2 decimal precision always) since we have internally round off the corresponding axis value with 2 decimal precision. However, we can resolve this problem by binding actual axis value directly to the Text in TextBlock of AxisLabeltemplate . Please refer the below codes, 
 
Code Snippet[XAML] 
 
<chart:SfChart.Annotations> 
      <chart:HorizontalLineAnnotation   
                    Name="CurrentPrice"  
                    ShowAxisLabel="True"  
                    Y1="1.2101" 
                    HorizontalTextAlignment="Center" 
                    > 
                    <chart:HorizontalLineAnnotation.AxisLabelTemplate> 
                        <DataTemplate> 
                            <Border   CornerRadius="2"> 
                                <Grid Background="#1E90FF" Width="40"  MinHeight="20"> 
                                    <TextBlock Text="{Binding Y1, ElementName=CurrentPrice}" Padding="2" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"></TextBlock> 
                                </Grid> 
                            </Border> 
                        </DataTemplate> 
                    </chart:HorizontalLineAnnotation.AxisLabelTemplate> 
       </chart:HorizontalLineAnnotation> 
</chart:SfChart.Annotations> 
 
Please find the output screenshot below, 
 
Please find the reference sample from below link, 
 
Regards,  
Durgadevi S 


Loader.
Up arrow icon