hvega-0.7.0.0: tests/specs/gallery/line/conditionalaxis.vl
{
"transform": [
{
"filter": "datum.symbol === 'GOOG'"
},
{
"filter": {
"field": "date",
"timeUnit": "year",
"range": [
2006,
2007
]
}
}
],
"config": {
"axis": {
"domainColor": "#ddd",
"tickColor": "#ddd"
}
},
"mark": "line",
"data": {
"url": "https://vega.github.io/vega-lite/data/stocks.csv"
},
"width": 400,
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"encoding": {
"x": {
"field": "date",
"type": "temporal",
"axis": {
"tickSize": 30,
"labelOffset": 4,
"tickDash": {
"value": [
2,
2
],
"condition": {
"value": [],
"test": {
"equal": 1,
"field": "value",
"timeUnit": "month"
}
}
},
"tickCount": 8,
"gridDash": {
"value": [
2,
2
],
"condition": {
"value": [],
"test": {
"equal": 1,
"field": "value",
"timeUnit": "month"
}
}
},
"labelExpr": "[timeFormat(datum.value, '%b'), timeFormat(datum.value, '%m') == '01' ? timeFormat(datum.value, '%Y') : '']",
"labelPadding": -24,
"labelAlign": "left"
}
},
"y": {
"field": "price",
"type": "quantitative"
}
},
"description": "Line chart with conditional axis ticks, labels, and grid."
}