(&self)
| 31 | |
| 32 | impl<T: Plot> PlotlyExt for T { |
| 33 | fn plot(&self) { |
| 34 | let result = build_plotly_result(self); |
| 35 | if result.layout_overrides.is_some() { |
| 36 | // For plots with layout overrides (scene/polar domains), |
| 37 | // we must serialize traces via Trace::to_json() to capture |
| 38 | // injected keys like "scene" on Surface traces. |
| 39 | let json = ir_to_json(self).unwrap_or_default(); |
| 40 | let html = render_html_from_json(&json); |
| 41 | let temp_dir = std::env::temp_dir(); |
| 42 | let timestamp = std::time::SystemTime::now() |
| 43 | .duration_since(std::time::UNIX_EPOCH) |
| 44 | .unwrap() |
| 45 | .as_nanos(); |
| 46 | let temp_path = temp_dir.join(format!( |
| 47 | "plotlars_{}_{}.html", |
| 48 | std::process::id(), |
| 49 | timestamp |
| 50 | )); |
| 51 | std::fs::write(&temp_path, html).expect("failed to write temp html"); |
| 52 | open_html_file(&temp_path); |
| 53 | } else { |
| 54 | match env::var("EVCXR_IS_RUNTIME") { |
| 55 | Ok(_) => result.plot.evcxr_display(), |
| 56 | _ => result.plot.show(), |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | fn write_html(&self, path: impl Into<String>) { |
| 62 | let result = build_plotly_result(self); |
nothing calls this directly
no test coverage detected