pub struct ChartParams {Show 19 fields
pub sql: String,
pub chart_type: String,
pub x: Option<String>,
pub y: Option<String>,
pub series: Option<String>,
pub title: Option<String>,
pub format: Option<String>,
pub width: Option<u32>,
pub height: Option<u32>,
pub bins: Option<u32>,
pub x_as_category: Option<bool>,
pub x_range: Option<[f64; 2]>,
pub y_range: Option<[f64; 2]>,
pub color_map: Option<HashMap<String, String>>,
pub label_points: Option<bool>,
pub output_path: Option<String>,
pub inline: Option<bool>,
pub overwrite: Option<bool>,
pub database: Option<String>,
}Expand description
Parameters for the chart tool.
Fields§
§sql: StringSQL query returning the data to plot (read-only SELECT/WITH/EXPLAIN/SHOW/VALUES)
chart_type: StringChart type: bar, line, scatter, or histogram
x: Option<String>X-axis column name (required for bar/line/scatter; histogram uses this as the value column)
y: Option<String>Y-axis column name (required for bar/line/scatter)
series: Option<String>Optional series/grouping column for colored/grouped multi-series charts
title: Option<String>Chart title
format: Option<String>Output format: “png” (default) or “svg”
width: Option<u32>Width in pixels (default 800)
height: Option<u32>Height in pixels (default 480)
bins: Option<u32>Number of bins for histograms (default 20)
x_as_category: Option<bool>Treat the x column as categorical rather than numeric. Auto-detected from the first row’s x value for line/scatter charts: DATE, TIMESTAMP, TEXT, and other non-numeric types flip to categorical automatically. Set explicitly to override auto-detection. Bar charts are always categorical regardless of this flag.
x_range: Option<[f64; 2]>Fix the x-axis range as [min, max]. Omit to auto-scale. Useful when comparing multiple charts at a consistent scale (e.g. [0, 1500] for population in millions) or when an outlier would distort auto-scaling. Ignored for bar charts (which use categorical x positions).
y_range: Option<[f64; 2]>Fix the y-axis range as [min, max]. Omit to auto-scale. Example: [0.0, 1.0] to pin a 0–1 index axis regardless of the data.
color_map: Option<HashMap<String, String>>Map series names to hex colors (“#rrggbb”). Series not listed here
fall back to the default color palette. Example:
{“India”: “#e41a1c”, “China”: “#ff7f0e”}. Only meaningful when a
series column is set.
label_points: Option<bool>When true, draw the series name as a text label next to each dot (scatter) or point (line) and suppress the legend box. Best when each series has exactly one point (e.g. one country per dot). Defaults to false (legend shown).
output_path: Option<String>Where to write the rendered image. Parent directory is created
automatically. If omitted, a file is auto-generated under the
system temp dir (<temp>/hyperdb-charts/chart-<ts>-<pid>-<n>.<ext>).
Combine with inline=true to receive the bytes inline AND write
a file; otherwise the file is the sole output.
inline: Option<bool>When true, include the PNG/SVG bytes inline in the tool result.
Without output_path this also skips the disk write entirely
(pure inline). With output_path the file is written and the
image is returned inline. Defaults to true so MCP clients can
display the chart without a separate file-read round-trip.
overwrite: Option<bool>When false, refuse to overwrite an existing file at output_path
and return PERMISSION_DENIED without touching it. Defaults to
true (overwrite silently), matching the export tool.
database: Option<String>Target database alias for unqualified name resolution in the
chart’s SQL. Omit to query the ephemeral primary. Pass
"persistent" or a user-attached alias to chart from there.
Trait Implementations§
Source§impl Debug for ChartParams
impl Debug for ChartParams
Source§impl<'de> Deserialize<'de> for ChartParams
impl<'de> Deserialize<'de> for ChartParams
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ChartParams
impl JsonSchema for ChartParams
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for ChartParams
impl RefUnwindSafe for ChartParams
impl Send for ChartParams
impl Sync for ChartParams
impl Unpin for ChartParams
impl UnsafeUnpin for ChartParams
impl UnwindSafe for ChartParams
Blanket Implementations§
impl<T> Allocation for T
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
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request