Skip to content

Commit

Permalink
docs: improve size.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kanitw committed Jun 30, 2019
1 parent 63a5c0a commit f08f043
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 208 deletions.
1 change: 0 additions & 1 deletion examples/compiled/bar_1d_rangestep_config.svg

This file was deleted.

77 changes: 0 additions & 77 deletions examples/compiled/bar_1d_rangestep_config.vg.json

This file was deleted.

1 change: 0 additions & 1 deletion examples/compiled/bar_size_explicit.svg

This file was deleted.

93 changes: 0 additions & 93 deletions examples/compiled/bar_size_explicit.vg.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"axis": {"title": "population"}
}
},
"config": {"view": {"discreteWidth": {"step": 21}}}
"config": {"view": {"step": 15}}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"width": 120,
"height": 120,
"data": {"url": "data/cars.json"},
"mark": "bar",
"encoding": {
Expand Down
20 changes: 10 additions & 10 deletions examples/specs/bar_size_step_small.vl.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"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}
]
},
"width": {"step": 11},
"width": {"step": 40},
"data": {"url": "data/cars.json"},
"mark": "bar",
"encoding": {
"x": {"field": "a", "type": "ordinal"},
"y": {"field": "b", "type": "quantitative"}
"x": {
"field": "Origin",
"type": "nominal"
},
"y": {
"aggregate": "count",
"type": "quantitative"
}
}
}
10 changes: 8 additions & 2 deletions site/docs/encoding/scale.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,15 @@ For example, the following bar chart has uses a band scale for its x-position.
<a name="padding"/>
{:#range-step}

To customize the step size of band scales for x/y-fields, we can set the step property of the view's `width`/`height`:
To customize the step size of band scales for x/y-fields, we can set the step property of the view's `width`/`height`.

<span class="vl-example" data-name="step_small"></span>
For example, we can either make a bar chart have a fixed width:

<span class="vl-example" data-name="bar_size_fit"></span>

or set the width per discrete step:

<span class="vl-example" data-name="bar_size_step_small"></span>

To customize the range of band and point scales, users can provide the following properties:

Expand Down
4 changes: 4 additions & 0 deletions site/docs/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,8 @@ In addition, the following properties of the `view` configuration determine the

{% include table.html props="continuousWidth,continuousHeight,discreteWidth,discreteHeight,step" source="ViewConfig" %}

For example, setting the `step` property in the view config can adjust default discrete step in the plot.

<span class="vl-example" data-name="bar_1d_step_config"></span>

**For more information about view size, please see the [size](size.html) documentation.**
Loading

0 comments on commit f08f043

Please sign in to comment.