Skip to content

Commit

Permalink
Update with Vega-Lite 5.16.0 and remove 5.7 (#120)
Browse files Browse the repository at this point in the history
* Compute include! paths from directory structure instead of import_map.json

* Add Vega-Lite 5.16.0, drop 5.7

* Update tests

* Update Vega-Lite versions in CLI help

* clippy / strip_prefix
  • Loading branch information
jonmmease authored Oct 11, 2023
1 parent 792622f commit d3f95b0
Show file tree
Hide file tree
Showing 23 changed files with 198 additions and 244 deletions.
6 changes: 3 additions & 3 deletions vl-convert-python/tests/test_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def load_expected_png(name, vl_version, theme=None):
"vl_version",
[
"v4_17",
"v5_7",
"v5_8",
"v5_9",
"v5_10",
Expand All @@ -70,6 +69,7 @@ def load_expected_png(name, vl_version, theme=None):
"v5_13",
"v5_14",
"v5_15",
"v5_16",
],
)
@pytest.mark.parametrize("as_dict", [False, True])
Expand All @@ -93,7 +93,6 @@ def test_vega(name, vl_version, as_dict):
@pytest.mark.parametrize(
"vl_version",
[
"5.7",
"5.8",
"5.9",
"5.10",
Expand All @@ -102,6 +101,7 @@ def test_vega(name, vl_version, as_dict):
"5.13",
"5.14",
"5.15",
"5.16",
],
)
def test_vegalite_to_html_no_bundle(name, vl_version):
Expand Down Expand Up @@ -129,7 +129,6 @@ def test_vegalite_to_html_no_bundle(name, vl_version):
@pytest.mark.parametrize(
"vl_version",
[
"5.7",
"5.8",
"5.9",
"5.10",
Expand All @@ -138,6 +137,7 @@ def test_vegalite_to_html_no_bundle(name, vl_version):
"5.13",
"5.14",
"5.15",
"5.16",
],
)
def test_vegalite_to_html_bundle(name, vl_version):
Expand Down
210 changes: 103 additions & 107 deletions vl-convert-rs/src/module_loader/import_map.rs

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions vl-convert-rs/tests/test_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ mod test_vegalite_to_vega {
fn test(
#[values(
VlVersion::v4_17,
VlVersion::v5_7,
VlVersion::v5_8,
VlVersion::v5_9,
VlVersion::v5_10,
Expand All @@ -233,6 +232,7 @@ mod test_vegalite_to_vega {
VlVersion::v5_13,
VlVersion::v5_14,
VlVersion::v5_15,
VlVersion::v5_16,
)]
vl_version: VlVersion,

Expand Down Expand Up @@ -269,15 +269,15 @@ mod test_vegalite_to_html_no_bundle {
#[rstest]
fn test(
#[values(
VlVersion::v5_7,
VlVersion::v5_8,
VlVersion::v5_9,
VlVersion::v5_10,
VlVersion::v5_11,
VlVersion::v5_12,
VlVersion::v5_13,
VlVersion::v5_14,
VlVersion::v5_15,
VlVersion::v5_8,
VlVersion::v5_9,
VlVersion::v5_10,
VlVersion::v5_11,
VlVersion::v5_12,
VlVersion::v5_13,
VlVersion::v5_14,
VlVersion::v5_15,
VlVersion::v5_16,
)]
vl_version: VlVersion,

Expand Down Expand Up @@ -317,7 +317,6 @@ mod test_vegalite_to_html_bundle {
#[rstest]
fn test(
#[values(
VlVersion::v5_7,
VlVersion::v5_8,
VlVersion::v5_9,
VlVersion::v5_10,
Expand All @@ -326,6 +325,7 @@ mod test_vegalite_to_html_bundle {
VlVersion::v5_13,
VlVersion::v5_14,
VlVersion::v5_15,
VlVersion::v5_16,
)]
vl_version: VlVersion,

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"$schema":"https://vega.github.io/schema/vega/v5.json","background":"white","padding":5,"width":600,"title":{"text":"Seattle Weather, 2012-2015","anchor":"start"},"data":[{"name":"brush_store"},{"name":"click_store"},{"name":"source_0","url":"https://raw.githubusercontent.com/vega/vega-datasets/next/data/seattle-weather.csv","format":{"type":"csv","parse":{"date":"date"}}},{"name":"data_0","source":"source_0","transform":[{"type":"filter","expr":"!length(data(\"click_store\")) || vlSelectionTest(\"click_store\", datum)"},{"field":"date","type":"timeunit","units":["month","date"],"as":["monthdate_date","monthdate_date_end"]},{"type":"filter","expr":"(isDate(datum[\"monthdate_date\"]) || (isValid(datum[\"monthdate_date\"]) && isFinite(+datum[\"monthdate_date\"]))) && isValid(datum[\"temp_max\"]) && isFinite(+datum[\"temp_max\"]) && isValid(datum[\"precipitation\"]) && isFinite(+datum[\"precipitation\"])"}]},{"name":"data_1","source":"source_0","transform":[{"field":"date","type":"timeunit","units":["month","date"],"as":["monthdate_date","monthdate_date_end"]},{"type":"filter","expr":"!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum)"},{"type":"aggregate","groupby":["weather"],"ops":["count"],"fields":[null],"as":["__count"]}]}],"signals":[{"name":"concat_0_height","value":300},{"name":"concat_1_y_step","value":20},{"name":"concat_1_height","update":"bandspace(domain('concat_1_y').length, 0.1, 0.05) * concat_1_y_step"},{"name":"unit","value":{},"on":[{"events":"pointermove","update":"isTuple(group()) ? group() : unit"}]},{"name":"brush","update":"vlSelectionResolve(\"brush_store\", \"union\")"},{"name":"click","update":"vlSelectionResolve(\"click_store\", \"union\", true, true)"}],"layout":{"padding":20,"columns":1,"bounds":"full","align":"each"},"marks":[{"type":"group","name":"concat_0_group","style":"cell","encode":{"update":{"width":{"signal":"width"},"height":{"signal":"concat_0_height"}}},"signals":[{"name":"brush_x","value":[],"on":[{"events":{"source":"scope","type":"pointerdown","filter":["!event.item || event.item.mark.name !== \"brush_brush\""]},"update":"[x(unit), x(unit)]"},{"events":{"source":"window","type":"pointermove","consume":true,"between":[{"source":"scope","type":"pointerdown","filter":["!event.item || event.item.mark.name !== \"brush_brush\""]},{"source":"window","type":"pointerup"}]},"update":"[brush_x[0], clamp(x(unit), 0, width)]"},{"events":{"signal":"brush_scale_trigger"},"update":"[scale(\"concat_0_x\", brush_monthdate_date[0]), scale(\"concat_0_x\", brush_monthdate_date[1])]"},{"events":[{"source":"view","type":"dblclick"}],"update":"[0, 0]"},{"events":{"signal":"brush_translate_delta"},"update":"clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, width)"},{"events":{"signal":"brush_zoom_delta"},"update":"clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, width)"}]},{"name":"brush_monthdate_date","on":[{"events":{"signal":"brush_x"},"update":"brush_x[0] === brush_x[1] ? null : invert(\"concat_0_x\", brush_x)"}]},{"name":"brush_scale_trigger","value":{},"on":[{"events":[{"scale":"concat_0_x"}],"update":"(!isArray(brush_monthdate_date) || (+invert(\"concat_0_x\", brush_x)[0] === +brush_monthdate_date[0] && +invert(\"concat_0_x\", brush_x)[1] === +brush_monthdate_date[1])) ? brush_scale_trigger : {}"}]},{"name":"brush_tuple","on":[{"events":[{"signal":"brush_monthdate_date"}],"update":"brush_monthdate_date ? {unit: \"concat_0\", fields: brush_tuple_fields, values: [brush_monthdate_date]} : null"}]},{"name":"brush_tuple_fields","value":[{"field":"monthdate_date","channel":"x","type":"R"}]},{"name":"brush_translate_anchor","value":{},"on":[{"events":[{"source":"scope","type":"pointerdown","markname":"brush_brush"}],"update":"{x: x(unit), y: y(unit), extent_x: slice(brush_x)}"}]},{"name":"brush_translate_delta","value":{},"on":[{"events":[{"source":"window","type":"pointermove","consume":true,"between":[{"source":"scope","type":"pointerdown","markname":"brush_brush"},{"source":"window","type":"pointerup"}]}],"update":"{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}"}]},{"name":"brush_zoom_anchor","on":[{"events":[{"source":"scope","type":"wheel","consume":true,"markname":"brush_brush"}],"update":"{x: x(unit), y: y(unit)}"}]},{"name":"brush_zoom_delta","on":[{"events":[{"source":"scope","type":"wheel","consume":true,"markname":"brush_brush"}],"force":true,"update":"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]},{"name":"brush_modify","on":[{"events":{"signal":"brush_tuple"},"update":"modify(\"brush_store\", brush_tuple, true)"}]}],"marks":[{"name":"brush_brush_bg","type":"rect","clip":true,"encode":{"enter":{"fill":{"value":"#333"},"fillOpacity":{"value":0.125}},"update":{"x":[{"test":"data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"","signal":"brush_x[0]"},{"value":0}],"y":[{"test":"data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"","value":0},{"value":0}],"x2":[{"test":"data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"","signal":"brush_x[1]"},{"value":0}],"y2":[{"test":"data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"","field":{"group":"height"}},{"value":0}]}}},{"name":"concat_0_marks","type":"symbol","style":["point"],"interactive":true,"from":{"data":"data_0"},"encode":{"update":{"opacity":{"value":0.7},"fill":{"value":"transparent"},"stroke":[{"test":"!length(data(\"brush_store\")) || vlSelectionTest(\"brush_store\", datum)","scale":"color","field":"weather"},{"value":"lightgray"}],"ariaRoleDescription":{"value":"point"},"description":{"signal":"\"Date: \" + (timeFormat(datum[\"monthdate_date\"], '%b')) + \"; Maximum Daily Temperature (C): \" + (format(datum[\"temp_max\"], \"\")) + \"; Weather: \" + (isValid(datum[\"weather\"]) ? datum[\"weather\"] : \"\"+datum[\"weather\"]) + \"; Precipitation: \" + (format(datum[\"precipitation\"], \"\"))"},"x":{"scale":"concat_0_x","field":"monthdate_date"},"y":{"scale":"concat_0_y","field":"temp_max"},"size":{"scale":"size","field":"precipitation"}}}},{"name":"brush_brush","type":"rect","clip":true,"encode":{"enter":{"fill":{"value":"transparent"}},"update":{"x":[{"test":"data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"","signal":"brush_x[0]"},{"value":0}],"y":[{"test":"data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"","value":0},{"value":0}],"x2":[{"test":"data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"","signal":"brush_x[1]"},{"value":0}],"y2":[{"test":"data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"","field":{"group":"height"}},{"value":0}],"stroke":[{"test":"brush_x[0] !== brush_x[1]","value":"white"},{"value":null}]}}}],"axes":[{"scale":"concat_0_x","orient":"bottom","gridScale":"concat_0_y","grid":true,"tickCount":{"signal":"ceil(width/40)"},"tickMinStep":{"signal":"datetime(2001, 0, 2, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"},"domain":false,"labels":false,"aria":false,"maxExtent":0,"minExtent":0,"ticks":false,"zindex":0},{"scale":"concat_0_y","orient":"left","gridScale":"concat_0_x","grid":true,"tickCount":{"signal":"ceil(concat_0_height/40)"},"domain":false,"labels":false,"aria":false,"maxExtent":0,"minExtent":0,"ticks":false,"zindex":0},{"scale":"concat_0_x","orient":"bottom","grid":false,"title":"Date","format":"%b","labelFlush":true,"labelOverlap":true,"tickCount":{"signal":"ceil(width/40)"},"tickMinStep":{"signal":"datetime(2001, 0, 2, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"},"zindex":0},{"scale":"concat_0_y","orient":"left","grid":false,"title":"Maximum Daily Temperature (C)","labelOverlap":true,"tickCount":{"signal":"ceil(concat_0_height/40)"},"zindex":0}]},{"type":"group","name":"concat_1_group","style":"cell","encode":{"update":{"width":{"signal":"width"},"height":{"signal":"concat_1_height"}}},"signals":[{"name":"click_tuple","on":[{"events":[{"source":"scope","type":"click"}],"update":"datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0 ? {unit: \"concat_1\", fields: click_tuple_fields, values: [(item().isVoronoi ? datum.datum : datum)[\"weather\"]]} : null","force":true},{"events":[{"source":"view","type":"dblclick"}],"update":"null"}]},{"name":"click_tuple_fields","value":[{"field":"weather","channel":"color","type":"E"}]},{"name":"click_toggle","value":false,"on":[{"events":[{"source":"scope","type":"click"}],"update":"event.shiftKey"},{"events":[{"source":"view","type":"dblclick"}],"update":"false"}]},{"name":"click_modify","on":[{"events":{"signal":"click_tuple"},"update":"modify(\"click_store\", click_toggle ? null : click_tuple, click_toggle ? null : true, click_toggle ? click_tuple : null)"}]}],"marks":[{"name":"concat_1_marks","type":"rect","style":["bar"],"interactive":true,"from":{"data":"data_1"},"encode":{"update":{"fill":[{"test":"!length(data(\"click_store\")) || vlSelectionTest(\"click_store\", datum)","scale":"color","field":"weather"},{"value":"lightgray"}],"ariaRoleDescription":{"value":"bar"},"description":{"signal":"\"Count of Records: \" + (format(datum[\"__count\"], \"\")) + \"; Weather: \" + (isValid(datum[\"weather\"]) ? datum[\"weather\"] : \"\"+datum[\"weather\"]) + \"; weather: \" + (isValid(datum[\"weather\"]) ? datum[\"weather\"] : \"\"+datum[\"weather\"])"},"x":{"scale":"concat_1_x","field":"__count"},"x2":{"scale":"concat_1_x","value":0},"y":{"scale":"concat_1_y","field":"weather"},"height":{"signal":"max(0.25, bandwidth('concat_1_y'))"}}}}],"axes":[{"scale":"concat_1_x","orient":"bottom","gridScale":"concat_1_y","grid":true,"tickCount":{"signal":"ceil(width/40)"},"domain":false,"labels":false,"aria":false,"maxExtent":0,"minExtent":0,"ticks":false,"zindex":0},{"scale":"concat_1_x","orient":"bottom","grid":false,"title":"Count of Records","labelFlush":true,"labelOverlap":true,"tickCount":{"signal":"ceil(width/40)"},"zindex":0},{"scale":"concat_1_y","orient":"left","grid":false,"title":"Weather","zindex":0}]}],"scales":[{"name":"color","type":"ordinal","domain":["sun","fog","drizzle","rain","snow"],"range":["#e7ba52","#a7a7a7","#aec7e8","#1f77b4","#9467bd"]},{"name":"size","type":"linear","domain":[-1,50],"range":[0,361],"zero":true},{"name":"concat_0_x","type":"time","domain":{"data":"data_0","field":"monthdate_date"},"range":[0,{"signal":"width"}]},{"name":"concat_0_y","type":"linear","domain":[-5,40],"range":[{"signal":"concat_0_height"},0],"zero":true},{"name":"concat_1_x","type":"linear","domain":{"data":"data_1","field":"__count"},"range":[0,{"signal":"width"}],"nice":true,"zero":true},{"name":"concat_1_y","type":"band","domain":{"data":"data_1","field":"weather","sort":true},"range":{"step":{"signal":"concat_1_y_step"}},"paddingInner":0.1,"paddingOuter":0.05}],"legends":[{"title":"Weather","stroke":"color","symbolType":"circle","encode":{"symbols":{"update":{"opacity":{"value":0.7}}}},"fill":"color"},{"title":"Precipitation","size":"size","symbolType":"circle","encode":{"symbols":{"update":{"fill":{"value":"transparent"},"stroke":{"value":"lightgray"},"opacity":{"value":0.7}}}}}]}
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"value": {},
"on": [
{
"events": "mousemove",
"events": "pointermove",
"update": "isTuple(group()) ? group() : unit"
}
]
Expand Down Expand Up @@ -149,7 +149,7 @@
{
"events": {
"source": "scope",
"type": "mousedown",
"type": "pointerdown",
"filter": [
"!event.item || event.item.mark.name !== \"brush_brush\""
]
Expand All @@ -159,19 +159,19 @@
{
"events": {
"source": "window",
"type": "mousemove",
"type": "pointermove",
"consume": true,
"between": [
{
"source": "scope",
"type": "mousedown",
"type": "pointerdown",
"filter": [
"!event.item || event.item.mark.name !== \"brush_brush\""
]
},
{
"source": "window",
"type": "mouseup"
"type": "pointerup"
}
]
},
Expand Down Expand Up @@ -262,7 +262,7 @@
"events": [
{
"source": "scope",
"type": "mousedown",
"type": "pointerdown",
"markname": "brush_brush"
}
],
Expand All @@ -278,17 +278,17 @@
"events": [
{
"source": "window",
"type": "mousemove",
"type": "pointermove",
"consume": true,
"between": [
{
"source": "scope",
"type": "mousedown",
"type": "pointerdown",
"markname": "brush_brush"
},
{
"source": "window",
"type": "mouseup"
"type": "pointerup"
}
]
}
Expand Down Expand Up @@ -518,6 +518,9 @@
"tickCount": {
"signal": "ceil(width/40)"
},
"tickMinStep": {
"signal": "datetime(2001, 0, 2, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"domain": false,
"labels": false,
"aria": false,
Expand Down Expand Up @@ -553,6 +556,9 @@
"tickCount": {
"signal": "ceil(width/40)"
},
"tickMinStep": {
"signal": "datetime(2001, 0, 2, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down
Loading

0 comments on commit d3f95b0

Please sign in to comment.