Class ChartTooltipBehavior
ChartTooltipBehavior displays tooltip for the data points nearer to mouse over position or at touch contact point inside a chart area when ShowTooltip property is true
.
Implements
Inherited Members
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.SfChart.UWP.dll
Syntax
public class ChartTooltipBehavior : ChartBehavior, ICloneable
Remarks
The ChartTooltipBehavior is commonly used for all series to customize the tooltip. You can use the attached ChartTooltip properties in a series if you need to customize the appearance of the tooltip based on a particular series. Series attached properties is considered as high precedence.
Examples
<syncfusion:SfChart>
<syncfusion:SfChart.Behaviors>
<syncfusion:ChartTooltipBehavior/>
</syncfusion:SfChart.Behaviors>
</syncfusion:SfChart>
Constructors
ChartTooltipBehavior()
Initializes a new instance of the ChartTooltipBehavior.
Declaration
public ChartTooltipBehavior()
Fields
EnableAnimationProperty
Identifies the EnableAnimation dependency property.
Declaration
public static readonly DependencyProperty EnableAnimationProperty
Field Value
Type | Description |
---|---|
Windows.UI.Xaml.DependencyProperty | The identifier for the EnableAnimation dependency property. |
HorizontalAlignmentProperty
Identifies the HorizontalAlignment dependency property.
Declaration
public static readonly DependencyProperty HorizontalAlignmentProperty
Field Value
Type | Description |
---|---|
Windows.UI.Xaml.DependencyProperty | The identifier for the HorizontalAlignment dependency property. |
HorizontalOffsetProperty
Identifies the HorizontalOffset dependency property.
Declaration
public static readonly DependencyProperty HorizontalOffsetProperty
Field Value
Type | Description |
---|---|
Windows.UI.Xaml.DependencyProperty | The identifier for the HorizontalOffset dependency property. |
InitialShowDelayProperty
Identifies the InitialShowDelay dependency property.
Declaration
public static readonly DependencyProperty InitialShowDelayProperty
Field Value
Type | Description |
---|---|
Windows.UI.Xaml.DependencyProperty | The identifier for the InitialShowDelay dependency property. |
LabelStyleProperty
Identifies the LabelStyle dependency property.
Declaration
public static readonly DependencyProperty LabelStyleProperty
Field Value
Type | Description |
---|---|
Windows.UI.Xaml.DependencyProperty | The identifier for the LabelStyle dependency property. |
PositionProperty
Identifies the Position dependency property.
Declaration
public static readonly DependencyProperty PositionProperty
Field Value
Type | Description |
---|---|
Windows.UI.Xaml.DependencyProperty | The identifier for the Position dependency property. |
ShowDurationProperty
Identifies the ShowDuration dependency property.
Declaration
public static readonly DependencyProperty ShowDurationProperty
Field Value
Type | Description |
---|---|
Windows.UI.Xaml.DependencyProperty | The identifier for the ShowDuration dependency property. |
StyleProperty
Identifies the Style dependency property.
Declaration
public static readonly DependencyProperty StyleProperty
Field Value
Type | Description |
---|---|
Windows.UI.Xaml.DependencyProperty | The identifier for the Style dependency property. |
VerticalAlignmentProperty
Identifies the VerticalAlignment dependency property.
Declaration
public static readonly DependencyProperty VerticalAlignmentProperty
Field Value
Type | Description |
---|---|
Windows.UI.Xaml.DependencyProperty | The identifier for the VerticalAlignment dependency property. |
VerticalOffsetProperty
Identifies the VerticalOffset dependency property.
Declaration
public static readonly DependencyProperty VerticalOffsetProperty
Field Value
Type | Description |
---|---|
Windows.UI.Xaml.DependencyProperty | The identifier for the VerticalOffset dependency property. |
Properties
EnableAnimation
Gets or sets the value that indicates whether to enable the animation when showing tooltip.
Declaration
public bool EnableAnimation { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
<chart:SfChart.Behaviors>
<chart:ChartTooltipBehavior x:Name="chartTooltipBehavior" EnableAnimation="true"/>
</chart:SfChart.Behaviors>
HorizontalAlignment
Gets or sets the horizontal alignment of tooltip label with respect to the cursor position.
Declaration
public HorizontalAlignment HorizontalAlignment { get; set; }
Property Value
Type | Description |
---|---|
Windows.UI.Xaml.HorizontalAlignment |
|
Examples
<chart:SfChart.Behaviors>
<chart:ChartTooltipBehavior x:Name="chartTooltipBehavior" HorizontalAlignment="Right"/>
</chart:SfChart.Behaviors>
HorizontalOffset
Gets or sets the value to position the tooltip at a distance from the cursor horizontally.
Declaration
public double HorizontalOffset { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
|
Remarks
The HorizontalOffset property and the VerticalOffset property values provide additional adjustment to position the tooltip.
Examples
<chart:SfChart.Behaviors>
<chart:ChartTooltipBehavior x:Name="chartTooltipBehavior" HorizontalOffset="10"/>
</chart:SfChart.Behaviors>
InitialShowDelay
Gets or sets the delay in milliseconds to show the tooltip once user interact with series.
Declaration
public int InitialShowDelay { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
|
Remarks
Used to specify the amount of time before the user has to wait when hover the mouse or touch on chart series in milliseconds before tooltip display.
Note: Initial delay only works for the positive values.
Examples
<chart:SfChart.Behaviors>
<chart:ChartTooltipBehavior x:Name="chartTooltipBehavior" InitialShowDelay="1000"/>
</chart:SfChart.Behaviors>
LabelStyle
Gets or sets the style to customize the tooltip label.
Declaration
public Style LabelStyle { get; set; }
Property Value
Type | Description |
---|---|
Windows.UI.Xaml.Style | The |
Remarks
To define a Style
for tooltip label, specify the style of TargetType as TextBlock
.
Examples
<syncfusion:SfChart.Resources>
<Style TargetType="TextBlock" x:Key="labelStyle">
<Setter Property="FontSize" Value="14"/>
<Setter Property="Foreground" Value="Red"/>
</Style>
</syncfusion:SfChart.Resources>
<syncfusion:SfChart.Behaviors>
<syncfusion:ChartTooltipBehavior LabelStyle = {StaticResource labelStyle}/>
</syncfusion:SfChart.Behaviors>
Position
Gets or sets a value that indicates whether to position the tooltip at data point position or at cursor position.
Declaration
public TooltipPosition Position { get; set; }
Property Value
Type | Description |
---|---|
TooltipPosition | TooltipPosition. The default value is Auto. |
Remarks
When the TooltipPosition is set as Auto the tooltip will be displayed at the data point position while hover mouse inside any chart segment. If the TooltipPosition is set as Pointer then the tooltip will be displayed in conjunction with the mouse pointer itself while hover mouse inside any chart segment.
Examples
<chart:SfChart.Behaviors>
<chart:ChartTooltipBehavior x:Name="chartTooltipBehavior" Position="Pointer"/>
</chart:SfChart.Behaviors>
ShowDuration
Gets or sets the amount of time that the tooltip remains visible in milliseconds.
Declaration
public int ShowDuration { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
|
Remarks
This property defines the time that a tooltip remains visible while the user pauses the mouse pointer over the chart series area that defines the tooltip.
Examples
<chart:SfChart.Behaviors>
<chart:ChartTooltipBehavior x:Name="chartTooltipBehavior" ShowDuration="3000"/>
</chart:SfChart.Behaviors>
Style
Gets or sets the style to customize the fill and stroke of tooltip.
Declaration
public Style Style { get; set; }
Property Value
Type | Description |
---|---|
Windows.UI.Xaml.Style | The |
Remarks
To define a Style
for tooltip, specify the style of TargetType as Path
.
Examples
<syncfusion:SfChart.Resources>
<Style TargetType="Path" x:Key="style">
<Setter Property="Stroke" Value="Black"/>
<Setter Property="Fill" Value="Gray"/>
</Style>
</syncfusion:SfChart.Resources>
<syncfusion:SfChart.Behaviors>
<syncfusion:ChartTooltipBehavior Style = {StaticResource style}/>
</syncfusion:SfChart.Behaviors>
VerticalAlignment
Gets or sets the vertical alignment of tooltip label with respect to the cursor position.
Declaration
public VerticalAlignment VerticalAlignment { get; set; }
Property Value
Type | Description |
---|---|
Windows.UI.Xaml.VerticalAlignment |
|
Examples
<chart:SfChart.Behaviors>
<chart:ChartTooltipBehavior x:Name="chartTooltipBehavior" VerticalAlignment="Bottom"/>
</chart:SfChart.Behaviors>
VerticalOffset
Gets or sets the value to position the tooltip at a distance from the cursor vertically.
Declaration
public double VerticalOffset { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
|
Remarks
The HorizontalOffset property and the VerticalOffset property values provide additional adjustment to position the tooltip.
Examples
<chart:SfChart.Behaviors>
<chart:ChartTooltipBehavior x:Name="chartTooltipBehavior" VerticalOffset="10"/>
</chart:SfChart.Behaviors>
Methods
CloneBehavior(DependencyObject)
Returns the instance of ChartTooltipBehavior.
Declaration
protected override DependencyObject CloneBehavior(DependencyObject obj)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.DependencyObject | obj | object. |
Returns
Type | Description |
---|---|
Windows.UI.Xaml.DependencyObject | The cloned ChartTooltipBehavior. |
Overrides
OnSizeChanged(SizeChangedEventArgs)
Declaration
protected override void OnSizeChanged(SizeChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.SizeChangedEventArgs | e |