Render plot JSON (possibly with overrides) to a standalone HTML document.
(plot_json: &str)
| 31 | |
| 32 | /// Render plot JSON (possibly with overrides) to a standalone HTML document. |
| 33 | pub(crate) fn render_html_from_json(plot_json: &str) -> String { |
| 34 | format!( |
| 35 | r#"<html> |
| 36 | <head><meta charset="utf-8" /></head> |
| 37 | <body> |
| 38 | <div id="plotly-div" style="height:100%; width:100%;"></div> |
| 39 | <script src="https://cdn.plot.ly/plotly-3.0.1.min.js"></script> |
| 40 | <script type="text/javascript"> |
| 41 | var plotData = {plot_json}; |
| 42 | Plotly.newPlot("plotly-div", plotData.traces, plotData.layout, {{}}); |
| 43 | </script> |
| 44 | </body> |
| 45 | </html>"#, |
| 46 | plot_json = plot_json |
| 47 | ) |
| 48 | } |
| 49 | |
| 50 | /// Render plot JSON to an inline HTML snippet. |
| 51 | pub(crate) fn render_inline_html_from_json(plot_json: &str, div_id: &str) -> String { |
no outgoing calls
no test coverage detected