diff --git a/src/dvc_render/base.py b/src/dvc_render/base.py index b299fd4..4cb26af 100644 --- a/src/dvc_render/base.py +++ b/src/dvc_render/base.py @@ -57,7 +57,6 @@ def generate_html(self, html_path=None) -> str: if partial: div_id = self.remove_special_chars(self.name) - div_id = f"plot_{div_id}" return self.DIV.format(id=div_id, partial=partial) return "" diff --git a/src/dvc_render/vega.py b/src/dvc_render/vega.py index 66da47c..a57b13f 100644 --- a/src/dvc_render/vega.py +++ b/src/dvc_render/vega.py @@ -33,6 +33,8 @@ class VegaRenderer(Renderer): EXTENSIONS = {".yml", ".yaml", ".json", ".csv", ".tsv"} def __init__(self, datapoints: List, name: str, **properties): + if name and not name.startswith("plot_"): + name = f"plot_{name}" super().__init__(datapoints, name, **properties) self.template = get_template( self.properties.get("template", None), diff --git a/tests/test_parallel_coordinates.py b/tests/test_parallel_coordinates.py index 3b8d8e2..423b734 100644 --- a/tests/test_parallel_coordinates.py +++ b/tests/test_parallel_coordinates.py @@ -144,7 +144,7 @@ def test_write_parallel_coordinates(tmp_dir): assert ParallelCoordinatesRenderer.SCRIPTS in html_text div = ParallelCoordinatesRenderer.DIV.format( - id="plot_pcp", partial=renderer.partial_html() + id="pcp", partial=renderer.partial_html() ) assert div in html_text