Skip to main content

ChartOptions

Struct ChartOptions 

Source
pub struct ChartOptions {
Show 14 fields pub chart_type: ChartType, pub x_column: Option<String>, pub y_column: Option<String>, pub series_column: Option<String>, pub title: Option<String>, pub format: ChartFormat, pub width: u32, pub height: u32, pub bins: u32, pub x_as_category: Option<bool>, pub x_range: Option<[f64; 2]>, pub y_range: Option<[f64; 2]>, pub color_map: HashMap<String, RGBColor>, pub label_points: bool,
}
Expand description

User-facing chart configuration, parsed from MCP tool parameters.

Fields§

§chart_type: ChartType§x_column: Option<String>§y_column: Option<String>§series_column: Option<String>§title: Option<String>§format: ChartFormat§width: u32§height: u32§bins: u32§x_as_category: Option<bool>

Override the chart-type-specific default for how the x column is interpreted:

  • None (default): auto-detect from the first row’s x value.
    • For Bar: always categorical.
    • For Line / Scatter: numeric x → numeric axis; DATE / TIMESTAMP / TIMESTAMPTZ string → proportional time axis (positions are real Unix epoch seconds, ticks formatted in the matching kind); TEXT → categorical fallback.
  • Some(true): force categorical layout (synthetic sequential x positions, original strings as tick labels). Useful when you want even spacing on temporal data — e.g. one bar per business day with no visual gap for weekends.
  • Some(false): force numeric x. Errors for non-numeric inputs on Line / Scatter. Rarely useful on Bar.

When categorical mode is active the rendered x axis uses the original string representation of each distinct x value as its tick label, in the order x values are first seen. When time mode is active, gaps between data points reflect real wall-clock time rather than insertion order.

§x_range: Option<[f64; 2]>

Fix the x-axis range as [min, max]. When set, auto-scaling is skipped and all frames/charts share the same x extent. Useful for side-by-side comparisons or animation where a consistent scale matters. Ignored for bar charts (which use categorical positions).

§y_range: Option<[f64; 2]>

Fix the y-axis range as [min, max]. Same semantics as x_range.

§color_map: HashMap<String, RGBColor>

Map series names to hex colors ("#rrggbb"). Entries that match a series name override the default palette; unmatched series still cycle through palette colors. Only affects charts with a series column; single-series charts use the first palette color as before.

§label_points: bool

When true, draw the series name as a text label next to each dot on scatter (and each point on line) charts, and suppress the legend entirely. Useful when each series has exactly one point (e.g. one country per dot) and a legend would be redundant.

Labels are drawn 6 pixels right and 4 pixels above the data point. No collision avoidance is performed — for dense data the legend (label_points: false, the default) is usually more readable.

Trait Implementations§

Source§

impl Clone for ChartOptions

Source§

fn clone(&self) -> ChartOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ChartOptions

Source§

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

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

impl Default for ChartOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more