We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to create a stacked bar chart, but my axis labels are long so ideally I'd like to wrap the text.
Here is the desired output without wrapping vega editor link.
{ "$schema": "https://vega.github.io/schema/vega-lite/v5.17.0.json", "config": { "view": { "continuousHeight": 300, "continuousWidth": 300 } }, "data": { "name": "data-e8dbb78e76226aa05b2ea6ce39724b21" }, "datasets": { "data-e8dbb78e76226aa05b2ea6ce39724b21": [ { "response": "yes", "value": 80, "variable": "Really long variable name number 1" }, { "response": "maybe", "value": 40, "variable": "Really long variable name number 1" }, { "response": "no", "value": 12, "variable": "Really long variable name number 1" }, { "response": "yes", "value": 60, "variable": "Seriously long variable name number 2" }, { "response": "maybe", "value": 50, "variable": "Seriously long variable name number 2" }, { "response": "no", "value": 22, "variable": "Seriously long variable name number 2" } ] }, "encoding": { "color": { "field": "response", "sort": [ "yes", "maybe", "no" ], "type": "ordinal" }, "order": { "field": "color_response_sort_index", "type": "quantitative" }, "x": { "field": "value", "stack": "normalize", "title": "Percentage of Visitors", "type": "quantitative" }, "y": { "axis": { "labelLimit": 350 }, "field": "variable", "title": "", "type": "nominal" } }, "height": 200, "mark": { "type": "bar" }, "width": 500 }
Now if I wrap the 'variable' text over multiple lines using a collection, the stacked bars break as in this example vega editor link:
{ "$schema": "https://vega.github.io/schema/vega-lite/v5.17.0.json", "config": { "view": { "continuousHeight": 300, "continuousWidth": 300 } }, "data": { "name": "data-00e711a020ed06f24288e7f5cd8c2863" }, "datasets": { "data-00e711a020ed06f24288e7f5cd8c2863": [ { "response": "yes", "value": 80, "variable": [ "Really long variable", "name number 1" ] }, { "response": "maybe", "value": 40, "variable": [ "Really long variable", "name number 1" ] }, { "response": "no", "value": 12, "variable": [ "Really long variable", "name number 1" ] }, { "response": "yes", "value": 60, "variable": [ "Seriously long", "variable name number", "2" ] }, { "response": "maybe", "value": 50, "variable": [ "Seriously long", "variable name number", "2" ] }, { "response": "no", "value": 22, "variable": [ "Seriously long", "variable name number", "2" ] } ] }, "encoding": { "color": { "field": "response", "sort": [ "yes", "maybe", "no" ], "type": "ordinal" }, "order": { "field": "color_response_sort_index", "type": "quantitative" }, "x": { "field": "value", "stack": "normalize", "title": "Percentage of Visitors", "type": "quantitative" }, "y": { "axis": { "labelLimit": 350 }, "field": "variable", "title": "", "type": "nominal" } }, "height": 200, "mark": { "type": "bar" }, "width": 500 }
Is there any way I can work around this? I'd really like to be able to wrap the label text.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Bug Description
I want to create a stacked bar chart, but my axis labels are long so ideally I'd like to wrap the text.
Here is the desired output without wrapping vega editor link.
Now if I wrap the 'variable' text over multiple lines using a collection, the stacked bars break as in this example vega editor link:
Is there any way I can work around this? I'd really like to be able to wrap the label text.
Checklist
The text was updated successfully, but these errors were encountered: