gosling-lang/gosling.js

Flipping Stacked Barcharts fails

mwittep opened this issue · 2 comments

I am building a viewer with stacked bars, one row for each strand (+,-). I wanted to flip the reserve strand, but this returned a weird visualization.

[...]
"y": {
                    "field": "count",
                    "type": "quantitative",
                    axis: "left",
                    domain: [0, maxValueBin[strand]],
                    range: [0, 90], flip: strand === "-"
                } 
[...]
image

I was able to reproduce the problem with the semantic zooming example (https://gosling.js.org/?example=SEQUENCE), where similar stacked bar charts are used.

image

Is this expected behavior, and I am just not understanding the flip-key correctly, or is it a bug?

Hi @mwittep, thanks for submitting an issue! I was able to reproduce it and can confirm that the axis is not being flipped as expected.

Here is a Gosling specification with the issue

{"arrangement": "vertical","views": [{"layout": "linear","xDomain": {"chromosome": "chr1", "interval": [1000000, 3000010]},"alignment": "overlay","data": {"url": "https://server.gosling-lang.org/api/v1/tileset_info/?d=sequence-multivec","type": "multivec","row": "base","column": "position","value": "count","categories": ["A", "T", "G", "C"],"start": "start","end": "end"},"tracks": [{"mark": "bar","y": {"field": "count", "type": "quantitative", "axis": "none", "flip": true}}],"x": {"field": "position", "type": "genomic"},"color": {"field": "base","type": "nominal","domain": ["A", "T", "G", "C"],"legend": true},"text": {"field": "base", "type": "nominal"},"style": {"textFontWeight": "bold"},"width": 800,"height": 100}]}

I'll look into this and will get back with you!

This has been fixed in the latest gosling release!

image