microsoft / datamations

https://microsoft.github.io/datamations/
Other
66 stars 14 forks source link

Bug with `row_header` missing #108

Closed sharlagelfand closed 2 years ago

sharlagelfand commented 2 years ago

@giorgi-ghviniashvili I'm testing to make sure we aren't breaking existing visualizations as we progress, and saw that there is an issue when there are three grouping variables, e.g. these specs:

``` [ { "height": 300, "width": 300, "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "meta": { "parse": "grid", "description": "Initial data" }, "data": { "values": [ { "n": 344 } ] }, "mark": { "type": "point", "filled": true }, "encoding": { "x": { "field": "datamations_x", "type": "quantitative", "axis": null }, "y": { "field": "datamations_y", "type": "quantitative", "axis": null } } }, { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "meta": { "parse": "grid", "description": "Group by species" }, "data": { "values": [ { "species": "Adelie", "n": 152 }, { "species": "Chinstrap", "n": 68 }, { "species": "Gentoo", "n": 124 } ] }, "facet": { "column": { "field": "species", "type": "ordinal", "title": "species" } }, "spec": { "height": 300, "width": 100, "mark": { "type": "point", "filled": true }, "encoding": { "x": { "field": "datamations_x", "type": "quantitative", "axis": null }, "y": { "field": "datamations_y", "type": "quantitative", "axis": null }, "tooltip": [ { "field": "species", "type": "nominal" } ] } } }, { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "meta": { "parse": "grid", "description": "Group by species, island" }, "data": { "values": [ { "species": "Adelie", "island": "Biscoe", "n": 44 }, { "species": "Adelie", "island": "Dream", "n": 56 }, { "species": "Adelie", "island": "Torgersen", "n": 52 }, { "species": "Chinstrap", "island": "Dream", "n": 68 }, { "species": "Gentoo", "island": "Biscoe", "n": 124 } ] }, "facet": { "column": { "field": "species", "type": "ordinal", "title": "species" }, "row": { "field": "island", "type": "ordinal", "title": "island" } }, "spec": { "height": 100, "width": 100, "mark": { "type": "point", "filled": true }, "encoding": { "x": { "field": "datamations_x", "type": "quantitative", "axis": null }, "y": { "field": "datamations_y", "type": "quantitative", "axis": null }, "tooltip": [ { "field": "species", "type": "nominal" }, { "field": "island", "type": "nominal" } ] } } }, { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "meta": { "parse": "grid", "description": "Group by species, island, sex", "splitField": "sex", "axes": true }, "data": { "values": [ { "species": "Adelie", "island": "Biscoe", "sex": "female", "n": 22 }, { "species": "Adelie", "island": "Biscoe", "sex": "male", "n": 22 }, { "species": "Adelie", "island": "Dream", "sex": "female", "n": 27 }, { "species": "Adelie", "island": "Dream", "sex": "male", "n": 28 }, { "species": "Adelie", "island": "Dream", "sex": "NA", "n": 1 }, { "species": "Adelie", "island": "Torgersen", "sex": "female", "n": 24 }, { "species": "Adelie", "island": "Torgersen", "sex": "male", "n": 23 }, { "species": "Adelie", "island": "Torgersen", "sex": "NA", "n": 5 }, { "species": "Chinstrap", "island": "Dream", "sex": "female", "n": 34 }, { "species": "Chinstrap", "island": "Dream", "sex": "male", "n": 34 }, { "species": "Gentoo", "island": "Biscoe", "sex": "female", "n": 58 }, { "species": "Gentoo", "island": "Biscoe", "sex": "male", "n": 61 }, { "species": "Gentoo", "island": "Biscoe", "sex": "NA", "n": 5 } ] }, "facet": { "column": { "field": "species", "type": "ordinal", "title": "species" }, "row": { "field": "island", "type": "ordinal", "title": "island" } }, "spec": { "height": 100, "width": 100, "mark": { "type": "point", "filled": true }, "encoding": { "x": { "field": "datamations_x", "type": "quantitative", "axis": null }, "y": { "field": "datamations_y", "type": "quantitative", "axis": null }, "color": { "field": "sex", "type": "nominal", "legend": { "values": ["female", "male", "NA"] } }, "tooltip": [ { "field": "species", "type": "nominal" }, { "field": "island", "type": "nominal" }, { "field": "sex", "type": "nominal" } ] } } } ] ```

do not produce a visualization, just the error:

Uncaught (in promise) TypeError: row_header is undefined
    getHackedSpec http://localhost:26982/session/viewhtml6d1660330987/lib/hack-facet-view-0.0.1/hack-facet-view.js:91
    hackFacet http://localhost:26982/session/viewhtml6d1660330987/lib/hack-facet-view-0.0.1/hack-facet-view.js:169

Could you please take a look? thank you!

giorgi-ghviniashvili commented 2 years ago

@sharlagelfand I see, it is fixed in branch filtering. I will send a PR of all branches together.