I have a visual that I am trying to create using Deneb. So far most of it looks good and exactly how I want it to look. Then on the right y-scale its starts looking very weird. It looks like the right y-scale and axis is trying to show two different values, which is bizarre because it should all be null. This is the last part and know I am close to an answer but I could use some expertise.
enter image description here
I have tried a lot of different codes to get this to work. I settled on this for now.
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Bar Chart with Line and Area",
"data": {
"name": "dataset"
},
"transform": [
{
"calculate": "datum['Index']",
"as": "Index"
},
{
"calculate": "datum['YTD POS Sales TY']",
"as": "YTD POS Sales TY"
},
{
"calculate": "datum['LY Sales']",
"as": "LY Sales"
},
{
"calculate": "datum['LYTD vs PY']",
"as": "LYTD vs PY"
},
{
"calculate": "round(datum['LYTD vs PY'] * 100)",
"as": "LYTD vs PY normalized"
},
{
"calculate": "round(datum['LYTD vs PY'] * 100) + '%'",
"as": "LYTD vs PY formatted"
}
],
"layer": [
{
"mark": {"type": "area", "opacity": 1},
"encoding": {
"x": {"field": "Index", "type": "ordinal"},
"y": {
"field": "LY Sales",
"type": "quantitative",
"axis": {"title": null, "format": "$,.0f"}
},
"color": {"value": "#4472C4"},
"tooltip": [
{"field": "LY Sales", "type": "quantitative", "title": null}
]
}
},
{
"mark": {
"type": "bar",
"color": "#FF7F00",
"width": 20
},
"encoding": {
"x": {"field": "Index", "type": "ordinal", "axis": {"title": null}},
"y": {
"field": "YTD POS Sales TY",
"type": "quantitative",
"axis": {"title": "YTD POS Sales TY", "format": "$,.0f"}
},
"tooltip": [
{"field": "YTD POS Sales TY", "type": "quantitative", "title": "YTD POS Sales TY"}
]
}
},
{
"mark": {
"type": "line",
"color": "#808080",
"point": {"color": "#808080"}
},
"encoding": {
"x": {"field": "Index", "type": "ordinal", "axis": {"title": null}},
"y": {
"field": "LYTD vs PY",
"type": "quantitative",
"axis": {"title": null, "format": ".0%", "orient": "right"}
}
}
},
{
"mark": {
"type": "text",
"align": "left",
"dx": -8,
"dy": -18
},
"encoding": {
"x": {"field": "Index", "type": "ordinal", "axis": {"title": null}},
"y": {
"field": "LYTD vs PY",
"type": "quantitative"
},
"text": {"field": "LYTD vs PY formatted", "type": "nominal"}
}
}
],
"resolve": {
"scale": {"y": "independent"}
},
"config": {
"axis": {
"labelAngle": 0
}
}
}