Skip to content

Commit

Permalink
Add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
yhoonkim committed Aug 12, 2022
1 parent a0378de commit cf03378
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build/vega-lite-schema.json
Expand Up @@ -21608,6 +21608,10 @@
}
],
"description": "Reverse x-scale by default (useful for right-to-left charts)."
},
"zero": {
"description": "Default for ensuring that a zero baseline values for [`quantize`](https://vega.github.io/vega-lite/docs/scale.html#quantize) scale.\n\n\n__Default value:__ `true`",
"type": "boolean"
}
},
"type": "object"
Expand Down
17 changes: 17 additions & 0 deletions examples/specs/bar_config_no_zero.vl.json
@@ -0,0 +1,17 @@
{
"$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": "bar",
"encoding": {
"x": {"field": "a", "type": "nominal", "axis": {"labelAngle": 0}},
"y": {"field": "b", "type": "quantitative"}
},
"config": { "scale": { "zero": false } }
}
18 changes: 18 additions & 0 deletions examples/specs/bar_gantt_config_no_zero.vl.json
@@ -0,0 +1,18 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A simple bar chart with ranged data (aka Gantt Chart).",
"data": {
"values": [
{"task": "A", "start": 1, "end": 3},
{"task": "B", "start": 3, "end": 8},
{"task": "C", "start": 8, "end": 10}
]
},
"mark": "bar",
"encoding": {
"y": {"field": "task", "type": "ordinal"},
"x": {"field": "start", "type": "quantitative"},
"x2": {"field": "end"}
},
"config": { "scale": { "zero": false } }
}
11 changes: 11 additions & 0 deletions examples/specs/point_2d_config_no_zero.vl.json
@@ -0,0 +1,11 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A scatterplot showing horsepower and miles per gallons for various cars.",
"data": { "url": "data/cars.json" },
"mark": "point",
"encoding": {
"x": { "field": "Horsepower", "type": "quantitative" },
"y": { "field": "Miles_per_Gallon", "type": "quantitative" }
},
"config": { "scale": { "zero": false } }
}
9 changes: 9 additions & 0 deletions src/scale.ts
Expand Up @@ -415,6 +415,15 @@ export interface ScaleConfig<ES extends ExprRef | SignalRef> {
* Reverse x-scale by default (useful for right-to-left charts).
*/
xReverse?: boolean | ES;

/**
* Default for ensuring that a zero baseline values for [`quantize`](https://vega.github.io/vega-lite/docs/scale.html#quantize) scale.
*
*
* __Default value:__ `true`
*
*/
zero?: boolean;
}

export const defaultScaleConfig: ScaleConfig<SignalRef> = {
Expand Down

0 comments on commit cf03378

Please sign in to comment.