Struct plotly::traces::Ohlc

source ·
pub struct Ohlc<X, O>where
    X: Serialize + Clone,
    O: Serialize + Clone,{ /* private fields */ }
Expand description

Construct an OHLC trace.

Examples

use plotly::Ohlc;

let trace = Ohlc::new(
    vec!["2022-08-22", "2022-08-23"],
    vec![5, 6],
    vec![8, 10],
    vec![2, 4],
    vec![6, 7],
);

let expected = serde_json::json!({
    "type": "ohlc",
    "x": ["2022-08-22", "2022-08-23"],
    "open": [5, 6],        
    "high": [8, 10],
    "low": [2, 4],
    "close": [6, 7]
});

assert_eq!(serde_json::to_value(trace).unwrap(), expected);

Implementations§

source§

impl<X, O> Ohlc<X, O>where X: Serialize + Clone, O: Serialize + Clone,

source

pub fn x(self, value: Vec<X>) -> Self

source

pub fn open(self, value: Vec<O>) -> Self

source

pub fn high(self, value: Vec<O>) -> Self

source

pub fn low(self, value: Vec<O>) -> Self

source

pub fn close(self, value: Vec<O>) -> Self

source

pub fn decreasing(self, value: Direction) -> Self

source

pub fn hover_info(self, value: HoverInfo) -> Self

source

pub fn hover_label(self, value: Label) -> Self

source

pub fn hover_text(self, value: impl AsRef<str>) -> Self

source

pub fn hover_text_array(self, value: Vec<impl AsRef<str>>) -> Self

source

pub fn increasing(self, value: Direction) -> Self

source

pub fn legend_group(self, value: impl AsRef<str>) -> Self

source

pub fn legend_group_title(self, value: LegendGroupTitle) -> Self

source

pub fn line(self, value: Line) -> Self

source

pub fn name(self, value: impl AsRef<str>) -> Self

source

pub fn opacity(self, value: f64) -> Self

source

pub fn show_legend(self, value: bool) -> Self

source

pub fn text(self, value: impl AsRef<str>) -> Self

source

pub fn text_array(self, value: Vec<impl AsRef<str>>) -> Self

source

pub fn tick_width(self, value: f64) -> Self

source

pub fn visible(self, value: Visible) -> Self

source

pub fn x_calendar(self, value: Calendar) -> Self

source§

impl<X, O> Ohlc<X, O>where X: Serialize + Clone, O: Serialize + Clone,

source

pub fn new( x: Vec<X>, open: Vec<O>, high: Vec<O>, low: Vec<O>, close: Vec<O> ) -> Box<Self>

Trait Implementations§

source§

impl<X, O> Clone for Ohlc<X, O>where X: Serialize + Clone + Clone, O: Serialize + Clone + Clone,

source§

fn clone(&self) -> Ohlc<X, O>

Returns a copy 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<X, O> Debug for Ohlc<X, O>where X: Serialize + Clone + Debug, O: Serialize + Clone + Debug,

source§

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

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

impl<X, O> Default for Ohlc<X, O>where X: Serialize + Clone, O: Serialize + Clone,

source§

fn default() -> Self

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

impl<X, O> Serialize for Ohlc<X, O>where X: Serialize + Clone + Serialize, O: Serialize + Clone + Serialize,

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<X, O> Trace for Ohlc<X, O>where X: Serialize + Clone, O: Serialize + Clone,

source§

fn to_json(&self) -> String

Auto Trait Implementations§

§

impl<X, O> !RefUnwindSafe for Ohlc<X, O>

§

impl<X, O> Send for Ohlc<X, O>where O: Send, X: Send,

§

impl<X, O> Sync for Ohlc<X, O>where O: Sync, X: Sync,

§

impl<X, O> Unpin for Ohlc<X, O>where O: Unpin, X: Unpin,

§

impl<X, O> !UnwindSafe for Ohlc<X, O>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere 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, U> Into<U> for Twhere 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> Serialize for Twhere T: Serialize + ?Sized,

source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>

source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V