(style_choice: StyleChoice)
| 106 | } |
| 107 | |
| 108 | fn plot_widget(style_choice: StyleChoice) -> PlotWidget { |
| 109 | let line = Series::line_only( |
| 110 | (0..320) |
| 111 | .map(|i| { |
| 112 | let x = i as f64 * 0.04; |
| 113 | [x, (x * 0.85).sin() + 0.2 * (x * 0.2).cos()] |
| 114 | }) |
| 115 | .collect(), |
| 116 | LineStyle::solid(), |
| 117 | ) |
| 118 | .with_label("signal") |
| 119 | .with_color(Color::from_rgb(0.2, 0.72, 0.98)); |
| 120 | |
| 121 | let markers = Series::markers_only( |
| 122 | (0..70) |
| 123 | .map(|i| { |
| 124 | let x = i as f64 * 0.18; |
| 125 | [x, 0.65 * (x * 0.6).cos() - 0.1] |
| 126 | }) |
| 127 | .collect(), |
| 128 | MarkerStyle::square(5.5), |
| 129 | ) |
| 130 | .with_label("samples") |
| 131 | .with_color(Color::from_rgb(1.0, 0.55, 0.3)); |
| 132 | |
| 133 | PlotWidgetBuilder::new() |
| 134 | .with_x_label("X label") |
| 135 | .with_cursor_overlay(true) |
| 136 | .with_crosshairs(true) |
| 137 | .with_style(style_choice.style_fn()) |
| 138 | .add_series(line) |
| 139 | .add_series(markers) |
| 140 | .build() |
| 141 | .unwrap() |
| 142 | } |
| 143 | |
| 144 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 145 | enum ThemeChoice { |
no test coverage detected