MCPcopy Create free account
hub / github.com/elftausend/graplot / run

Function run

src/render/bar.rs:8–25  ·  view source on GitHub ↗
(bar: Bar, _min_y: f64, max_y: f64, steps_y: f64)

Source from the content-addressed store, hash-verified

6const DISTANCE: f32 = 80.;
7
8pub async fn run(bar: Bar, _min_y: f64, max_y: f64, steps_y: f64) {
9 let min_y = min(&bar.ys);
10
11 let y_font_size = get_font_size_y(max_y);
12 let y_half_font = y_font_size / 2.;
13
14 let step_y = (max_y) / steps_y;
15
16 let ys = divs(&bar.ys, step_y);
17
18 if min_y >= 0. {
19 return positive_only(bar, step_y, y_half_font, y_font_size, max_y, ys).await;
20 }
21 if negative(&ys) {
22 return negative_only(bar, step_y, y_half_font, y_font_size, max_y, ys).await;
23 }
24 positive_negative(bar, step_y, y_half_font, y_font_size, max_y, ys).await
25}
26
27pub async fn draw_line_with_text<T: Display>(y: f32, val: T, y_half_font: f32, y_font_size: f32) {
28 let text = format!("{}", val);

Callers

nothing calls this directly

Calls 7

minFunction · 0.85
get_font_size_yFunction · 0.85
divsFunction · 0.85
positive_onlyFunction · 0.85
negativeFunction · 0.85
negative_onlyFunction · 0.85
positive_negativeFunction · 0.85

Tested by

no test coverage detected