diff --git a/vl-convert-rs/src/converter.rs b/vl-convert-rs/src/converter.rs index c577f987..81ddd803 100644 --- a/vl-convert-rs/src/converter.rs +++ b/vl-convert-rs/src/converter.rs @@ -200,7 +200,9 @@ import('{url}').then((sg) => {{ let function_str = r#" function vegaToSvg(vgSpec) { let runtime = vega.parse(vgSpec); - let view = new vega.View(runtime, {renderer: 'none'}); + const baseURL = 'https://vega.github.io/vega-datasets/'; + const loader = vega.loader({ mode: 'http', baseURL }); + let view = new vega.View(runtime, {renderer: 'none', loader}); let svgPromise = view.toSVG(); return svgPromise } diff --git a/vl-convert-rs/tests/test_specs.rs b/vl-convert-rs/tests/test_specs.rs index 702a99bf..6d12f16e 100644 --- a/vl-convert-rs/tests/test_specs.rs +++ b/vl-convert-rs/tests/test_specs.rs @@ -270,6 +270,7 @@ mod test_svg { fn test( #[values( "circle_binned", + "circle_binned_base_url", "stacked_bar_h", "bar_chart_trellis_compact", "line_with_log_scale", @@ -314,6 +315,7 @@ mod test_png_no_theme { #[rstest(name, scale, case("circle_binned", 1.0), + case("circle_binned_base_url", 1.0), case("stacked_bar_h", 2.0), case("bar_chart_trellis_compact", 2.0), case("line_with_log_scale", 2.0), diff --git a/vl-convert-rs/tests/vl-specs/circle_binned_base_url.vl.json b/vl-convert-rs/tests/vl-specs/circle_binned_base_url.vl.json new file mode 100644 index 00000000..0ffbc30a --- /dev/null +++ b/vl-convert-rs/tests/vl-specs/circle_binned_base_url.vl.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "data": {"url": "data/movies.json"}, + "mark": "circle", + "encoding": { + "x": { + "bin": {"maxbins": 10}, + "field": "IMDB Rating" + }, + "y": { + "bin": {"maxbins": 10}, + "field": "Rotten Tomatoes Rating" + }, + "size": {"aggregate": "count"} + } +} \ No newline at end of file diff --git a/vl-convert-rs/tests/vl-specs/expected/v5_8/circle_binned_base_url.png b/vl-convert-rs/tests/vl-specs/expected/v5_8/circle_binned_base_url.png new file mode 100644 index 00000000..20b60541 Binary files /dev/null and b/vl-convert-rs/tests/vl-specs/expected/v5_8/circle_binned_base_url.png differ diff --git a/vl-convert-rs/tests/vl-specs/expected/v5_8/circle_binned_base_url.svg b/vl-convert-rs/tests/vl-specs/expected/v5_8/circle_binned_base_url.svg new file mode 100644 index 00000000..65c9915a --- /dev/null +++ b/vl-convert-rs/tests/vl-specs/expected/v5_8/circle_binned_base_url.svg @@ -0,0 +1 @@ +1.02.03.04.05.06.07.08.09.010.0IMDB Rating (binned)0102030405060708090100Rotten Tomatoes Rating (binned)50100150Count of Records \ No newline at end of file