Skip to main content

ChartContainerProps

Struct ChartContainerProps 

Source
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:

§Customization layers

  1. Single *Chart component — bind a Dataset and optional legend / tooltip props.
  2. Configuration props — axes, plot inset (margin), palette, highlight scope on the container.
  3. Composition childrenChartContainer + explicit BarPlot / LinePlot / custom SVG layers. See chart-composition and chart-stacking previews.

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 Dataset output from a DataTable without a convenience *Chart wrapper.

§Usage

  1. Bind a shared Dataset with binding or field keys that match your DataTable columns.
  2. Set explicit width and height for fixed tiles, or wrap with ResponsiveChartContainer for parent-fill layouts.
  3. Add plot children (BarPlot, LinePlot, etc.) in composition mode; otherwise the container renders axes only.
  4. Opt into legend, tooltip, and highlight_scope when the dashboard needs exploration — defaults are None for lightweight embeds.
  5. Wrap previews in a native element with data-testid for E2E hooks.

§Best Practices

§Do’s

  • Use the same field keys as orbital_data::FieldDef::key in your DataTable columns.
  • Leave skip_animation unset so reduced-motion preferences are honored automatically.
  • Set plot inset via margin when 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::ScrollHost when the chart lives inside a ScrollArea so tooltips escape clip.

§Don’ts

  • Do not reach for composition when a *Chart wrapper already covers your chart type.
  • Do not put data-testid on the chart component — wrap it in a native div or span.
  • Do not rely on absolute tooltip positioning in scroll hosts — use ChartEmbedMode instead.

§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

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: 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 (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: ChartFeatures

Opt-in capability flags (ChartFeatures::ZOOM_PAN, ChartFeatures::ANIMATION, ChartFeatures::KEYBOARD_NAV).

§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.

§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: MaybeProp<String>

Optional CSS class on the root element.

§children: Option<Children>

Composition children (plot, axis, legend layers).

Implementations§

Source§

impl ChartContainerProps

Source

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§

Source§

impl Props for ChartContainerProps

Source§

type Builder = ChartContainerPropsBuilder

Source§

fn builder() -> Self::Builder

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where 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) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<E, T, Request, Encoding> FromReq<Patch<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

Source§

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Source§

impl<E, T, Request, Encoding> FromReq<Post<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

Source§

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Source§

impl<E, T, Request, Encoding> FromReq<Put<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

Source§

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Source§

impl<E, Encoding, Response, T> FromRes<Patch<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

Source§

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Source§

impl<E, Encoding, Response, T> FromRes<Post<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

Source§

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Source§

impl<E, Encoding, Response, T> FromRes<Put<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

Source§

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<El, T, Marker> IntoElementMaybeSignal<T, Marker> for El
where El: IntoElementMaybeSignalType<T, Marker>,

Source§

impl<T, Js> IntoElementMaybeSignalType<T, Element> for Js
where T: From<Js> + Clone,

Source§

impl<El, T, Marker> IntoElementsMaybeSignal<T, Marker> for El
where El: IntoElementsMaybeSignalType<T, Marker>,

Source§

impl<T, Js> IntoElementsMaybeSignalType<T, Element> for Js
where T: From<Js> + Clone,

Source§

impl<E, T, Encoding, Request> IntoReq<Patch<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

Source§

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Source§

impl<E, T, Encoding, Request> IntoReq<Post<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

Source§

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Source§

impl<E, T, Encoding, Request> IntoReq<Put<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

Source§

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Source§

impl<E, Response, Encoding, T> IntoRes<Patch<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

Source§

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Source§

impl<E, Response, Encoding, T> IntoRes<Post<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

Source§

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Source§

impl<E, Response, Encoding, T> IntoRes<Put<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

Source§

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> SerializableKey for T

Source§

fn ser_key(&self) -> String

Serializes the key to a unique string. Read more
Source§

impl<T> StorageAccess<T> for T

Source§

fn as_borrowed(&self) -> &T

Borrows the value.
Source§

fn into_taken(self) -> T

Takes the value.
Source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more