Independent Y axes for dual axis wrapped facet and nested fields breaks axis layout
See original GitHub issueHello,
My requirement is to get dual axis charts in wrapped facet as in below link.
I have used the same code with my data , but wasn’t getting independent Y axes for dual charts :
code :
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": {
"%context%": true,
"index": "index_paincure_0709",
"body": {
"size": 10000,
"_source": ["Media_Type", "Unit_Key_Message", "Readability"]
}
},
"format": {"property": "hits.hits"}
},
"facet": {"field": "_source.Media_Type", "type": "ordinal", "title": ""},
"center": true,
"columns": 2,
"spec": {
"layer": [
{
"mark": "bar",
"encoding": {
"y": {
"aggregate": "sum",
"field": "_source.Readability",
"type": "quantitative",
"scale": {"zero": false}
},
"x": {
"field": "_source.Unit_Key_Message",
"type": "ordinal",
"sort": "-x",
"title": ""
}
}
},
{
"mark": "line",
"encoding": {
"y": {
"aggregate": "count",
"field": "_source.Unit_Key_Message",
"type": "quantitative",
"scale": {"zero": false}
},
"x": {
"field": "_source.Unit_Key_Message",
"type": "ordinal",
"sort": "-x",
"title": ""
},
"color": {"value": "#000000"}
}
}
],
"resolve": {"scale": {"y": "independent"}, "axis": {"y": "independent"}}
},
"resolve": {
"scale": {"x": "independent", "y": "independent"},
"axis": {"y": "independent"}
},
"config": {"bar": {"align": "center"}}
}
Data ( Result of JSON.stringify(VEGA_DEBUG.vegalite_spec
) is attached in the file
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Independent Y axes for dual axis wrapped facet - Elastic Discuss
Hello,. My requirement is to get dual axis charts in wrapped facet as in below link. vega.github.io · Editor/IDE for Vega and Vega-Lite....
Read more >Facets • ggh4x - GitHub Pages
This package offers two extensions to the vanilla facet_wrap() and facet_grid() that give you more control of the placement of axes at the...
Read more >Add Axes for Multiple Measures in Views - Tableau Help
Create individual axes for each measure. Blend two measures to share an axis. Add dual axes where there are two independent axes layered...
Read more >How to use facets with a dual y-axis ggplot - Stack Overflow
The only restriction is that the relationship between the two axes is equal for all facets. Share.
Read more >observablehq/plot: A concise API for exploratory data ... - GitHub
(Plot does not currently support dual-axis charts, which are not advised.) ... label position offset (in pixels; default 0, typically for facet axes);...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks. It looks like it works if we flatten the fields so the problem seems to be with the nested access.
Open the Chart in the Vega Editor.
I see. Nested fields a are sometimes tricky to handle since Vega always fattens outputs. Can you create a minimal example that shows the issue so we can fix it?