-
I understand that since VL 5.13 it is possible to specify a scaling domain with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
A reason to use {
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A simple bar chart with embedded data.",
"data": {
"values": [
{"a": "A", "b": 28},
{"a": "B", "b": 55},
{"a": "C", "b": 43},
{"a": "D", "b": 91},
{"a": "E", "b": 81},
{"a": "F", "b": 53},
{"a": "G", "b": 19},
{"a": "H", "b": 87},
{"a": "I", "b": 52}
]
},
"mark": {"type": "bar", "clip": true},
"encoding": {
"x": {"field": "a", "type": "nominal", "axis": {"labelAngle": 0}},
"y": {
"field": "b",
"type": "quantitative",
"scale": {"domainRaw": {"expr": "ydomain"}}
}
},
"config": {
"signals": [
{
"name": "ydomain",
"update": "null",
"on": [
{"events": [{"type": "mousedown"}], "update": "[20, 50]"},
{"events": [{"type": "mouseup"}], "update": "null"}
]
}
]
}
} On Screen.Recording.2023-09-01.at.1.10.34.PM.movWith a little extra work, making custom zoom, brushing, and filtering actions becomes a little easier. To do the same thing without |
Beta Was this translation helpful? Give feedback.
A reason to use
domainRaw
is that it doesn't overwrite the inferred domain, and whendomainRaw
evaluates tonull
, the inferred domain is used. A minimal(ish) example is the following snippet: