Skip to content

Interaction, Animation, and Live Updates

Selection and Gestures

Canvas, UI Toolkit and world-space hosts share pointer, hover, drag, double-tap, long-press and pinch behavior. In Behavior > Selection, choose Individual Marks to select the actual mark or stacked segment, or X Axis to select a whole horizontal value or category anywhere in the plot. The Chart model also exposes selected X/Y/Z values, ranges, angle and hovered index.

  • Use point selection for dashboards and drilldown.
  • Use range selection for time windows and brushing.
  • Use angle selection for pie and donut slices.
  • Use scrollable axes and visible domains when only part of a large data set should be visible.

Indicator Style can highlight the selected marks, draw a rule or lollipop, or show an X-selection background band where supported. Configure line width and color, lollipop marker diameter and outline, or band width, fill and corner radius beside the indicator. These sizes are logical points. Drag Selection enables press-and-drag inspection; an application can supply persistent selection presentation when the selection should outlive the gesture.

Linked Selection and Brushing

Use ChartSelectionLink to coordinate point and range selections across charts. The default point match is SeriesAndX; choose StableIdentity, XValue, Category or Index when that better describes how the charts correspond. Stable identity uses a mark's accessibility identifier when available. Prefer semantic matching when charts can reorder or filter their data.

Choose the propagated state through ChartSelectionPropagation: point selection, X/Y/Z ranges, or All. Retain the link for as long as the charts are linked and call Dispose when that relationship ends. The link prevents feedback loops. Chart.ClearSelection() clears point, range, angle and 3D selection state.

For range brushing, enable Drag Selection and choose Brush Axes X, Y or XY on a Cartesian chart, or set ChartGuruElement.BrushAxes in code. None retains ordinary selection dragging. Range callbacks and highlights share the chart model used by application-owned gestures.

Data Tooltips and Application Popovers

Data tooltips show values next to the active mark in Canvas and UI Toolkit charts. Start with ChartTooltipPreset.Automatic: it compares visible line or area series that share the active X value, otherwise it shows detailed mark content. Compact, Comparison and Detailed select an explicit layout. Hidden disables tooltip tracking and presentation.

Monthly expenses chart with April highlighted and an open April breakdown listing each category's total and share.
In the Swift Selection sample, selecting a month opens an application panel with the selected total and category breakdown.

Use Hover for pointer inspection, HoverAndPin for hover with tap/click pinning, or Selection for content that follows the selected mark. ChartTooltipStyle controls the presentation, and ChartTooltipIndicator controls its mark indicator. The chart selects the correct built-in presenter for its host.

using ChartGuru;

public static class TooltipExample
{
public static Chart Create()
{
string[] products = { "Coffee", "Tea", "Cocoa" };
float[] revenue = { 120f, 90f, 75f };
ChartBuilder builder = Chart.Create()
.ChartTooltip((content, context) =>
{
int index = context.Hit.MarkIndex;
if (index < 0 || index >= revenue.Length) return;
content.Title(products[index])
.Row("Revenue", revenue[index].ToString("0"), context.Hit.Color)
.Footer("Click or tap to pin");
})
.ChartTooltipInteraction(ChartTooltipInteraction.HoverAndPin)
.ChartTooltipStyle(ChartTooltipStyle.Premium);

for (int index = 0; index < products.Length; index++)
{
builder.Add(new BarMark(index, revenue[index])
{
CategoryLabel = products[index],
SeriesKey = "Revenue"
});
}
return builder.Build();
}
}

Keep a custom content callback synchronous and inexpensive. The content builder is reused, so do not retain it as an immutable snapshot. Bind ChartTooltipState through ChartTooltipChanged or the host's TooltipChanged event when an application-owned detail panel needs the current content or pin state. Put interactive controls in that application panel; the built-in tooltip is a read-only content overlay.

Configure tooltip behavior in the chart definition or through the public Chart tooltip APIs. The UXML element selects its chart asset, data asset or inline chart type. Open Examples/UIToolkit/11_Tooltips for automatic comparison, custom content and state binding. Unity [Tooltip] and VisualElement.tooltip describe authoring controls; they do not supply live chart values.

Animation and Morphing

Entry animations, value changes and chart-type morphs use one keyed transition system. Matching marks move, resize and change color, added or removed marks enter or leave from a suitable baseline, and a new update continues from the current visible state. Use the Animation factories and timing modifiers to choose the motion. MorphTo supports CrossFade, Scale and Semantic; unsupported semantic pairs use Scale. Definition-driven hosts retarget compatible channels when their chart type changes.

chart.MorphTo(ChartType.Line, new MorphOptions
{
Animation = Animation.EaseInOut(0.6f),
Style = ChartMorphStyle.Semantic
});
chart.SetValues(newValues); // fastest Y-only update when shape is unchanged
chart.SetData(newMarks); // full replace when mark shape changes
Two Chart Guru charts showing a selected point with brush range and a live scrollable time series.
Figure 5. Interaction and live data: selection ranges, selected points, visible domains, scrolling, zooming, and streaming updates share the same chart model.

Accessible Charts and Audio Graphs

Give the chart a meaningful ChartAccessibilityLabel and, when useful, a ChartAccessibilityRepresentation that explains its message. Per-mark accessibility labels, values and identifiers improve navigation and stable selection matching. GetAccessibilitySummary() returns a textual summary; GetAccessibilityDescriptor() exposes visible marks and series as a platform-neutral description that an application can present through its own accessible UI.

Accessibility sample with a carbon dioxide trend and daily high and low temperature lines marked with different symbols.
The Accessibility sample pairs an audio-enabled trend with a chart whose marker shapes distinguish the two series.

On Unity 6, ChartAccessibilityHierarchyBridge can add those descriptions to Unity's native accessibility hierarchy. Supply chart and mark frame callbacks in screen coordinates. Integrate with the application's hierarchy when one already exists; a new bridge does not activate itself, and Activate() will not replace another active hierarchy by default. Retain the bridge, update frames as the chart moves and dispose it when the host is released.

using System;
using ChartGuru;
using UnityEngine;

public static class AccessibilityExample
{
#if UNITY_6000_0_OR_NEWER
public static ChartAccessibilityHierarchyBridge Activate(
Chart chart,
Func<Rect> chartScreenFrame,
Func<int, Rect> markScreenFrame)
{
var bridge = new ChartAccessibilityHierarchyBridge(
chart,
chartFrameGetter: chartScreenFrame,
markFrameGetter: markScreenFrame);
if (bridge.Activate()) return bridge;
bridge.Dispose();
return null;
}
#endif
}

For an audio graph, retain a ChartAudioGraph, assign its caller-owned AudioSource, set SonificationOptions as needed and call Play(chart). Sonify(chart) returns notes and CreateAudioClip(chart) creates PCM audio when the application needs a separate playback workflow. Stop ends playback. The graph owns its generated clip; use ReleaseGeneratedClip or Dispose to release it. Audio is a supplement to readable text, units and accessible navigation.