Version

Callout Layer

Topic Overview

Purpose

This topic provides information about the callout layer used for touch interactions. It describes the properties of the callout layer and provides an example of its implementation.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

The XamDataChart control requires a data object model to be mapped to control’s DataContext property. This article will provide a simple data object model but you can create your own and use it with this sample code instead.

This topic explains various types of Category Series in the XamDataChart control.

In this topic

This topic contains the following sections:

Overview

Callout Layer Overview

The CalloutLayer displays annotations from existing or new data on the XamDataChart control. The annotations appear next to the given data values in the datasource.

The callout layer supports being used with all series types in the XamDataChart.

Use the callout annotations to display additional information, such as notes or specific details about datapoints, that you would like to point out to your users.

You can configure the callouts to target a specific series if you want to have multiple callouts layers present with different configurations. This can be done be setting the TargetSeries property.

Preview

The following image is a preview of the XamDataChart control with the CalloutLayer added.

datachart calloutlayer xamarin.png

Properties

Callout Layer Summary

The following table summarizes the properties of the CalloutLayer layer.

Property Name Property Type Description

String

The member path in the data source for what will be displayed in the annotation on the chart.

String

The member path in the data source for the x-value of the annotation.

String

The member path in the data source for the y-value of the annotation.

Boolean

Set to true if callouts will be offset based on collision resolution. True by default.

Example

Following is the code used in the screenshot above.

In XAML:

<ig:XamDataChart x:Name="DataChart" IsHorizontalZoomEnabled="True" IsVerticalZoomEnabled="True" >
    <ig:XamDataChart.Axes>
        <ig:CategoryXAxis x:Name="xAxis" ItemsSource="{Binding USA}" Label="Year" Interval="1"/>
        <ig:NumericYAxis x:Name="yAxis" MinimumValue="0" Title="Population (M)" LabelLocation="OutsideRight"/>
    </ig:XamDataChart.Axes>
    <ig:XamDataChart.Series>
        <ig:LineSeries ValueMemberPath="ValueInMln" x:Name="SeriesUSA"
                           BindingContext="{Binding USA}"
                           ItemsSource="{Binding}"
                           Title="{Binding Country}"
                           XAxis="{x:Reference xAxis}"
                           YAxis="{x:Reference yAxis}" >
        </ig:LineSeries>
        <ig:LineSeries ValueMemberPath="ValueInMln" x:Name="SeriesRUS"
                           BindingContext="{Binding RUS}"
                           ItemsSource="{Binding}"
                           Title="{Binding Country}"
                           XAxis="{x:Reference xAxis}"
                           YAxis="{x:Reference yAxis}" >
        </ig:LineSeries>
        <!-- these two callout layers are targeting ItemsSource for each series: -->
        <ig:CalloutLayer
                CollisionChannel="MultipleCallouts"
                TargetSeries="{x:Reference SeriesUSA}"
                ItemsSource="{Binding CalloutsUSA}"
                IsAutoCalloutBehaviorEnabled="False"
                UseValueForAutoCalloutLabels="False"
                XMemberPath="DataItem.Index"
                YMemberPath="DataItem.ValueInMln"
                LabelMemberPath="Label"
                ContentMemberPath="Content"
                CalloutLeaderBrush="{Binding Source={x:Reference SeriesUSA}, Path=Brush}"
                CalloutOutline="{Binding Source={x:Reference SeriesUSA}, Path=Brush}"
                CalloutBackground="{Binding Source={x:Reference SeriesUSA}, Path=Brush}"
                CalloutTextColor="White"
                CalloutStrokeThickness="1.5">
        </ig:CalloutLayer>
        <ig:CalloutLayer
                CollisionChannel="MultipleCallouts"
                TargetSeries="{x:Reference SeriesRUS}"
                ItemsSource="{Binding CalloutsRUS}"
                IsAutoCalloutBehaviorEnabled="False"
                UseValueForAutoCalloutLabels="False"
                AutoCalloutLabelPrecision="1"
                XMemberPath="DataItem.Index"
                YMemberPath="DataItem.ValueInMln"
                LabelMemberPath="Label"
                ContentMemberPath="Content"
                CalloutLeaderBrush="{Binding Source={x:Reference SeriesRUS}, Path=Brush}"
                CalloutOutline="{Binding Source={x:Reference SeriesRUS}, Path=Brush}"
                CalloutBackground="{Binding Source={x:Reference SeriesRUS}, Path=Brush}"
                CalloutTextColor="White"
                CalloutStrokeThickness="1.5">
        </ig:CalloutLayer>
    </ig:XamDataChart.Series>
</ig:XamDataChart>
Topic Purpose

This topic provides information about the properties and methods that the touch interaction feature uses for highlighting, touch and interacting with the tooltip interactions inherited from the Series class.

This topic provides information about the crosshair layer used for touch interactions. It describes the properties of the crosshair layer and provides an implementation example.

This topic provides information about the category item highlight layer used for touch interactions. It describes the properties of the category item highlight layer and provides an example of its implementation.

This topic provides information about the category tooltip layer used for touch interactions. It describes the properties of the category tooltip layer and provides an example of its implementation.

This topic provides information about the item tooltip layer which is used for touch interactions. It describes the properties of the item tooltip layer and also provides an example of its implementation.