(plot: &impl Plot)
| 102 | } |
| 103 | |
| 104 | pub fn plot_interactive(plot: &impl Plot) { |
| 105 | if std::env::var("EVCXR_IS_RUNTIME").is_ok() { |
| 106 | let svg = render_to_svg_string(plot); |
| 107 | println!( |
| 108 | "EVCXR_BEGIN_CONTENT image/svg+xml\n{}\nEVCXR_END_CONTENT", |
| 109 | svg |
| 110 | ); |
| 111 | return; |
| 112 | } |
| 113 | |
| 114 | let tmp = std::env::temp_dir().join("plotlars_tmp.svg"); |
| 115 | let path = tmp.to_str().unwrap(); |
| 116 | save_to_file(plot, path); |
| 117 | open_file(path); |
| 118 | } |
| 119 | |
| 120 | pub fn save_to_file(plot: &impl Plot, path: &str) { |
| 121 | let (w, h) = resolve_dimensions(plot.ir_layout()); |
no test coverage detected