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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Hide AdornmentInfo on SfChart

Thread ID:

Created:

Updated:

Platform:

Replies:

121134 Nov 13,2015 07:18 AM UTC Nov 16,2015 01:08 PM UTC UWP 3
loading
Tags: SfChart
Jean Lapie
Asked On November 13, 2015 07:18 AM UTC

Hello,
I am currently using SfChart in a UWP application that display data, using a ColumnSerie for each day of the month.
I use ChartAdornmentInfo , to display the current value into the center of the corresponding column, rotated by 90 degrees.
When running on a mobile, it takes about 3 to 5 seconds to refresh the 30 columns, on desktop it runs really fast.
When I remove the AdornmentInfo, it runs faster on Mobile (the delay is acceptable).
So my question is : How can I speed up things? Or is there a way to hide the AdornmentInfo when on mobile (code behind or xaml) ? I tried to set the ShowLabel to false using an adaptive trigger but although the label does not display, it still tales time to render the chart.

Thank you a lot !

Here's the xaml :

  <charts:SfChart Grid.Row="1"
                        Margin="0,10,0,0"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center">

            <charts:SfChart.PrimaryAxis>
                <charts:DateTimeCategoryAxis x:Uid="Day" 
                                                 LabelFormat="dd"
                                             LabelsPosition="Outside"
                                                 Interval="2">
                </charts:DateTimeCategoryAxis>
            </charts:SfChart.PrimaryAxis>

            <charts:SfChart.SecondaryAxis>
                <charts:NumericalAxis Minimum="0"
                                      Header="KW"
                                      TickLineSize="10"/>
            </charts:SfChart.SecondaryAxis>

            <charts:ColumnSeries ItemsSource="{Binding DayPoints}"
                                 Interior="{StaticResource SystemControlBackgroundAccentBrush}"
                                 XBindingPath="Label"
                                 YBindingPath="Value">

                <charts:ColumnSeries.AdornmentsInfo>

                    <charts:ChartAdornmentInfo SegmentLabelContent="YValue"
                                               ShowLabel="True"
                                               HighlightOnSelection="True"
                                               AdornmentsPosition="TopAndBottom" >
                        <charts:ChartAdornmentInfo.LabelTemplate>
                            <DataTemplate>
                                <!--LabelTemplate for Segments.A TextBlock inside each Segments-->
                               <TextBlock Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Text="{Binding}" RenderTransformOrigin="0.5,0.5">
                                    <TextBlock.RenderTransform>
                                        <RotateTransform Angle="-90"/>
                                    </TextBlock.RenderTransform>
                                </TextBlock>
                            
                            </DataTemplate>
                        </charts:ChartAdornmentInfo.LabelTemplate>
                    </charts:ChartAdornmentInfo>
                </charts:ColumnSeries.AdornmentsInfo>
            </charts:ColumnSeries>

        </charts:SfChart>

Santhiya Arulsamy [Syncfusion]
Replied On November 13, 2015 12:19 PM UTC

Hi Jean,

Thanks for contacting Syncfusion support.

You can achieve your requirement by creating a separate view “DeviceFamily-Mobile” for mobile. We have prepared the sample for your reference. Please find the sample from the following location.

Sample: ColumnChart

Thanks,

Santhiya A.

Jean Lapie
Replied On November 13, 2015 01:20 PM UTC

Thank you,
I will have a lookt at this. But I'll have to maintain 2 views for nearly the same feature.
Is it possible to have a resource with the AdornmentInfo in xaml, and set it on the SfChart via code behind maybe, when needed ( = when not on mobile) ?
I think it would we easier to maintain only one view.

Best regards,


Rachel A [Syncfusion]
Replied On November 16, 2015 01:08 PM UTC

Hi Jean,

Thanks for the update.

We can define the ChartAdornmentInfo as resource in App.Xaml and set the adornment in code behind if the DeviceFamily is not Mobile as in the below code example.

[XAML]

   <Application.Resources>

        <chart:ChartAdornmentInfo x:Key="adornment" ShowLabel="True"></chart:ChartAdornmentInfo>
    </Application.Resources>

[C#]

if (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily != "Windows.Mobile")
                (chart1.Series[0] as ColumnSeries).AdornmentsInfo = App.Current.Resources["adornment"] as ChartAdornmentInfo;


Regards,
Rachel. A

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;