()
| 166 | } |
| 167 | |
| 168 | fn plot_widget() -> PlotWidget { |
| 169 | let line = Series::line_only( |
| 170 | (0..240) |
| 171 | .map(|i| { |
| 172 | let x = i as f64 / 239.0 * TAU; |
| 173 | [x, x.sin()] |
| 174 | }) |
| 175 | .collect(), |
| 176 | LineStyle::solid().with_pixel_width(2.0), |
| 177 | ) |
| 178 | .with_label("sin(x)") |
| 179 | .with_color(Color::from_rgb(0.2, 0.55, 0.9)); |
| 180 | |
| 181 | let peak = Series::markers_only(vec![[FRAC_PI_2, 1.0]], MarkerStyle::circle(6.0)) |
| 182 | .with_label("peak") |
| 183 | .with_color(Color::from_rgb(0.95, 0.25, 0.25)); |
| 184 | |
| 185 | let trough = Series::markers_only(vec![[FRAC_PI_2 * 3.0, -1.0]], MarkerStyle::circle(6.0)) |
| 186 | .with_label("trough") |
| 187 | .with_color(Color::from_rgb(0.95, 0.45, 0.15)); |
| 188 | |
| 189 | PlotWidgetBuilder::new() |
| 190 | .with_x_label("x") |
| 191 | .with_y_label("sin(x)") |
| 192 | .with_x_lim(0.0, TAU) |
| 193 | .with_y_lim(-1.25, 1.25) |
| 194 | .add_series(line) |
| 195 | .add_series(peak) |
| 196 | .add_series(trough) |
| 197 | .with_cursor_overlay(true) |
| 198 | .build() |
| 199 | .unwrap() |
| 200 | } |
| 201 | |
| 202 | fn region_style(theme: &Theme) -> container::Style { |
| 203 | let palette = theme.extended_palette(); |
no test coverage detected