pub struct ChartContainerProps {Show 36 fields
pub series: Option<Vec<SeriesDef>>,
pub dataset: Option<Dataset>,
pub binding: Option<ChartFieldBinding>,
pub x_axis: Option<Vec<AxisDef>>,
pub y_axis: Option<Vec<AxisDef>>,
pub width: Option<f64>,
pub height: Option<f64>,
pub margin: Option<PlotInset>,
pub grid: Option<GridConfig>,
pub loading: Option<bool>,
pub skip_animation: Option<bool>,
pub motion: Option<ChartMotion>,
pub orientation: ChartOrientation,
pub chart_kind: ChartKind,
pub highlight_scope: Option<HighlightScope>,
pub axis_highlight: Option<AxisHighlightConfig>,
pub legend: Option<LegendConfig>,
pub tooltip: Option<TooltipConfig>,
pub charts_theme: Option<OrbitalChartsTheme>,
pub palette: Option<OrbitalChartPalette>,
pub highlighted_item: Option<RwSignal<Option<ChartItemId>>>,
pub on_highlight_change: Option<Callback<(Option<ChartItemId>,), ()>>,
pub on_legend_click: Option<Callback<(String,), ()>>,
pub on_item_click: Option<Callback<(ChartItemId,), ()>>,
pub on_axis_click: Option<Callback<(AxisClickData,), ()>>,
pub features: ChartFeatures,
pub keyboard_navigation: bool,
pub prefer_line_x_strict: bool,
pub zoom: Option<Vec<ZoomWindow>>,
pub on_zoom_change: Option<Callback<(Vec<ZoomWindow>,), ()>>,
pub loading_view: Option<Arc<dyn Fn() -> AnyView + Send + Sync>>,
pub empty_view: Option<Arc<dyn Fn() -> AnyView + Send + Sync>>,
pub embed_mode: ChartEmbedMode,
pub overlay_mount: OverlayMount,
pub class: MaybeProp<String>,
pub children: Option<Children>,
}Expand description
Props for the ChartContainer component.
Ready-made chart layout root — bind a Dataset, tune props, or compose plot children.
Use ChartContainer when you need explicit control over axes, series, plot inset,
and child plot layers. For common chart types, prefer the *Chart convenience
components (e.g. crate::BarChart).
§Chart type family
Pick the chart that matches the story you are telling:
- Compare categories —
crate::BarChartwhen magnitude at a shared baseline matters. - Show change over time —
crate::LineChartorcrate::AreaChartfor trends and stacked volume. - Show parts of a whole —
crate::PieChartwhen proportions beat precise comparisons. - Correlate two metrics —
crate::ScatterChartfor point-by-point relationships. - Inline trend glyph —
crate::Sparklinebeside KPIs without axis chrome. - Single-metric readout —
crate::Gaugefor capacity or score at a glance. - Intensity grid —
crate::Heatmapfor two categorical dimensions plus a value.
§Customization layers
- Single
*Chartcomponent — bind aDatasetand optionallegend/tooltipprops. - Configuration props — axes, plot inset (
margin), palette, highlight scope on the container. - Composition children —
ChartContainer+ explicitBarPlot/LinePlot/ custom SVG layers. Seechart-compositionandchart-stackingpreviews.
Cross-cutting UX lives on dedicated previews: charts-legend, charts-tooltip,
charts-highlighting, charts-label, charts-styling, charts-axis.
§When to use
- Mixed-type dashboards (bar + line overlay) or custom SVG annotations.
- Full control over which plot children render and their z-order.
- Processed
Datasetoutput from a DataTable without a convenience*Chartwrapper.
§Usage
- Bind a shared
Datasetwithbindingor field keys that match your DataTable columns. - Set explicit
widthandheightfor fixed tiles, or wrap withResponsiveChartContainerfor parent-fill layouts. - Add plot children (
BarPlot,LinePlot, etc.) in composition mode; otherwise the container renders axes only. - Opt into
legend,tooltip, andhighlight_scopewhen the dashboard needs exploration — defaults areNonefor lightweight embeds. - Wrap previews in a native element with
data-testidfor E2E hooks.
§Best Practices
§Do’s
- Use the same field keys as
orbital_data::FieldDef::keyin your DataTable columns. - Leave
skip_animationunset so reduced-motion preferences are honored automatically. - Set plot inset via
marginwhen legends or long axis labels need extra room. - Link users to cross-cutting previews instead of repeating legend/tooltip setup on every chart type.
- Follow [
ChartCompositionOrder] for child z-order: grid → [PlotClip] → plots → axes → overlay chrome. - Set
embed_mode=ChartEmbedMode::ScrollHostwhen the chart lives inside aScrollAreaso tooltips escape clip.
§Don’ts
- Do not reach for composition when a
*Chartwrapper already covers your chart type. - Do not put
data-testidon the chart component — wrap it in a nativedivorspan. - Do not rely on absolute tooltip positioning in scroll hosts — use
ChartEmbedModeinstead.
§Examples
§Basic container with axes and grid
Minimal shell proving band x-axis, linear y-axis, and grid wiring. Start here before
adding plot children or binding a live Dataset from a DataTable.
use crate::ChartContainer;
use crate::preview::fixtures::{full_grid, quarter_x_axis, revenue_series, revenue_y_axis};
view! {
<div data-testid="chart-container-preview" style="min-width: 560px; min-height: 320px;">
<ChartContainer
series=Some(vec![revenue_series()])
x_axis=Some(vec![quarter_x_axis()])
y_axis=Some(vec![revenue_y_axis()])
grid=Some(full_grid())
width=Some(520.0)
height=Some(320.0)
/>
</div>
}§Loading overlay
Sets loading=true while async data fetches run. The container shows [Spinner] and
[Skeleton] chrome instead of an empty plot — pair with your data resource’s pending state.
use crate::ChartContainer;
view! {
<div data-testid="chart-container-loading-preview">
<ChartContainer loading=Some(true) width=Some(400.0) height=Some(280.0) />
</div>
}§Custom layer via hooks
Dashed baseline drawn in SVG space using crate::use_drawing_area and
crate::use_y_scale. Use this pattern for annotations that must stay aligned on resize.
use crate::{ChartContainer, ChartCustomBaseline};
use crate::preview::fixtures::{quarter_x_axis, revenue_series, revenue_y_axis};
view! {
<div data-testid="chart-container-custom-layer-preview">
<ChartContainer
series=Some(vec![revenue_series()])
x_axis=Some(vec![quarter_x_axis()])
y_axis=Some(vec![revenue_y_axis()])
width=Some(520.0)
height=Some(320.0)
>
<ChartCustomBaseline />
</ChartContainer>
</div>
}§Optional Props
- series:
Option<Vec<SeriesDef>>- Series definitions (explicit or derived from dataset + binding).
- dataset:
Option<Dataset>- Tabular data — primary consumption mode.
- binding:
Option<ChartFieldBinding>- Shorthand field binding when using dataset.
- x_axis:
Option<Vec<AxisDef>>- X-axis definitions.
- y_axis:
Option<Vec<AxisDef>>- Y-axis definitions.
- width:
Option<f64>- Chart width in pixels.
- height:
Option<f64>- Chart height in pixels.
- margin:
Option<PlotInset>- Space between SVG border and plot. User docs: “plot inset”.
- grid:
Option<GridConfig>- Background grid configuration.
- loading:
Option<bool>- Whether the chart is in a loading state.
- skip_animation:
Option<bool>- When true, skip all enter/update animations.
- motion:
Option<ChartMotion>- Chart-level animation configuration.
- orientation:
ChartOrientation- Chart orientation for cartesian plots.
- chart_kind:
ChartKind- Chart geometry family.
- highlight_scope:
Option<HighlightScope>- Highlight and fade scope.
- axis_highlight:
Option<AxisHighlightConfig>- Axis crosshair / band highlight configuration.
- legend:
Option<LegendConfig>- Legend configuration (
Nonehides legend).
- Legend configuration (
- tooltip:
Option<TooltipConfig>- Tooltip configuration.
- charts_theme:
Option<OrbitalChartsTheme>- Chart theme extension overrides.
- palette:
Option<OrbitalChartPalette>- Color palette override.
- highlighted_item:
Option<RwSignal<Option<ChartItemId>>>- Controlled highlighted item.
- on_highlight_change:
Option<Callback<(Option<ChartItemId>,), ()>>- Fired when highlight changes.
- on_legend_click:
Option<Callback<(String,), ()>>- Fired when a legend entry is clicked.
- on_item_click:
Option<Callback<(ChartItemId,), ()>>- Fired when a bar/mark is clicked.
- on_axis_click:
Option<Callback<(AxisClickData,), ()>>- Fired when a category axis band is clicked.
- features:
ChartFeatures- Opt-in capability flags (
ChartFeatures::ZOOM_PAN,ChartFeatures::ANIMATION,ChartFeatures::KEYBOARD_NAV).
- Opt-in capability flags (
- keyboard_navigation:
bool- Enable arrow-key navigation between marks (CH-22). Keyboard zoom (CH-24) is deferred.
- prefer_line_x_strict:
bool- When true, inferred line/area x-axes use
crate::DomainLimit::Strict.
- When true, inferred line/area x-axes use
- zoom:
Option<Vec<ZoomWindow>>- Controlled zoom windows per axis (percent 0–100).
- on_zoom_change:
Option<Callback<(Vec<ZoomWindow>,), ()>>- Fired when the user or program changes zoom state.
- loading_view: [
Option<Arc<dyn Fn() -> AnyView + Send + Sync>>]- Custom loading overlay slot.
- empty_view: [
Option<Arc<dyn Fn() -> AnyView + Send + Sync>>]- Custom empty overlay slot.
- embed_mode:
ChartEmbedMode- How the chart is embedded in its host (scroll, dialog, table cell).
- overlay_mount:
OverlayMount- Portal mount override for overlay chrome.
- class:
impl Into<MaybeProp<String>>- Optional CSS class on the root element.
- children:
Children- Composition children (plot, axis, legend layers).
Fields§
§series: Option<Vec<SeriesDef>>Series definitions (explicit or derived from dataset + binding).
dataset: Option<Dataset>Tabular data — primary consumption mode.
binding: Option<ChartFieldBinding>Shorthand field binding when using dataset.
x_axis: Option<Vec<AxisDef>>X-axis definitions.
y_axis: Option<Vec<AxisDef>>Y-axis definitions.
width: Option<f64>Chart width in pixels.
height: Option<f64>Chart height in pixels.
margin: Option<PlotInset>Space between SVG border and plot. User docs: “plot inset”.
grid: Option<GridConfig>Background grid configuration.
loading: Option<bool>Whether the chart is in a loading state.
skip_animation: Option<bool>When true, skip all enter/update animations.
motion: Option<ChartMotion>Chart-level animation configuration.
orientation: ChartOrientationChart orientation for cartesian plots.
chart_kind: ChartKindChart geometry family.
highlight_scope: Option<HighlightScope>Highlight and fade scope.
axis_highlight: Option<AxisHighlightConfig>Axis crosshair / band highlight configuration.
legend: Option<LegendConfig>Legend configuration (None hides legend).
tooltip: Option<TooltipConfig>Tooltip configuration.
charts_theme: Option<OrbitalChartsTheme>Chart theme extension overrides.
palette: Option<OrbitalChartPalette>Color palette override.
highlighted_item: Option<RwSignal<Option<ChartItemId>>>Controlled highlighted item.
on_highlight_change: Option<Callback<(Option<ChartItemId>,), ()>>Fired when highlight changes.
on_legend_click: Option<Callback<(String,), ()>>Fired when a legend entry is clicked.
on_item_click: Option<Callback<(ChartItemId,), ()>>Fired when a bar/mark is clicked.
on_axis_click: Option<Callback<(AxisClickData,), ()>>Fired when a category axis band is clicked.
features: ChartFeaturesOpt-in capability flags (ChartFeatures::ZOOM_PAN, ChartFeatures::ANIMATION, ChartFeatures::KEYBOARD_NAV).
Enable arrow-key navigation between marks (CH-22). Keyboard zoom (CH-24) is deferred.
prefer_line_x_strict: boolWhen true, inferred line/area x-axes use crate::DomainLimit::Strict.
zoom: Option<Vec<ZoomWindow>>Controlled zoom windows per axis (percent 0–100).
on_zoom_change: Option<Callback<(Vec<ZoomWindow>,), ()>>Fired when the user or program changes zoom state.
loading_view: Option<Arc<dyn Fn() -> AnyView + Send + Sync>>Custom loading overlay slot.
empty_view: Option<Arc<dyn Fn() -> AnyView + Send + Sync>>Custom empty overlay slot.
embed_mode: ChartEmbedModeHow the chart is embedded in its host (scroll, dialog, table cell).
overlay_mount: OverlayMountPortal mount override for overlay chrome.
class: MaybeProp<String>Optional CSS class on the root element.
children: Option<Children>Composition children (plot, axis, legend layers).
Implementations§
Source§impl ChartContainerProps
impl ChartContainerProps
Sourcepub fn builder() -> ChartContainerPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> ChartContainerPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building ChartContainerProps.
On the builder, call .series(...)(optional), .dataset(...)(optional), .binding(...)(optional), .x_axis(...)(optional), .y_axis(...)(optional), .width(...)(optional), .height(...)(optional), .margin(...)(optional), .grid(...)(optional), .loading(...)(optional), .skip_animation(...)(optional), .motion(...)(optional), .orientation(...)(optional), .chart_kind(...)(optional), .highlight_scope(...)(optional), .axis_highlight(...)(optional), .legend(...)(optional), .tooltip(...)(optional), .charts_theme(...)(optional), .palette(...)(optional), .highlighted_item(...)(optional), .on_highlight_change(...)(optional), .on_legend_click(...)(optional), .on_item_click(...)(optional), .on_axis_click(...)(optional), .features(...)(optional), .keyboard_navigation(...)(optional), .prefer_line_x_strict(...)(optional), .zoom(...)(optional), .on_zoom_change(...)(optional), .loading_view(...)(optional), .empty_view(...)(optional), .embed_mode(...)(optional), .overlay_mount(...)(optional), .class(...)(optional), .children(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of ChartContainerProps.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ChartContainerProps
impl !Sync for ChartContainerProps
impl !UnwindSafe for ChartContainerProps
impl Freeze for ChartContainerProps
impl Send for ChartContainerProps
impl Unpin for ChartContainerProps
impl UnsafeUnpin for ChartContainerProps
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<El, T, Marker> IntoElementMaybeSignal<T, Marker> for Elwhere
El: IntoElementMaybeSignalType<T, Marker>,
impl<El, T, Marker> IntoElementMaybeSignal<T, Marker> for Elwhere
El: IntoElementMaybeSignalType<T, Marker>,
fn into_element_maybe_signal(self) -> ElementMaybeSignal<T>
Source§impl<T, Js> IntoElementMaybeSignalType<T, Element> for Js
impl<T, Js> IntoElementMaybeSignalType<T, Element> for Js
fn into_element_maybe_signal_type(self) -> ElementMaybeSignalType<T>
Source§impl<El, T, Marker> IntoElementsMaybeSignal<T, Marker> for Elwhere
El: IntoElementsMaybeSignalType<T, Marker>,
impl<El, T, Marker> IntoElementsMaybeSignal<T, Marker> for Elwhere
El: IntoElementsMaybeSignalType<T, Marker>,
fn into_elements_maybe_signal(self) -> ElementsMaybeSignal<T>
Source§impl<T, Js> IntoElementsMaybeSignalType<T, Element> for Js
impl<T, Js> IntoElementsMaybeSignalType<T, Element> for Js
fn into_elements_maybe_signal_type(self) -> ElementsMaybeSignalType<T>
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more