pub struct CandleStick<X, Y>
where Y: PartialOrd,
{ /* private fields */ }
Expand description

The candlestick data point element

Implementations§

source§

impl<X, Y> CandleStick<X, Y>
where X: Clone, Y: PartialOrd,

source

pub fn new<GS, LS>( x: X, open: Y, high: Y, low: Y, close: Y, gain_style: GS, loss_style: LS, width: u32 ) -> CandleStick<X, Y>
where GS: Into<ShapeStyle>, LS: Into<ShapeStyle>,

Create a new candlestick element, which requires the Y coordinate can be compared

  • x: The x coordinate
  • open: The open value
  • high: The high value
  • low: The low value
  • close: The close value
  • gain_style: The style for gain
  • loss_style: The style for loss
  • width: The width
  • returns The newly created candlestick element
use chrono::prelude::*;
use plotters::prelude::*;

let candlestick = CandleStick::new(Local::now(), 130.0600, 131.3700, 128.8300, 129.1500, &GREEN, &RED, 15);

Trait Implementations§

source§

impl<X, Y, DB> Drawable<DB> for CandleStick<X, Y>
where Y: PartialOrd, DB: DrawingBackend,

source§

fn draw<I>( &self, points: I, backend: &mut DB, _: (u32, u32) ) -> Result<(), DrawingErrorKind<<DB as DrawingBackend>::ErrorType>>
where I: Iterator<Item = (i32, i32)>,

Actually draws the element. The key points is already translated into the image coordinate and can be used by DC directly
source§

impl<'a, X, Y> PointCollection<'a, (X, Y)> for &'a CandleStick<X, Y>
where X: 'a, Y: PartialOrd + 'a,

§

type Point = &'a (X, Y)

The item in point iterator
§

type IntoIter = &'a [(X, Y)]

The point iterator
source§

fn point_iter(self) -> &'a [(X, Y)]

framework to do the coordinate mapping

Auto Trait Implementations§

§

impl<X, Y> RefUnwindSafe for CandleStick<X, Y>

§

impl<X, Y> Send for CandleStick<X, Y>
where X: Send, Y: Send,

§

impl<X, Y> Sync for CandleStick<X, Y>
where X: Sync, Y: Sync,

§

impl<X, Y> Unpin for CandleStick<X, Y>
where X: Unpin, Y: Unpin,

§

impl<X, Y> UnwindSafe for CandleStick<X, Y>
where X: UnwindSafe, Y: UnwindSafe,

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> 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<'b, T, DB, Coord> IntoDynElement<'b, DB, Coord> for T
where T: Drawable<DB> + 'b, &'a T: for<'a> PointCollection<'a, Coord>, Coord: Clone, DB: DrawingBackend,

source§

fn into_dyn(self) -> DynElement<'b, DB, Coord>

Make the conversion
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.