I'm using vega-lite in deneb for the first time. I've created a line with multi y-axis. On the right side y-axis, Vega is automatically assigning the data point exact values as the tick labels and intervals (see attached image). For example, for the % axis I want it to be 20%, 25%,30%... I want the ticks to be round numbers with even interval spacing between the ticks. Similar to how the left side y-axis is done. I've tried "tickCount" which doesn't work. I've pasted my code below too. Could it be a data type issue? Any help is greatly appreciated!
I tried allowing vega to automatically assign the tick and intervals because I expected the default was to use round numbers. What happened was vega used the data table's exact values for the tick and intervals.
`{
"data": {"name": "dataset"},
"encoding": {
"x": {
"field": "PERIOD_YEAR",
"type": "nominal"
}
},
"layer": [
{
"mark": {
"type": "line"
},
"encoding": {
"y":{
"field": "QTY",
"type": "quantitative"
}
}
},
{
"mark": {
"type": "line"
},
"encoding": {
"y":{
"field": "GM%_Less LC__formatted",
"sort":"-y"
}
}
},
{
"mark": {
"type": "line"
},
"encoding": {
"y": {
"field": "GM $/unit_Less LC__formatted",
"sort":"-y",
"axis": {"offset":80}
}
}
}
],
"resolve": {"scale": {"y":"independent"}}
}`
If you set the type to quantitative, you get nice tick values. You can set the domain extents to whatever you want. I'm confused as I thought you'd tried this? Is this the result you're looking for?
{
"data": {
"name": "dataset"
},
"encoding": {
"x": {
"field": "Year"
}
},
"layer": [
{
"mark": {
"type": "line"
},
"encoding": {
"y": {
"field": "Quantity",
"type": "quantitative"
}
}
},
{
"mark": {
"type": "line"
},
"encoding": {
"y": {
"field": "GM %",
"sort": "-y", "type": "quantitative", "scale":{"zero":false}
}
}
},
{
"mark": {
"type": "line"
},
"encoding": {
"y": {
"field": "GM $ / Unit",
"sort": "-y", "type": "quantitative","scale":{"zero":false},
"axis": {
"offset": 80
}
}
}
}
],
"resolve": {
"scale": {
"y": "independent"
}
}
}