diff --git a/examples/compiled/point_2d_array_named.svg b/examples/compiled/point_2d_array_named.svg index f528637897..4b93dd9a42 100644 --- a/examples/compiled/point_2d_array_named.svg +++ b/examples/compiled/point_2d_array_named.svg @@ -1 +1 @@ -CDEa02468b \ No newline at end of file +CDEa02468b \ No newline at end of file diff --git a/examples/compiled/point_2d_array_named.vg.json b/examples/compiled/point_2d_array_named.vg.json index 86fbe0d6ce..4d565f22bb 100644 --- a/examples/compiled/point_2d_array_named.vg.json +++ b/examples/compiled/point_2d_array_named.vg.json @@ -31,15 +31,15 @@ } ], "signals": [ - {"name": "plotname_x_step", "value": 20}, + {"name": "x_step", "value": 20}, { "name": "width", - "update": "bandspace(domain('plotname_x').length, 1, 0.5) * plotname_x_step" + "update": "bandspace(domain('x').length, 1, 0.5) * x_step" } ], "marks": [ { - "name": "plotname_marks", + "name": "marks", "type": "symbol", "style": ["point"], "from": {"data": "data_0"}, @@ -52,22 +52,22 @@ "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, - "x": {"scale": "plotname_x", "field": "a"}, - "y": {"scale": "plotname_y", "field": "b"} + "x": {"scale": "x", "field": "a"}, + "y": {"scale": "y", "field": "b"} } } } ], "scales": [ { - "name": "plotname_x", + "name": "x", "type": "point", "domain": {"data": "data_0", "field": "a", "sort": true}, - "range": {"step": {"signal": "plotname_x_step"}}, + "range": {"step": {"signal": "x_step"}}, "padding": 0.5 }, { - "name": "plotname_y", + "name": "y", "type": "linear", "domain": {"data": "data_0", "field": "b"}, "range": [{"signal": "height"}, 0], @@ -77,9 +77,9 @@ ], "axes": [ { - "scale": "plotname_y", + "scale": "y", "orient": "left", - "gridScale": "plotname_x", + "gridScale": "x", "grid": true, "tickCount": {"signal": "ceil(height/40)"}, "domain": false, @@ -91,7 +91,7 @@ "zindex": 0 }, { - "scale": "plotname_x", + "scale": "x", "orient": "bottom", "grid": false, "title": "a", @@ -101,7 +101,7 @@ "zindex": 0 }, { - "scale": "plotname_y", + "scale": "y", "orient": "left", "grid": false, "title": "b", diff --git a/examples/specs/normalized/point_2d_array_named_normalized.vl.json b/examples/specs/normalized/point_2d_array_named_normalized.vl.json new file mode 100644 index 0000000000..6a1f2175b7 --- /dev/null +++ b/examples/specs/normalized/point_2d_array_named_normalized.vl.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "data": { + "values": [ + {"a": "C", "b": 2}, + {"a": "C", "b": 7}, + {"a": "C", "b": 4}, + {"a": "D", "b": 1}, + {"a": "D", "b": 2}, + {"a": "D", "b": 6}, + {"a": "E", "b": 8}, + {"a": "E", "b": 4}, + {"a": "E", "b": 7} + ] + }, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "nominal"}, + "y": {"field": "b", "type": "quantitative"} + } +} \ No newline at end of file diff --git a/src/normalize/core.ts b/src/normalize/core.ts index f9de0a8ec6..b56255f5aa 100644 --- a/src/normalize/core.ts +++ b/src/normalize/core.ts @@ -65,6 +65,7 @@ export class CoreNormalizer extends SpecMapper