Skip to main content

ChartConfig

Struct ChartConfig 

Source
#[non_exhaustive]
pub struct ChartConfig {
Show 86 fields pub bullish_color: Color32, pub bearish_color: Color32, pub bullish_border_color: Option<Color32>, pub bearish_border_color: Option<Color32>, pub bullish_wick_color: Option<Color32>, pub bearish_wick_color: Option<Color32>, pub price_source: PriceSource, pub conflation_threshold: Option<f32>, pub background_color: Color32, pub background_style: BackgroundStyle, pub grid_color: Color32, pub vertical_grid_color: Option<Color32>, pub grid_line_style: LineStyle, pub vertical_grid_line_style: Option<LineStyle>, pub text_color: Color32, pub axis_font_size: Option<f32>, pub thousands_sep: Option<char>, pub candle_width: f32, pub wick_width: f32, pub candle_border_width: f32, pub show_grid: bool, pub show_horizontal_grid: bool, pub show_vertical_grid: bool, pub show_volume: bool, pub volume_height_fraction: f32, pub volume_baseline_inset: f32, pub padding: f32, pub show_time_labels: bool, pub show_ohlc_info: bool, pub title_as_description: bool, pub show_quote_boxes: bool, pub show_ohlc_change: bool, pub show_ohlc_change_percent: bool, pub show_legend_volume: bool, pub show_indicator_inputs: bool, pub show_legend_badge: bool, pub show_market_status: bool, pub show_last_day_change: bool, pub indicator_backdrop_opacity: f32, pub show_currency: bool, pub show_unit: bool, pub show_scale_mode_buttons: bool, pub show_plus_button: bool, pub show_extended_session_price: bool, pub extended_session_price_color: Color32, pub show_right_axis: bool, pub show_left_axis: bool, pub right_axis_width: f32, pub left_axis_width: f32, pub price_axis: PriceAxisOptions, pub right_axis_scale_mode: PriceScaleMode, pub left_axis_scale_mode: PriceScaleMode, pub show_symbol_labels: bool, pub show_symbol_last_val: bool, pub show_price_line: bool, pub show_prev_close_line: bool, pub show_symbol_prev_close: bool, pub show_indicator_labels: bool, pub show_indicator_last_val: bool, pub lock_price_to_bar_ratio: bool, pub scale_price_chart_only: bool, pub show_bid_ask: bool, pub show_high_low: bool, pub show_countdown: bool, pub show_realtime_btn: bool, pub realtime_button_pos: RealtimeButtonPos, pub realtime_button_text: Option<String>, pub realtime_button_size: (f32, f32), pub realtime_button_color: Color32, pub realtime_button_hover_color: Color32, pub realtime_button_text_color: Color32, pub navigation_buttons: NavigationButtons, pub pane_buttons: NavigationButtons, pub show_session_breaks: bool, pub session_break_color: Color32, pub session_break_style: LineStyle, pub session_config: Option<SessionConfig>, pub show_extended_hours: bool, pub extended_hours_color: Color32, pub show_watermark: bool, pub watermark_text: Option<String>, pub watermark_description: bool, pub watermark_color: Color32, pub watermark_font_size: f32, pub watermark_pos: WatermarkPos, pub skip_background: bool,
}
Expand description

Configuration for chart visual appearance.

Controls every aspect of chart styling: candle/bar colors, grid lines, axis visibility, volume panel sizing, session break rendering, watermark overlay, and the real-time navigation button.

Defaults follow a common dark-theme charting palette.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§bullish_color: Color32

Color for bullish (up) bars/candles body

§bearish_color: Color32

Color for bearish (down) bars/candles body

§bullish_border_color: Option<Color32>

Border color for bullish candles (None = same as body)

§bearish_border_color: Option<Color32>

Border color for bearish candles (None = same as body)

§bullish_wick_color: Option<Color32>

Wick color for bullish candles (None = same as border or body)

§bearish_wick_color: Option<Color32>

Wick color for bearish candles (None = same as border or body)

§price_source: PriceSource

Price source for line-based charts (Line, Area, StepLine, etc.)

§conflation_threshold: Option<f32>

