Struct 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: impl Into<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>

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> Freeze for Ohlc<X, O>

§

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

§

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

§

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

§

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

§

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

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

Source§

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

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V