def render( repo, plots_data, metrics=None, path=None, html_template_path=None, refresh_seconds=None, ): # TODO we could probably remove repo usages (here and in VegaRenderer) renderers = match_renderers(plots_data, repo.plots.templates) if not html_template_path: html_template_path = repo.config.get("plots", {}).get("html_template", None) if html_template_path and not os.path.isabs(html_template_path): html_template_path = os.path.join(repo.dvc_dir, html_template_path) from dvc.render.html import write return write( path, renderers, metrics=metrics, template_path=html_template_path, refresh_seconds=refresh_seconds, )
def to_parallel_coordinates(self, output_path: "StrPath", color_by: str = None) -> str: from dvc.render.html import write from dvc.render.plotly import ParallelCoordinatesRenderer index_path = write( output_path, renderers=[ ParallelCoordinatesRenderer(self, color_by, self._fill_value) ], ) return index_path.as_uri()
def test_write_parallel_coordinates(tmp_dir): td = TabularData(["categorical", "scalar"]) td.extend([["foo", "0.1"], ["bar", "2"]]) renderer = ParallelCoordinatesRenderer(td) html_path = write(tmp_dir, renderers=[renderer]) html_text = html_path.read_text() assert ParallelCoordinatesRenderer.SCRIPTS in html_text div = ParallelCoordinatesRenderer.DIV.format(id="plot_experiments", partial=renderer.as_json()) assert div in html_text
def render( repo, renderers, metrics=None, path=None, html_template_path=None, refresh_seconds=None, ): if not html_template_path: html_template_path = repo.config.get("plots", {}).get( "html_template", None ) if html_template_path and not os.path.isabs(html_template_path): html_template_path = os.path.join(repo.dvc_dir, html_template_path) from dvc.render.html import write return write( path, renderers, metrics=metrics, template_path=html_template_path, refresh_seconds=refresh_seconds, )