Skip to content

Commit

Permalink
fix: avoid repetitive labels by using tickMinStep (#8872)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Actions Bot <vega-actions-bot@users.noreply.github.com>
  • Loading branch information
kanitw and GitHub Actions Bot committed May 1, 2023
1 parent b868fed commit 0b1c385
Show file tree
Hide file tree
Showing 96 changed files with 1,296 additions and 13 deletions.
6 changes: 6 additions & 0 deletions examples/compiled/area.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
"gridScale": "y",
"grid": true,
"tickCount": {"signal": "ceil(width/40)"},
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"domain": false,
"labels": false,
"aria": false,
Expand Down Expand Up @@ -105,6 +108,9 @@
"labelFlush": true,
"labelOverlap": true,
"tickCount": {"signal": "ceil(width/40)"},
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down
6 changes: 6 additions & 0 deletions examples/compiled/area_temperature_range.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
"gridScale": "y",
"grid": true,
"tickCount": {"signal": "ceil(width/40)"},
"tickMinStep": {
"signal": "datetime(2001, 0, 2, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"domain": false,
"labels": false,
"aria": false,
Expand Down Expand Up @@ -113,6 +116,9 @@
"labelFlush": true,
"labelOverlap": true,
"tickCount": {"signal": "ceil(width/40)"},
"tickMinStep": {
"signal": "datetime(2001, 0, 2, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down
6 changes: 6 additions & 0 deletions examples/compiled/area_vertical.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
"gridScale": "x",
"grid": true,
"tickCount": {"signal": "ceil(height/40)"},
"tickMinStep": {
"signal": "datetime(2002, 0, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"domain": false,
"labels": false,
"aria": false,
Expand Down Expand Up @@ -118,6 +121,9 @@
},
"labelOverlap": true,
"tickCount": {"signal": "ceil(height/40)"},
"tickMinStep": {
"signal": "datetime(2002, 0, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
}
]
Expand Down
1 change: 1 addition & 0 deletions examples/compiled/bar_1d_binned.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"labelFlush": true,
"labelOverlap": true,
"tickCount": {"signal": "ceil(width/10)"},
"tickMinStep": 1,
"zindex": 0
}
],
Expand Down
6 changes: 6 additions & 0 deletions examples/compiled/bar_custom_time_domain.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
"orient": "bottom",
"gridScale": "y",
"grid": true,
"tickMinStep": {
"signal": "datetime(2001, 0, 1, 1, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"domain": false,
"labels": false,
"aria": false,
Expand Down Expand Up @@ -121,6 +124,9 @@
},
"labelFlush": true,
"labelOverlap": true,
"tickMinStep": {
"signal": "datetime(2001, 0, 1, 1, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down
3 changes: 3 additions & 0 deletions examples/compiled/bar_month.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@
},
"formatType": "time",
"labelOverlap": true,
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down
6 changes: 6 additions & 0 deletions examples/compiled/bar_month_band.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
"orient": "bottom",
"gridScale": "y",
"grid": true,
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"domain": false,
"labels": false,
"aria": false,
Expand Down Expand Up @@ -114,6 +117,9 @@
},
"labelFlush": true,
"labelOverlap": true,
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down
6 changes: 6 additions & 0 deletions examples/compiled/bar_month_band_config.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
"orient": "bottom",
"gridScale": "y",
"grid": true,
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"domain": false,
"labels": false,
"aria": false,
Expand Down Expand Up @@ -114,6 +117,9 @@
},
"labelFlush": true,
"labelOverlap": true,
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down
6 changes: 6 additions & 0 deletions examples/compiled/bar_month_temporal.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
"orient": "bottom",
"gridScale": "y",
"grid": true,
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"domain": false,
"labels": false,
"aria": false,
Expand Down Expand Up @@ -109,6 +112,9 @@
},
"labelFlush": true,
"labelOverlap": true,
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down
6 changes: 6 additions & 0 deletions examples/compiled/bar_month_temporal_initial.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
"orient": "bottom",
"gridScale": "y",
"grid": true,
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"domain": false,
"labels": false,
"aria": false,
Expand Down Expand Up @@ -111,6 +114,9 @@
},
"labelFlush": true,
"labelOverlap": true,
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"encode": {"labels": {"update": {"text": {"signal": "datum.label[0]"}}}},
"zindex": 0
},
Expand Down
Binary file added examples/compiled/bar_narrow_int_span.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/compiled/bar_narrow_int_span.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 125 additions & 0 deletions examples/compiled/bar_narrow_int_span.vg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "A simple bar chart with integer axis.",
"background": "white",
"padding": 5,
"width": 200,
"height": 200,
"style": "cell",
"data": [
{
"name": "source_0",
"values": [{"a": 0, "b": 28}, {"a": 1, "b": 38}, {"a": 2, "b": 35}]
},
{
"name": "data_0",
"source": "source_0",
"transform": [
{
"type": "stack",
"groupby": ["a"],
"field": "b",
"sort": {"field": [], "order": []},
"as": ["b_start", "b_end"],
"offset": "zero"
},
{
"type": "filter",
"expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])"
}
]
}
],
"marks": [
{
"name": "marks",
"type": "rect",
"style": ["bar"],
"from": {"data": "data_0"},
"encode": {
"update": {
"fill": {"value": "#4c78a8"},
"ariaRoleDescription": {"value": "bar"},
"description": {
"signal": "\"a: \" + (format(datum[\"a\"], \"d\")) + \"; b: \" + (format(datum[\"b\"], \"\"))"
},
"xc": {"scale": "x", "field": "a"},
"width": {"value": 5},
"y": {"scale": "y", "field": "b_end"},
"y2": {"scale": "y", "field": "b_start"}
}
}
}
],
"scales": [
{
"name": "x",
"type": "linear",
"domain": {"data": "data_0", "field": "a"},
"range": [0, {"signal": "width"}],
"nice": true,
"zero": false,
"padding": 5
},
{
"name": "y",
"type": "linear",
"domain": {"data": "data_0", "fields": ["b_start", "b_end"]},
"range": [{"signal": "height"}, 0],
"nice": true,
"zero": true
}
],
"axes": [
{
"scale": "x",
"orient": "bottom",
"gridScale": "y",
"grid": true,
"tickCount": {"signal": "ceil(width/40)"},
"tickMinStep": 1,
"domain": false,
"labels": false,
"aria": false,
"maxExtent": 0,
"minExtent": 0,
"ticks": false,
"zindex": 0
},
{
"scale": "y",
"orient": "left",
"gridScale": "x",
"grid": true,
"tickCount": {"signal": "ceil(height/40)"},
"domain": false,
"labels": false,
"aria": false,
"maxExtent": 0,
"minExtent": 0,
"ticks": false,
"zindex": 0
},
{
"scale": "x",
"orient": "bottom",
"grid": false,
"title": "a",
"format": "d",
"labelFlush": true,
"labelOverlap": true,
"tickCount": {"signal": "ceil(width/40)"},
"tickMinStep": 1,
"zindex": 0
},
{
"scale": "y",
"orient": "left",
"grid": false,
"title": "b",
"labelOverlap": true,
"tickCount": {"signal": "ceil(height/40)"},
"zindex": 0
}
]
}
6 changes: 6 additions & 0 deletions examples/compiled/bar_yearmonth.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
"gridScale": "y",
"grid": true,
"tickCount": {"signal": "ceil(width/40)"},
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"domain": false,
"labels": false,
"aria": false,
Expand Down Expand Up @@ -112,6 +115,9 @@
"labelFlush": true,
"labelOverlap": true,
"tickCount": {"signal": "ceil(width/40)"},
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down
6 changes: 6 additions & 0 deletions examples/compiled/bar_yearmonth_custom_format.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
"gridScale": "y",
"grid": true,
"tickCount": {"signal": "ceil(width/40)"},
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"domain": false,
"labels": false,
"aria": false,
Expand Down Expand Up @@ -110,6 +113,9 @@
"labelFlush": true,
"labelOverlap": true,
"tickCount": {"signal": "ceil(width/40)"},
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down
3 changes: 3 additions & 0 deletions examples/compiled/circle_github_punchcard.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
},
"formatType": "time",
"labelOverlap": true,
"tickMinStep": {
"signal": "datetime(2001, 0, 1, 1, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down
3 changes: 3 additions & 0 deletions examples/compiled/circle_labelangle_orient_signal.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@
},
"formatType": "time",
"labelOverlap": true,
"tickMinStep": {
"signal": "datetime(2001, 0, 1, 1, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"encode": {
"labels": {
"update": {
Expand Down
6 changes: 6 additions & 0 deletions examples/compiled/concat_weather.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@
},
"formatType": "time",
"labelOverlap": true,
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down Expand Up @@ -239,6 +242,9 @@
},
"formatType": "time",
"labelOverlap": true,
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"zindex": 0
},
{
Expand Down
Loading

0 comments on commit 0b1c385

Please sign in to comment.