Minimum spacing in physical pixels for unmerged main-series samples; None disables conflation. The default, Some(1.0), preserves the one-pixel grouping. Below the threshold, consecutive bars form groups of the smallest power of two whose spacing reaches it, capped at 2^30 bars. For example, 0.25 points at two pixels per point gives groups of two at a threshold of 1, and four at a threshold of 2. Equality stays unmerged. Non-positive and non-finite thresholds use 1. Price-based chart types stay unmerged; gaps and per-bar colours keep their source samples even within a group. Chart::prepare_conflation prepares these groups before rendering. Saved configurations without this field keep the default.

§background_color: Color32

Background color for the chart (used when background_style is Solid)

§background_style: BackgroundStyle

Background style (Solid, VerticalGradient, HorizontalGradient)

§grid_color: Color32

Grid line color

§vertical_grid_color: Option<Color32>

Vertical grid colour; None follows grid_color.

§grid_line_style: LineStyle

Grid line style, dotted by default.

§vertical_grid_line_style: Option<LineStyle>

Vertical grid line style; None follows grid_line_style.

§text_color: Color32

Text color for labels

§axis_font_size: Option<f32>

Font size of the price and time axis labels in logical pixels; None follows the theme. Default: None

§thousands_sep: Option<char>

Character that groups the thousands of the built-in price labels: the ticks and tags of price scales, the crosshair label and the legend’s prices write 42,541.77 with the default ','. None writes plain digits (42541.77), and so do '.' and the ASCII digits, since built-in labels always write '.' as the decimal point. Labels written by a host formatter (Chart::set_price_formatter) are never grouped; study panes, tooltips and volumes keep their own formats. Layouts saved without this field restore with the default. Default: Some(',')

§candle_width: f32

Width of candlestick/bar bodies as a fraction of available space (0.0 to 1.0)

§wick_width: f32

Stroke width for candlestick wicks

§candle_border_width: f32

Stroke width for candle borders (0 = no border)

§show_grid: bool

Master visibility switch for horizontal and vertical grid lines

§show_horizontal_grid: bool

Whether to show horizontal grid lines

§show_vertical_grid: bool

Whether to show vertical grid lines

§show_volume: bool

Whether to show volume bars

§volume_height_fraction: f32

Volume height as a fraction of the price pane above volume_baseline_inset

§volume_baseline_inset: f32

Distance in points from the volume baseline to the price pane bottom (12 by default).

§padding: f32

Padding around the plot, excluding the axes and floating legend.

§show_time_labels: bool

Whether to show time labels on X-axis

§show_ohlc_info: bool

Whether to show OHLC info header

§title_as_description: bool

Use the host description rather than the ticker in the legend title.

§show_quote_boxes: bool

Show the current bid and ask controls in the legend.

§show_ohlc_change: bool

Show absolute bar change in the legend.

§show_ohlc_change_percent: bool

Show percentage bar change in the legend.

§show_legend_volume: bool

Show volume in the legend independently of the histogram.

§show_indicator_inputs: bool

Show host-supplied study inputs in the legend.

§show_legend_badge: bool

Show the symbol’s logo before the legend title: the legend badge, else the instrument’s logo, else the symbol’s initial on a neutral disc.

§show_market_status: bool

Show the market status after the legend title: the session’s state and delayed or end-of-day data.

§show_last_day_change: bool

Show the change of the last price from the previous session’s close in the legend.

§indicator_backdrop_opacity: f32

Opacity of the study rows’ backdrop, from 0 to 1.

§show_currency: bool

Show the host-supplied currency above the price ticks.

§show_unit: bool

Show the host-supplied price unit above the price ticks.

§show_scale_mode_buttons: bool

Show Auto, Log and Percent buttons in chart navigation.

§show_plus_button: bool

Enable the crosshair price tag action that opens the host’s price menu.

§show_extended_session_price: bool

Show the host-supplied extended-session price tag independently of the last price.

§extended_session_price_color: Color32

Colour of the extended-session price tag.

§show_right_axis: bool

Whether to show right price axis

§show_left_axis: bool

Whether to show left price axis

§right_axis_width: f32

Minimum right price axis width in pixels; current labels can grow the column.

§left_axis_width: f32

Minimum left price axis width in pixels; current labels can grow the column.

§price_axis: PriceAxisOptions

