MCPcopy Create free account
hub / github.com/angular-rust/ux-charts / calculate_percent

Method calculate_percent

src/basechart.rs:575–590  ·  view source on GitHub ↗
(&self, time: Option<i64>)

Source from the content-addressed store, hash-verified

573 }
574
575 pub fn calculate_percent(&self, time: Option<i64>) -> f64 {
576 let mut percent = 1.0;
577 let mut props = self.props.borrow_mut();
578
579 if props.animation_start_time.is_none() {
580 props.animation_start_time = time
581 }
582
583 if let Some(time) = time {
584 let duration = self.options.animation().duration;
585 if duration > 0 {
586 percent = (time - props.animation_start_time.unwrap()) as f64 / duration as f64;
587 }
588 }
589 percent
590 }
591}
592
593impl<'a, C, E, M, D, O> Chart<'a, C, M, D, E> for BaseChart<'a, C, E, M, D, O>

Callers 5

draw_frameMethod · 0.80
draw_frameMethod · 0.80
draw_frameMethod · 0.80
draw_frameMethod · 0.80
draw_frameMethod · 0.80

Calls 1

animationMethod · 0.80

Tested by

no test coverage detected