Skip to main content

ChartElement

Enum ChartElement 

Source
pub enum ChartElement {
    Svg {
        viewbox: ViewBox,
        width: Option<f64>,
        height: Option<f64>,
        class: String,
        children: Vec<ChartElement>,
    },
    Group {
        class: String,
        transform: Option<Transform>,
        children: Vec<ChartElement>,
    },
    Rect {
        x: f64,
        y: f64,
        width: f64,
        height: f64,
        fill: String,
        stroke: Option<String>,
        rx: Option<f64>,
        ry: Option<f64>,
        class: String,
        data: Option<ElementData>,
        animation_origin: Option<(f64, f64)>,
    },
    Path {
        d: String,
        fill: Option<String>,
        stroke: Option<String>,
        stroke_width: Option<f64>,
        stroke_dasharray: Option<String>,
        opacity: Option<f64>,
        class: String,
        data: Option<ElementData>,
        animation_origin: Option<(f64, f64)>,
    },
    Circle {
        cx: f64,
        cy: f64,
        r: f64,
        fill: String,
        stroke: Option<String>,
        class: String,
        data: Option<ElementData>,
    },
    Line {
        x1: f64,
        y1: f64,
        x2: f64,
        y2: f64,
        stroke: String,
        stroke_width: Option<f64>,
        stroke_dasharray: Option<String>,
        class: String,
    },
    Text {
Show 14 fields x: f64, y: f64, content: String, anchor: TextAnchor, dominant_baseline: Option<String>, transform: Option<Transform>, font_family: Option<String>, font_size: Option<String>, font_weight: Option<String>, letter_spacing: Option<String>, text_transform: Option<String>, fill: Option<String>, class: String, data: Option<ElementData>,
}, Div { class: String, style: HashMap<String, String>, children: Vec<ChartElement>, }, Span { class: String, style: HashMap<String, String>, content: String, }, }
Expand description

The output of any ChartRenderer. Framework adapters walk this tree and produce framework-specific DOM/view output.

Variants§

§

Svg

Fields

§viewbox: ViewBox
§width: Option<f64>
§height: Option<f64>
§class: String
§children: Vec<ChartElement>
§

Group

Fields

§class: String
§transform: Option<Transform>
§children: Vec<ChartElement>
§

Rect

Fields

§width: f64
§height: f64
§fill: String
§stroke: Option<String>
§rx: Option<f64>

Corner radius on the x axis. When None, no rx attribute is emitted (preserving byte-identical output for un-themed charts). Wired from Theme::bar_corner_radius in Phase 5 — bars emit Some(v) when bar_corner_radius is Uniform(v) with v > 0.0, else None. Top-only rounding is emitted as a Path instead of a Rect (see BarCornerRadius::Top).

§ry: Option<f64>

Corner radius on the y axis. See rx.

§class: String
§animation_origin: Option<(f64, f64)>

CSS transform-origin anchor for entrance animations, in the element’s own coordinate space (absolute SVG coords). Populated by bar emission sites in chartml-chart-cartesian/src/bar.rs so the renderer never has to guess orientation/sign. None for every non-bar Rect — the renderer falls back to its legacy behavior, preserving byte-identical SVG output for all pre-existing baselines (see backward_compat_goldens_byte_identical).

§

Path

Fields

§stroke: Option<String>
§stroke_width: Option<f64>
§stroke_dasharray: Option<String>
§opacity: Option<f64>
§class: String
§animation_origin: Option<(f64, f64)>

See ChartElement::Rect::animation_origin. Populated by build_bar_element for top-rounded bars (BarCornerRadius::Top), which are emitted as Path instead of Rect because SVG <rect> can’t round only two corners. None for every other Path.

§

Circle

Fields

§cx: f64
§cy: f64
§fill: String
§stroke: Option<String>
§class: String
§

Line

Fields

§x1: f64
§y1: f64
§x2: f64
§y2: f64
§stroke: String
§stroke_width: Option<f64>
§stroke_dasharray: Option<String>
§class: String
§

Text

Fields

§content: String
§anchor: TextAnchor
§dominant_baseline: Option<String>
§transform: Option<Transform>
§font_family: Option<String>
§font_size: Option<String>
§font_weight: Option<String>
§letter_spacing: Option<String>
§text_transform: Option<String>
§class: String
§

Div

Non-SVG container (e.g., metric card uses div-based layout)

Fields

§class: String
§children: Vec<ChartElement>
§

Span

Raw text node (for metric values, labels in div-based charts)

Fields

§class: String
§content: String

Trait Implementations§

Source§

impl Clone for ChartElement

Source§

fn clone(&self) -> ChartElement

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChartElement

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ChartElement

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ChartElement

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

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> 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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,