Unplanned
Last Updated: 14 Jun 2021 04:48 by ADMIN
Kristen
Created on: 31 May 2021 10:54
Category: Chart
Type: Bug Report
4
Chart: [iOS] GridLine Annotation for DateTime Axis is not visualized

Annotation (Grid line ) for the DateTimeContinuousAxis is not visualized on iOS. It works as expected on Android.

Add grid line annotation for the datetime axes. the grid lines are not visualized on iOS. 

<telerikChart:RadCartesianChart x:Name="chart">
    <telerikChart:RadCartesianChart.BindingContext>
        <local:ViewModel />
    </telerikChart:RadCartesianChart.BindingContext>
    <telerikChart:RadCartesianChart.HorizontalAxis>
        <telerikChart:DateTimeContinuousAxis LabelFitMode="Rotate" 
                                                x:Name="horizontal"/>
    </telerikChart:RadCartesianChart.HorizontalAxis>
    <telerikChart:RadCartesianChart.VerticalAxis>
        <telerikChart:NumericalAxis />
    </telerikChart:RadCartesianChart.VerticalAxis>
    <telerikChart:RadCartesianChart.Series>            
        <telerikChart:SplineSeries ValueBinding="Value"
                                    CategoryBinding="Date"
                                    ItemsSource="{Binding Data}"
                                    ShowLabels="True"
                                    />
    </telerikChart:RadCartesianChart.Series>
    <telerikChart:RadCartesianChart.Annotations>
        <telerikChart:CartesianGridLineAnnotation Stroke="#0E72F6" 
                                                StrokeThickness="2"
                                                Value="{Binding Threshold}"
                                                Axis="{x:Reference horizontal}">
            <telerikChart:CartesianGridLineAnnotation.DashArray>
                <x:Array Type="{x:Type x:Double}">
                    <x:Double>4.0</x:Double>
                    <x:Double>2.0</x:Double>
                </x:Array>
            </telerikChart:CartesianGridLineAnnotation.DashArray>
        </telerikChart:CartesianGridLineAnnotation>
    </telerikChart:RadCartesianChart.Annotations>
</telerikChart:RadCartesianChart>  


Workaround: 
Use CategoricalAxis.

4 comments
ADMIN
Didi
Posted on: 14 Jun 2021 04:48

Hi Kristen, 

Thank you for the provided additional information. 

I have tested the PlotandBand annotation, and on Android it works as expected. On iOS I cannot navigate to the SDK example when DateTimeAxis is used. I will update the feedback item accordingly: https://feedback.telerik.com/xamarin/1523473-chart-s-plot-band-annotation-for-date-time-axis-on-ios-throws-an-exception 

At all annotations do not work with a combination of DateTime axis in iOS native Chart. It seems this is a missing support when these annotations are used with DateTime Axes.  

I have escalated both issues to our dev team, still I cannot commit a time frame when a fix will be provided.

The only solution I can suggest is to use these annotations for iOS with Categorical and Numerical axes. But for the described scenario you want to achieve, I am afraid I cannot suggest any workaround. 

Let me know if I can assist with anything else.

Regards,
Didi
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Kristen
Posted on: 09 Jun 2021 21:48

Regarding the suggestion to use CategoricalAxis as a substitute for DateTimeAxis:

Our situation for using the GridLine or PlotBand annotation is we want to annotate the time span for which a user initiates a "recording" (or selection if you want to think of it that way).  When we first display the graph, we have no recording (selection), thus no annotations.  Using a DateTime axis allows us to set those "start" and "end" ViewModel thresholds to a valid value outside of our plot area - ie: DateTime.MaxValue - until the user actually defines the recording (selection), at which point we can set the "start" / "end" thresholds to DateTime values that are visible on the graph.

When substituting CategoricalAxis, we have no way of indicating "no annotations" until the user sets them; the "start" / "end" threshold values can't be null, but they have to be contained in the set of defined categories.  If we try to set them to something equivalent to DateTime.MaxValue, then that would have to become part of our graph data set - which we definitely don't want. Unless you know of a way to get around that problem.

I hope that makes sense. Please let me know if you need further clarification on why the CategoricalAxis workaround doesn't work for our use case.

Kristen
Posted on: 08 Jun 2021 20:08
Actually, to clarify, when I try the SDKBrower Chart PlotBandAnnotation example that has been modified to use a DateTimeContinuousAxis (with TemporalData) for the annotation, I can't even view the page. I'm using a simulator and don't see any errors - it just doesn't do anything.
Kristen
Posted on: 08 Jun 2021 19:33
Same issue exists for CartesianPlotBandAnnotation.  I assume that the underlying problem is the same for both GridLine and PlotBand annotations and hope that both would get fixed at the same time.