(frame: &mut Frame, state: &PlotState, bounds: Rectangle)
| 189 | } |
| 190 | |
| 191 | fn draw_reference_lines(frame: &mut Frame, state: &PlotState, bounds: Rectangle) { |
| 192 | for vline in state.vlines.iter() { |
| 193 | let Some(vx_plot) = data_value_to_plot_with_axis_range( |
| 194 | vline.x, |
| 195 | state.x_axis_scale, |
| 196 | vline.transform.as_ref(), |
| 197 | Some(state.camera.x_range()), |
| 198 | ) else { |
| 199 | continue; |
| 200 | }; |
| 201 | let Some(x) = world_to_screen_position_x(vx_plot, &state.camera, &bounds) else { |
| 202 | continue; |
| 203 | }; |
| 204 | draw_styled_line_segment( |
| 205 | frame, |
| 206 | iced::Point::new(x, 0.0), |
| 207 | iced::Point::new(x, bounds.height), |
| 208 | vline.line_style.line_type, |
| 209 | vline |
| 210 | .line_style |
| 211 | .width |
| 212 | .to_px(&state.camera, &bounds) |
| 213 | .max(0.5), |
| 214 | vline.color, |
| 215 | 0.0, |
| 216 | ); |
| 217 | } |
| 218 | |
| 219 | for hline in state.hlines.iter() { |
| 220 | let Some(hy_plot) = data_value_to_plot_with_axis_range( |
| 221 | hline.y, |
| 222 | state.y_axis_scale, |
| 223 | hline.transform.as_ref(), |
| 224 | Some(state.camera.y_range()), |
| 225 | ) else { |
| 226 | continue; |
| 227 | }; |
| 228 | let Some(y) = world_to_screen_position_y(hy_plot, &state.camera, &bounds) else { |
| 229 | continue; |
| 230 | }; |
| 231 | draw_styled_line_segment( |
| 232 | frame, |
| 233 | iced::Point::new(0.0, y), |
| 234 | iced::Point::new(bounds.width, y), |
| 235 | hline.line_style.line_type, |
| 236 | hline |
| 237 | .line_style |
| 238 | .width |
| 239 | .to_px(&state.camera, &bounds) |
| 240 | .max(0.5), |
| 241 | hline.color, |
| 242 | 0.0, |
| 243 | ); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | fn draw_markers(frame: &mut Frame, state: &PlotState, bounds: Rectangle) { |
| 248 | for series in state.series.iter() { |
no test coverage detected