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

Accessibility for SfChart?

Is it possible for the SfChart to hook into the Accessibility features of the phone?

Ideally we need to be able to tap on an item on a chart and use VoiceOver (iOS) and TalkBack (Android) to read the data for the item/point.

Regards,

James

3 Replies

BK Bharathiraja K Syncfusion Team June 25, 2019 02:33 PM UTC

Hi James 
 
Greetings from Syncfusion. This functionality will work by default for the controls like Grid, NavigationDrawer which uses views like TextView in that. But this is not applicable for controls like Chart which uses canvas drawing for light weight rendering. For announcing some texts like data points in it once you touch (like the default framework controls when TalkBack is enabled), we can use ContentDescription or AnnounceForAccessibility on property changing, we have prepared sample to announce selected data point by invoke selected changing event. The sample will be downloaded from below link. 
 
 
[MainActivity.cs] 
        private void Forms_ViewInitialized(object sender, Xamarin.Forms.ViewInitializedEventArgs e) 
        { 
            if (e.NativeView is SfChart) 
            { 
                sfChart = sender as Syncfusion.SfChart.XForms.SfChart; 
                var dataPoints = ((ChartSeries)(e.NativeView as SfChart).Series[0]).ItemsSource as ObservableCollection<Syncfusion.SfChart.XForms.ChartDataPoint>; 
                for (int i = 0; i < dataPoints.Count; i++) 
                { 
                    var data = dataPoints[i] as Syncfusion.SfChart.XForms.ChartDataPoint; 
                    var xValue = data.XValue.ToString(); 
                    var yValue = data.YValue.ToString(); 
                    voiceText += xValue + yValue; 
                } 
                   (e.NativeView as SfChart).SelectionChanged += MainActivity_SelectionChanged; 
            } 
        } 
 
        private void MainActivity_SelectionChanged(object sender, SfChart.SelectionChangedEventArgs e) 
        { 
            (sender as SfChart).AnnounceForAccessibility(voiceText); 
        } 
 
Please let us know, if you have any other queries on this.  
 
Regards, 
Bharathi. 



JL James Lavery June 27, 2019 01:53 PM UTC

Thank you - I have downloaded and run the sample on an Android device, and I cannot get the MainActivity_SelectionChanged handler to trigger, with TalkBack enabled. The TalkBack system is preventing items from being selected.

Am I missing something on my TalkBack settings, or is there something else we need to do in the code?

I have not yet managed to test it a physical iOS device.

Regards,

James


RA Rachel A Syncfusion Team July 2, 2019 10:08 AM UTC

Hi James, 
 
As we have mentioned before, the chart does not contain any visual elements. We used canvas drawing for light weight rendering. So, based on the device configuration it may or may not allow chart to perform its behaviors. The talk back settings are differing from one device to another, we have checked with multiple device, some of the device allows segment selection in double tap, some of them allowed in triple tap. And the one plus device allows selection by double tap followed by one single tap.  
 
Also, we have faced the same reported problem in Moto G(5s) – V 7.1, the device does not allow the chart to perform its selection behavior it is due to the device configuration, but it works fine in most of the device. Please find the validated sample, video from below link.  
 
 
Refer the below blogs for more details about this.  
 
Regards, 
Rachel.  


Loader.
Live Chat Icon For mobile
Up arrow icon