Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: change default bar and rect's default timeUnitBandPosition to 0 #9128

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file modified examples/compiled/bar_binned_yearmonth_grouped.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/compiled/bar_binned_yearmonth_grouped.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 16 additions & 3 deletions examples/compiled/bar_binned_yearmonth_grouped.vg.json
Expand Up @@ -21,6 +21,16 @@
"expr": "timeOffset('month', datum['date'], 1)",
"as": "date_end"
},
{
"type": "formula",
"expr": "0.5 * timeOffset('month', datum['date'], -1) + 0.5 * datum['date']",
"as": "date_offsetted_rect_start"
},
{
"type": "formula",
"expr": "0.5 * datum['date'] + 0.5 * datum['date_end']",
"as": "date_offsetted_rect_end"
},
{
"type": "stack",
"groupby": ["date", "symbol"],
Expand Down Expand Up @@ -65,7 +75,10 @@
{
"name": "x",
"type": "time",
"domain": {"data": "source_0", "fields": ["date", "date_end"]},
"domain": {
"data": "source_0",
"fields": ["date_offsetted_rect_start", "date_offsetted_rect_end"]
},
"range": [0, {"signal": "width"}]
},
{
Expand All @@ -82,10 +95,10 @@
"domain": {"data": "source_0", "field": "symbol", "sort": true},
"range": [
{
"signal": "0.1 * (scale('x', datetime(2001, 1, 1, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
"signal": "-0.4 * (scale('x', datetime(2001, 1, 1, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
},
{
"signal": "0.9 * (scale('x', datetime(2001, 1, 1, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
"signal": "0.4 * (scale('x', datetime(2001, 1, 1, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
}
]
},
Expand Down
Binary file modified examples/compiled/bar_binnedyearmonth.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/compiled/bar_binnedyearmonth.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 16 additions & 3 deletions examples/compiled/bar_binnedyearmonth.vg.json
Expand Up @@ -18,6 +18,16 @@
"expr": "timeOffset('month', datum['date'], 1)",
"as": "date_end"
},
{
"type": "formula",
"expr": "0.5 * timeOffset('month', datum['date'], -1) + 0.5 * datum['date']",
"as": "date_offsetted_rect_start"
},
{
"type": "formula",
"expr": "0.5 * datum['date'] + 0.5 * datum['date_end']",
"as": "date_offsetted_rect_end"
},
{
"type": "stack",
"groupby": ["date"],
Expand Down Expand Up @@ -48,14 +58,14 @@
},
"x2": {
"scale": "x",
"field": "date",
"field": "date_offsetted_rect_start",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"date_end\"]) - scale(\"x\", datum[\"date\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"x\", datum[\"date_end\"]) - scale(\"x\", datum[\"date\"])))) : 0.5)"
}
},
"x": {
"scale": "x",
"field": "date_end",
"field": "date_offsetted_rect_end",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"date_end\"]) - scale(\"x\", datum[\"date\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"x\", datum[\"date_end\"]) - scale(\"x\", datum[\"date\"])))) : -0.5)"
}
Expand All @@ -70,7 +80,10 @@
{
"name": "x",
"type": "time",
"domain": {"data": "source_0", "fields": ["date", "date_end"]},
"domain": {
"data": "source_0",
"fields": ["date_offsetted_rect_start", "date_offsetted_rect_end"]
},
"range": [0, {"signal": "width"}]
},
{
Expand Down
Binary file modified examples/compiled/bar_custom_time_domain.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/compiled/bar_custom_time_domain.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions examples/compiled/bar_custom_time_domain.vg.json
Expand Up @@ -26,6 +26,16 @@
"units": ["hours"],
"as": ["hours_a", "hours_a_end"]
},
{
"type": "formula",
"expr": "0.5 * timeOffset('hours', datum['hours_a'], -1) + 0.5 * datum['hours_a']",
"as": "hours_a_offsetted_rect_start"
},
{
"type": "formula",
"expr": "0.5 * datum['hours_a'] + 0.5 * datum['hours_a_end']",
"as": "hours_a_offsetted_rect_end"
},
{
"type": "stack",
"groupby": ["hours_a"],
Expand Down Expand Up @@ -56,14 +66,14 @@
},
"x2": {
"scale": "x",
"field": "hours_a",
"field": "hours_a_offsetted_rect_start",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"hours_a_end\"]) - scale(\"x\", datum[\"hours_a\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"x\", datum[\"hours_a_end\"]) - scale(\"x\", datum[\"hours_a\"])))) : 0.5)"
}
},
"x": {
"scale": "x",
"field": "hours_a_end",
"field": "hours_a_offsetted_rect_end",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"hours_a_end\"]) - scale(\"x\", datum[\"hours_a\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"x\", datum[\"hours_a_end\"]) - scale(\"x\", datum[\"hours_a\"])))) : -0.5)"
}
Expand Down
Binary file modified examples/compiled/bar_group_timeunit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/compiled/bar_group_timeunit.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 26 additions & 4 deletions examples/compiled/bar_group_timeunit.vg.json
Expand Up @@ -17,9 +17,25 @@
"units": ["year"],
"as": ["year_Year", "year_Year_end"]
},
{
"type": "formula",
"expr": "0.5 * timeOffset('year', datum['year_Year'], -1) + 0.5 * datum['year_Year']",
"as": "year_Year_offsetted_rect_start"
},
{
"type": "formula",
"expr": "0.5 * datum['year_Year'] + 0.5 * datum['year_Year_end']",
"as": "year_Year_offsetted_rect_end"
},
{
"type": "aggregate",
"groupby": ["year_Year", "year_Year_end", "Origin"],
"groupby": [
"year_Year",
"year_Year_end",
"year_Year_offsetted_rect_start",
"year_Year_offsetted_rect_end",
"Origin"
],
"ops": ["count"],
"fields": [null],
"as": ["__count"]
Expand Down Expand Up @@ -60,7 +76,13 @@
{
"name": "x",
"type": "time",
"domain": {"data": "source_0", "fields": ["year_Year", "year_Year_end"]},
"domain": {
"data": "source_0",
"fields": [
"year_Year_offsetted_rect_start",
"year_Year_offsetted_rect_end"
]
},
"range": [0, {"signal": "width"}]
},
{
Expand All @@ -77,10 +99,10 @@
"domain": {"data": "source_0", "field": "Origin", "sort": true},
"range": [
{
"signal": "0.1 * (scale('x', datetime(2002, 0, 1, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
"signal": "-0.4 * (scale('x', datetime(2002, 0, 1, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
},
{
"signal": "0.9 * (scale('x', datetime(2002, 0, 1, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
"signal": "0.4 * (scale('x', datetime(2002, 0, 1, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
}
]
},
Expand Down
Binary file modified examples/compiled/bar_grouped_timeunit_yearweek.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.