MCPcopy Create free account
hub / github.com/alceal/plotlars / to_inline_html

Method to_inline_html

crates/plotlars-plotly/src/subplot_grid/mod.rs:204–219  ·  view source on GitHub ↗

Render the subplot grid as an inline HTML snippet (no DOCTYPE/head).

(&self, plot_div_id: Option<&str>)

Source from the content-addressed store, hash-verified

202
203 /// Render the subplot grid as an inline HTML snippet (no DOCTYPE/head).
204 pub fn to_inline_html(&self, plot_div_id: Option<&str>) -> String {
205 let div_id = plot_div_id.unwrap_or("plotly-div");
206 let plot_json = self.to_json().unwrap();
207 format!(
208 r#"<div>
209<script src="https://cdn.plot.ly/plotly-3.0.1.min.js"></script>
210<div id="{div_id}" class="plotly-graph-div" style="height:100%; width:100%;"></div>
211<script type="text/javascript">
212 var plotData = {plot_json};
213 Plotly.newPlot("{div_id}", plotData.traces, plotData.layout, {{responsive: true}});
214</script>
215</div>"#,
216 div_id = div_id,
217 plot_json = plot_json
218 )
219 }
220}

Callers

nothing calls this directly

Calls 1

to_jsonMethod · 0.45

Tested by

no test coverage detected