Skip to content

Commit

Permalink
add example from #9253
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Feb 18, 2024
1 parent a13fd7a commit b11e3a8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions examples/specs/line_dynamic_axis.vl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Vega-Lite computes the minimum and maximum axes values automatically but this can be made more dynamic by using params to produce axes which are +/- 20% of the minimum and maximum values in the dataset.",
"data": {
"values": [
{"x": 1, "y": 11},
{"x": 2, "y": 10},
{"x": 3, "y": 11.23},
{"x": 4, "y": 10},
{"x": 5, "y": 9.5},
{"x": 6, "y": 10},
{"x": 7, "y": 10}
]
},
"params": [
{"name": "extents", "expr": "extent(pluck(data('source_0'), 'y'))"},
{"name": "min", "expr": "extents[0] * 0.8"},
{"name": "max", "expr": "extents[1] * 1.2"}
],
"mark": {"type": "line", "point": true},
"encoding": {
"x": {"field": "x", "type": "quantitative"},
"y": {
"field": "y",
"type": "quantitative",
"scale": {"domain": {"expr": "[min,max]"}}
}
}
}

0 comments on commit b11e3a8

Please sign in to comment.