Border, tick marks and label clipping of the price axis

§right_axis_scale_mode: PriceScaleMode

Scale mode for right price axis (Normal, Logarithmic, Percentage, IndexedTo100)

§left_axis_scale_mode: PriceScaleMode

Scale mode for left price axis (Normal, Logarithmic, Percentage, IndexedTo100)

§show_symbol_labels: bool

Whether to show symbol name labels

§show_symbol_last_val: bool

Whether to show last price value

§show_price_line: bool

Draw a line at the latest close independently of its tag.

§show_prev_close_line: bool

Draw a line at the preceding session close independently of its tag.

§show_symbol_prev_close: bool

Whether to show previous close value line

§show_indicator_labels: bool

Whether to show indicator name labels

§show_indicator_last_val: bool

Whether to show indicator last values

§lock_price_to_bar_ratio: bool

Preserve price units per bar when the time scale zooms or the pane resizes.

§scale_price_chart_only: bool

Exclude overlay studies and their primitives from the main price scale’s autoscale range, without hiding them or changing their individual autoscale settings.

§show_bid_ask: bool

Draw the latest valid bid and ask lines and axis values supplied by the host.

§show_high_low: bool

Draw the highest high and lowest low of the visible bars on the price scale.

§show_countdown: bool

Whether to show countdown to next candle

§show_realtime_btn: bool

Whether to show the scroll-to-latest button when scrolled away from the live edge.

§realtime_button_pos: RealtimeButtonPos

Position of the realtime button; bottom-right by default.

§realtime_button_text: Option<String>

Custom text for the realtime button (None draws a double right chevron).

§realtime_button_size: (f32, f32)

Size of the realtime button (width, height), 28 by 28 points by default.

§realtime_button_color: Color32

Background color for the realtime button; PLACEHOLDER follows the theme.

§realtime_button_hover_color: Color32

Hover background color for the realtime button; PLACEHOLDER follows the theme.

§realtime_button_text_color: Color32

Text or icon color for the realtime button; PLACEHOLDER follows the theme.

§navigation_buttons: NavigationButtons

When to show the navigation buttons.

§pane_buttons: NavigationButtons

When to show the maximize and menu buttons of the panes.

§show_session_breaks: bool

Whether to show session break vertical lines

§session_break_color: Color32

Color for session break lines

§session_break_style: LineStyle

Style for session break lines

§session_config: Option<SessionConfig>

Session configuration (market hours)

§show_extended_hours: bool

Shade bars identified as extended hours by the session metadata.

§extended_hours_color: Color32

Extended-hours fill. PLACEHOLDER uses the active theme accent at low opacity.

§show_watermark: bool

Whether to show the symbol watermark.

§watermark_text: Option<String>

Text of the symbol watermark; \n starts another line. None shows the symbol and the interval, such as AAPL, 1D, which follow symbol and interval changes.

§watermark_description: bool

Without watermark_text, adds the instrument’s description on a second line. Absent in configurations saved before it existed, where it reads as false.

§watermark_color: Color32

Watermark color (typically semi-transparent)

§watermark_font_size: f32

Font size of watermark_text. The symbol and interval line is twice this size and the description line 11/12 of it.

§watermark_pos: WatermarkPos

Watermark position

§skip_background: bool

Skip background rendering (use when chart is inside a container with its own background)

Implementations§

Source§

impl ChartConfig

Source

pub fn with_theme(self, theme: &Theme) -> Self

Apply the theme’s background, grid, axis text, candle, session break and watermark colours to this configuration.

Only the configuration changes. A chart paints its legend, quote boxes, labels and overlays from its own theme, which ChartBuilder::with_theme keeps for that chart, so switch a chart’s theme with Chart::set_theme or Chart::set_theme_override, which apply these colours too.

Trait Implementations§

Source§

impl Clone for ChartConfig

Source§

fn clone(&self) -> ChartConfig

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 ChartConfig

Source§

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

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

impl Default for ChartConfig

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for ChartConfig

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 PartialEq for ChartConfig

Source§

fn eq(&self, other: &ChartConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ChartConfig

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

impl StructuralPartialEq for ChartConfig

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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<T> MaybeSend for T
where T: Send + Sync + ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

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.