diff --git a/examples/compiled/bar_binned_yearmonth_grouped.png b/examples/compiled/bar_binned_yearmonth_grouped.png
index 96f3a92639..c47310973c 100644
Binary files a/examples/compiled/bar_binned_yearmonth_grouped.png and b/examples/compiled/bar_binned_yearmonth_grouped.png differ
diff --git a/examples/compiled/bar_binned_yearmonth_grouped.svg b/examples/compiled/bar_binned_yearmonth_grouped.svg
index 0d88d3b01a..1d3814b562 100644
--- a/examples/compiled/bar_binned_yearmonth_grouped.svg
+++ b/examples/compiled/bar_binned_yearmonth_grouped.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_binned_yearmonth_grouped.vg.json b/examples/compiled/bar_binned_yearmonth_grouped.vg.json
index 4d0ef4b7d4..addd923f0b 100644
--- a/examples/compiled/bar_binned_yearmonth_grouped.vg.json
+++ b/examples/compiled/bar_binned_yearmonth_grouped.vg.json
@@ -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"],
@@ -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"}]
},
{
@@ -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)))"
}
]
},
diff --git a/examples/compiled/bar_binnedyearmonth.png b/examples/compiled/bar_binnedyearmonth.png
index a1110895bb..9142085469 100644
Binary files a/examples/compiled/bar_binnedyearmonth.png and b/examples/compiled/bar_binnedyearmonth.png differ
diff --git a/examples/compiled/bar_binnedyearmonth.svg b/examples/compiled/bar_binnedyearmonth.svg
index 371924fe1a..cd3bbfc6c0 100644
--- a/examples/compiled/bar_binnedyearmonth.svg
+++ b/examples/compiled/bar_binnedyearmonth.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_binnedyearmonth.vg.json b/examples/compiled/bar_binnedyearmonth.vg.json
index d4f5d85d57..909e6048da 100644
--- a/examples/compiled/bar_binnedyearmonth.vg.json
+++ b/examples/compiled/bar_binnedyearmonth.vg.json
@@ -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"],
@@ -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)"
}
@@ -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"}]
},
{
diff --git a/examples/compiled/bar_custom_time_domain.png b/examples/compiled/bar_custom_time_domain.png
index f0e49ab8c6..59f754c98e 100644
Binary files a/examples/compiled/bar_custom_time_domain.png and b/examples/compiled/bar_custom_time_domain.png differ
diff --git a/examples/compiled/bar_custom_time_domain.svg b/examples/compiled/bar_custom_time_domain.svg
index 370ec0b584..186bc3540f 100644
--- a/examples/compiled/bar_custom_time_domain.svg
+++ b/examples/compiled/bar_custom_time_domain.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_custom_time_domain.vg.json b/examples/compiled/bar_custom_time_domain.vg.json
index 6bf7b6bbbc..e73904b234 100644
--- a/examples/compiled/bar_custom_time_domain.vg.json
+++ b/examples/compiled/bar_custom_time_domain.vg.json
@@ -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"],
@@ -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)"
}
diff --git a/examples/compiled/bar_group_timeunit.png b/examples/compiled/bar_group_timeunit.png
index 370381b1e3..f1dbf41417 100644
Binary files a/examples/compiled/bar_group_timeunit.png and b/examples/compiled/bar_group_timeunit.png differ
diff --git a/examples/compiled/bar_group_timeunit.svg b/examples/compiled/bar_group_timeunit.svg
index 59619b4008..0bf64fe499 100644
--- a/examples/compiled/bar_group_timeunit.svg
+++ b/examples/compiled/bar_group_timeunit.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_group_timeunit.vg.json b/examples/compiled/bar_group_timeunit.vg.json
index 41207af3b0..714914399b 100644
--- a/examples/compiled/bar_group_timeunit.vg.json
+++ b/examples/compiled/bar_group_timeunit.vg.json
@@ -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"]
@@ -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"}]
},
{
@@ -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)))"
}
]
},
diff --git a/examples/compiled/bar_grouped_timeunit_yearweek.png b/examples/compiled/bar_grouped_timeunit_yearweek.png
index f99a136a90..e55fdf914a 100644
Binary files a/examples/compiled/bar_grouped_timeunit_yearweek.png and b/examples/compiled/bar_grouped_timeunit_yearweek.png differ
diff --git a/examples/compiled/bar_grouped_timeunit_yearweek.svg b/examples/compiled/bar_grouped_timeunit_yearweek.svg
index 0ad1710782..49aefa0c4a 100644
--- a/examples/compiled/bar_grouped_timeunit_yearweek.svg
+++ b/examples/compiled/bar_grouped_timeunit_yearweek.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_grouped_timeunit_yearweek.vg.json b/examples/compiled/bar_grouped_timeunit_yearweek.vg.json
index af91bf87f1..c0ec791520 100644
--- a/examples/compiled/bar_grouped_timeunit_yearweek.vg.json
+++ b/examples/compiled/bar_grouped_timeunit_yearweek.vg.json
@@ -21,9 +21,25 @@
"units": ["year", "week"],
"as": ["yearweek_Year", "yearweek_Year_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('date', datum['yearweek_Year'], -7) + 0.5 * datum['yearweek_Year']",
+ "as": "yearweek_Year_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['yearweek_Year'] + 0.5 * datum['yearweek_Year_end']",
+ "as": "yearweek_Year_offsetted_rect_end"
+ },
{
"type": "aggregate",
- "groupby": ["yearweek_Year", "yearweek_Year_end", "Origin"],
+ "groupby": [
+ "yearweek_Year",
+ "yearweek_Year_end",
+ "yearweek_Year_offsetted_rect_start",
+ "yearweek_Year_offsetted_rect_end",
+ "Origin"
+ ],
"ops": ["count"],
"fields": [null],
"as": ["__count"]
@@ -66,7 +82,10 @@
"type": "time",
"domain": {
"data": "source_0",
- "fields": ["yearweek_Year", "yearweek_Year_end"]
+ "fields": [
+ "yearweek_Year_offsetted_rect_start",
+ "yearweek_Year_offsetted_rect_end"
+ ]
},
"range": [0, {"signal": "width"}]
},
@@ -84,10 +103,10 @@
"domain": {"data": "source_0", "field": "Origin", "sort": true},
"range": [
{
- "signal": "0.1 * (scale('x', datetime(2001, 0, 8, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
+ "signal": "-0.4 * (scale('x', datetime(2001, 0, 8, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
},
{
- "signal": "0.9 * (scale('x', datetime(2001, 0, 8, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
+ "signal": "0.4 * (scale('x', datetime(2001, 0, 8, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
}
]
},
diff --git a/examples/compiled/bar_month.vg.json b/examples/compiled/bar_month.vg.json
index d59b3b4477..9cf325f9b7 100644
--- a/examples/compiled/bar_month.vg.json
+++ b/examples/compiled/bar_month.vg.json
@@ -16,6 +16,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date"],
diff --git a/examples/compiled/bar_month_band.png b/examples/compiled/bar_month_band.png
index c121012888..b0ef9ccfd1 100644
Binary files a/examples/compiled/bar_month_band.png and b/examples/compiled/bar_month_band.png differ
diff --git a/examples/compiled/bar_month_band.svg b/examples/compiled/bar_month_band.svg
index 552e1e0336..0244c81a3c 100644
--- a/examples/compiled/bar_month_band.svg
+++ b/examples/compiled/bar_month_band.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_month_band.vg.json b/examples/compiled/bar_month_band.vg.json
index 9165a52a80..fb9b6fb928 100644
--- a/examples/compiled/bar_month_band.vg.json
+++ b/examples/compiled/bar_month_band.vg.json
@@ -17,9 +17,24 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
- "groupby": ["month_date", "month_date_end"],
+ "groupby": [
+ "month_date",
+ "month_date_end",
+ "month_date_offsetted_rect_start",
+ "month_date_offsetted_rect_end"
+ ],
"ops": ["mean"],
"fields": ["precipitation"],
"as": ["mean_precipitation"]
@@ -45,13 +60,13 @@
"signal": "\"date (month): \" + (timeFormat(datum[\"month_date\"], timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"}))) + \"; Mean of precipitation: \" + (format(datum[\"mean_precipitation\"], \"\"))"
},
"x2": {
- "signal": "scale(\"x\", 0.85 * datum[\"month_date\"] + 0.15000000000000002 * datum[\"month_date_end\"])",
+ "signal": "scale(\"x\", 0.85 * datum[\"month_date_offsetted_rect_start\"] + 0.15000000000000002 * datum[\"month_date_offsetted_rect_end\"])",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])))) : 0.5)"
}
},
"x": {
- "signal": "scale(\"x\", 0.15000000000000002 * datum[\"month_date\"] + 0.85 * datum[\"month_date_end\"])",
+ "signal": "scale(\"x\", 0.15000000000000002 * datum[\"month_date_offsetted_rect_start\"] + 0.85 * datum[\"month_date_offsetted_rect_end\"])",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])))) : -0.5)"
}
@@ -68,7 +83,10 @@
"type": "time",
"domain": {
"data": "source_0",
- "fields": ["month_date", "month_date_end"]
+ "fields": [
+ "month_date_offsetted_rect_start",
+ "month_date_offsetted_rect_end"
+ ]
},
"range": [0, {"signal": "width"}]
},
diff --git a/examples/compiled/bar_month_band_config.png b/examples/compiled/bar_month_band_config.png
index c121012888..b0ef9ccfd1 100644
Binary files a/examples/compiled/bar_month_band_config.png and b/examples/compiled/bar_month_band_config.png differ
diff --git a/examples/compiled/bar_month_band_config.svg b/examples/compiled/bar_month_band_config.svg
index 552e1e0336..0244c81a3c 100644
--- a/examples/compiled/bar_month_band_config.svg
+++ b/examples/compiled/bar_month_band_config.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_month_band_config.vg.json b/examples/compiled/bar_month_band_config.vg.json
index 9165a52a80..fb9b6fb928 100644
--- a/examples/compiled/bar_month_band_config.vg.json
+++ b/examples/compiled/bar_month_band_config.vg.json
@@ -17,9 +17,24 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
- "groupby": ["month_date", "month_date_end"],
+ "groupby": [
+ "month_date",
+ "month_date_end",
+ "month_date_offsetted_rect_start",
+ "month_date_offsetted_rect_end"
+ ],
"ops": ["mean"],
"fields": ["precipitation"],
"as": ["mean_precipitation"]
@@ -45,13 +60,13 @@
"signal": "\"date (month): \" + (timeFormat(datum[\"month_date\"], timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"}))) + \"; Mean of precipitation: \" + (format(datum[\"mean_precipitation\"], \"\"))"
},
"x2": {
- "signal": "scale(\"x\", 0.85 * datum[\"month_date\"] + 0.15000000000000002 * datum[\"month_date_end\"])",
+ "signal": "scale(\"x\", 0.85 * datum[\"month_date_offsetted_rect_start\"] + 0.15000000000000002 * datum[\"month_date_offsetted_rect_end\"])",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])))) : 0.5)"
}
},
"x": {
- "signal": "scale(\"x\", 0.15000000000000002 * datum[\"month_date\"] + 0.85 * datum[\"month_date_end\"])",
+ "signal": "scale(\"x\", 0.15000000000000002 * datum[\"month_date_offsetted_rect_start\"] + 0.85 * datum[\"month_date_offsetted_rect_end\"])",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])))) : -0.5)"
}
@@ -68,7 +83,10 @@
"type": "time",
"domain": {
"data": "source_0",
- "fields": ["month_date", "month_date_end"]
+ "fields": [
+ "month_date_offsetted_rect_start",
+ "month_date_offsetted_rect_end"
+ ]
},
"range": [0, {"signal": "width"}]
},
diff --git a/examples/compiled/bar_month_temporal.png b/examples/compiled/bar_month_temporal.png
index 61c1c04fab..62203cbc3b 100644
Binary files a/examples/compiled/bar_month_temporal.png and b/examples/compiled/bar_month_temporal.png differ
diff --git a/examples/compiled/bar_month_temporal.svg b/examples/compiled/bar_month_temporal.svg
index cf84822e48..4c5776ae76 100644
--- a/examples/compiled/bar_month_temporal.svg
+++ b/examples/compiled/bar_month_temporal.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_month_temporal.vg.json b/examples/compiled/bar_month_temporal.vg.json
index 25cac61d2b..597691718b 100644
--- a/examples/compiled/bar_month_temporal.vg.json
+++ b/examples/compiled/bar_month_temporal.vg.json
@@ -17,9 +17,24 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
- "groupby": ["month_date", "month_date_end"],
+ "groupby": [
+ "month_date",
+ "month_date_end",
+ "month_date_offsetted_rect_start",
+ "month_date_offsetted_rect_end"
+ ],
"ops": ["mean"],
"fields": ["precipitation"],
"as": ["mean_precipitation"]
@@ -46,14 +61,14 @@
},
"x2": {
"scale": "x",
- "field": "month_date",
+ "field": "month_date_offsetted_rect_start",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])))) : 0.5)"
}
},
"x": {
"scale": "x",
- "field": "month_date_end",
+ "field": "month_date_offsetted_rect_end",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])))) : -0.5)"
}
@@ -70,7 +85,10 @@
"type": "time",
"domain": {
"data": "source_0",
- "fields": ["month_date", "month_date_end"]
+ "fields": [
+ "month_date_offsetted_rect_start",
+ "month_date_offsetted_rect_end"
+ ]
},
"range": [0, {"signal": "width"}]
},
diff --git a/examples/compiled/bar_month_temporal_initial.png b/examples/compiled/bar_month_temporal_initial.png
index 9cf91fe5d3..a156da5dde 100644
Binary files a/examples/compiled/bar_month_temporal_initial.png and b/examples/compiled/bar_month_temporal_initial.png differ
diff --git a/examples/compiled/bar_month_temporal_initial.svg b/examples/compiled/bar_month_temporal_initial.svg
index a7b19c189b..045c2bfdab 100644
--- a/examples/compiled/bar_month_temporal_initial.svg
+++ b/examples/compiled/bar_month_temporal_initial.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_month_temporal_initial.vg.json b/examples/compiled/bar_month_temporal_initial.vg.json
index 73328c7f46..a877f6dcf0 100644
--- a/examples/compiled/bar_month_temporal_initial.vg.json
+++ b/examples/compiled/bar_month_temporal_initial.vg.json
@@ -18,9 +18,24 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
- "groupby": ["month_date", "month_date_end"],
+ "groupby": [
+ "month_date",
+ "month_date_end",
+ "month_date_offsetted_rect_start",
+ "month_date_offsetted_rect_end"
+ ],
"ops": ["mean"],
"fields": ["precipitation"],
"as": ["mean_precipitation"]
@@ -47,14 +62,14 @@
},
"x2": {
"scale": "x",
- "field": "month_date",
+ "field": "month_date_offsetted_rect_start",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])))) : 0.5)"
}
},
"x": {
"scale": "x",
- "field": "month_date_end",
+ "field": "month_date_offsetted_rect_end",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])))) : -0.5)"
}
@@ -71,7 +86,10 @@
"type": "time",
"domain": {
"data": "source_0",
- "fields": ["month_date", "month_date_end"]
+ "fields": [
+ "month_date_offsetted_rect_start",
+ "month_date_offsetted_rect_end"
+ ]
},
"range": [0, {"signal": "width"}]
},
diff --git a/examples/compiled/bar_simple_binned_timeunit_special_chars.png b/examples/compiled/bar_simple_binned_timeunit_special_chars.png
index 3af3f68f65..9eb694864c 100644
Binary files a/examples/compiled/bar_simple_binned_timeunit_special_chars.png and b/examples/compiled/bar_simple_binned_timeunit_special_chars.png differ
diff --git a/examples/compiled/bar_simple_binned_timeunit_special_chars.svg b/examples/compiled/bar_simple_binned_timeunit_special_chars.svg
index 822168923d..853e6843c0 100644
--- a/examples/compiled/bar_simple_binned_timeunit_special_chars.svg
+++ b/examples/compiled/bar_simple_binned_timeunit_special_chars.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_simple_binned_timeunit_special_chars.vg.json b/examples/compiled/bar_simple_binned_timeunit_special_chars.vg.json
index 2fb873170f..a708222cbe 100644
--- a/examples/compiled/bar_simple_binned_timeunit_special_chars.vg.json
+++ b/examples/compiled/bar_simple_binned_timeunit_special_chars.vg.json
@@ -34,6 +34,16 @@
"expr": "utcOffset('date', datum['a.b'], 1)",
"as": "a.b_end"
},
+ {
+ "type": "formula",
+ "expr": "0.5 * utcOffset('date', datum['a.b'], -1) + 0.5 * datum['a.b']",
+ "as": "a.b_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['a.b'] + 0.5 * datum['a.b_end']",
+ "as": "a.b_offsetted_rect_end"
+ },
{
"type": "stack",
"groupby": ["a\\.b"],
@@ -66,14 +76,14 @@
"x2": {"scale": "x", "field": "b_start"},
"y2": {
"scale": "y",
- "field": "a\\.b",
+ "field": "a\\.b_offsetted_rect_start",
"offset": {
"signal": "0.5 + (abs(scale(\"y\", datum[\"a.b_end\"]) - scale(\"y\", datum[\"a.b\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"y\", datum[\"a.b_end\"]) - scale(\"y\", datum[\"a.b\"])))) : -0.5)"
}
},
"y": {
"scale": "y",
- "field": "a\\.b_end",
+ "field": "a\\.b_offsetted_rect_end",
"offset": {
"signal": "0.5 + (abs(scale(\"y\", datum[\"a.b_end\"]) - scale(\"y\", datum[\"a.b\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"y\", datum[\"a.b_end\"]) - scale(\"y\", datum[\"a.b\"])))) : 0.5)"
}
@@ -94,7 +104,10 @@
{
"name": "y",
"type": "utc",
- "domain": {"data": "data_0", "fields": ["a\\.b", "a\\.b_end"]},
+ "domain": {
+ "data": "data_0",
+ "fields": ["a\\.b_offsetted_rect_start", "a\\.b_offsetted_rect_end"]
+ },
"range": [{"signal": "height"}, 0]
}
],
diff --git a/examples/compiled/bar_yearmonth.png b/examples/compiled/bar_yearmonth.png
index 88354b541e..4ac977a0c8 100644
Binary files a/examples/compiled/bar_yearmonth.png and b/examples/compiled/bar_yearmonth.png differ
diff --git a/examples/compiled/bar_yearmonth.svg b/examples/compiled/bar_yearmonth.svg
index 01afff80b1..4e3fa4a8cc 100644
--- a/examples/compiled/bar_yearmonth.svg
+++ b/examples/compiled/bar_yearmonth.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_yearmonth.vg.json b/examples/compiled/bar_yearmonth.vg.json
index 3427f5e5de..4886b6c607 100644
--- a/examples/compiled/bar_yearmonth.vg.json
+++ b/examples/compiled/bar_yearmonth.vg.json
@@ -18,9 +18,24 @@
"units": ["year", "month"],
"as": ["yearmonth_date", "yearmonth_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['yearmonth_date'], -1) + 0.5 * datum['yearmonth_date']",
+ "as": "yearmonth_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['yearmonth_date'] + 0.5 * datum['yearmonth_date_end']",
+ "as": "yearmonth_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
- "groupby": ["yearmonth_date", "yearmonth_date_end"],
+ "groupby": [
+ "yearmonth_date",
+ "yearmonth_date_end",
+ "yearmonth_date_offsetted_rect_start",
+ "yearmonth_date_offsetted_rect_end"
+ ],
"ops": ["mean"],
"fields": ["temp_max"],
"as": ["mean_temp_max"]
@@ -47,14 +62,14 @@
},
"x2": {
"scale": "x",
- "field": "yearmonth_date",
+ "field": "yearmonth_date_offsetted_rect_start",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"yearmonth_date_end\"]) - scale(\"x\", datum[\"yearmonth_date\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"x\", datum[\"yearmonth_date_end\"]) - scale(\"x\", datum[\"yearmonth_date\"])))) : 0.5)"
}
},
"x": {
"scale": "x",
- "field": "yearmonth_date_end",
+ "field": "yearmonth_date_offsetted_rect_end",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"yearmonth_date_end\"]) - scale(\"x\", datum[\"yearmonth_date\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"x\", datum[\"yearmonth_date_end\"]) - scale(\"x\", datum[\"yearmonth_date\"])))) : -0.5)"
}
@@ -71,7 +86,10 @@
"type": "time",
"domain": {
"data": "source_0",
- "fields": ["yearmonth_date", "yearmonth_date_end"]
+ "fields": [
+ "yearmonth_date_offsetted_rect_start",
+ "yearmonth_date_offsetted_rect_end"
+ ]
},
"range": [0, {"signal": "width"}]
},
diff --git a/examples/compiled/bar_yearmonth_custom_format.png b/examples/compiled/bar_yearmonth_custom_format.png
index e68fb7c90b..e1b56a7d9d 100644
Binary files a/examples/compiled/bar_yearmonth_custom_format.png and b/examples/compiled/bar_yearmonth_custom_format.png differ
diff --git a/examples/compiled/bar_yearmonth_custom_format.svg b/examples/compiled/bar_yearmonth_custom_format.svg
index 3f0c17011f..1916da65ed 100644
--- a/examples/compiled/bar_yearmonth_custom_format.svg
+++ b/examples/compiled/bar_yearmonth_custom_format.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_yearmonth_custom_format.vg.json b/examples/compiled/bar_yearmonth_custom_format.vg.json
index 5463902d4f..a6409f322c 100644
--- a/examples/compiled/bar_yearmonth_custom_format.vg.json
+++ b/examples/compiled/bar_yearmonth_custom_format.vg.json
@@ -18,9 +18,24 @@
"units": ["year", "month"],
"as": ["yearmonth_date", "yearmonth_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['yearmonth_date'], -1) + 0.5 * datum['yearmonth_date']",
+ "as": "yearmonth_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['yearmonth_date'] + 0.5 * datum['yearmonth_date_end']",
+ "as": "yearmonth_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
- "groupby": ["yearmonth_date", "yearmonth_date_end"],
+ "groupby": [
+ "yearmonth_date",
+ "yearmonth_date_end",
+ "yearmonth_date_offsetted_rect_start",
+ "yearmonth_date_offsetted_rect_end"
+ ],
"ops": ["mean"],
"fields": ["temp_max"],
"as": ["mean_temp_max"]
@@ -47,14 +62,14 @@
},
"x2": {
"scale": "x",
- "field": "yearmonth_date",
+ "field": "yearmonth_date_offsetted_rect_start",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"yearmonth_date_end\"]) - scale(\"x\", datum[\"yearmonth_date\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"x\", datum[\"yearmonth_date_end\"]) - scale(\"x\", datum[\"yearmonth_date\"])))) : 0.5)"
}
},
"x": {
"scale": "x",
- "field": "yearmonth_date_end",
+ "field": "yearmonth_date_offsetted_rect_end",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"yearmonth_date_end\"]) - scale(\"x\", datum[\"yearmonth_date\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"x\", datum[\"yearmonth_date_end\"]) - scale(\"x\", datum[\"yearmonth_date\"])))) : -0.5)"
}
@@ -71,7 +86,10 @@
"type": "time",
"domain": {
"data": "source_0",
- "fields": ["yearmonth_date", "yearmonth_date_end"]
+ "fields": [
+ "yearmonth_date_offsetted_rect_start",
+ "yearmonth_date_offsetted_rect_end"
+ ]
},
"range": [0, {"signal": "width"}]
},
diff --git a/examples/compiled/bar_yearmonthdate_minBandSize.png b/examples/compiled/bar_yearmonthdate_minBandSize.png
index d4ded550f7..5982267745 100644
Binary files a/examples/compiled/bar_yearmonthdate_minBandSize.png and b/examples/compiled/bar_yearmonthdate_minBandSize.png differ
diff --git a/examples/compiled/bar_yearmonthdate_minBandSize.svg b/examples/compiled/bar_yearmonthdate_minBandSize.svg
index 7a68bb0727..4a24820c6b 100644
--- a/examples/compiled/bar_yearmonthdate_minBandSize.svg
+++ b/examples/compiled/bar_yearmonthdate_minBandSize.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/bar_yearmonthdate_minBandSize.vg.json b/examples/compiled/bar_yearmonthdate_minBandSize.vg.json
index bcf02a3741..1d8ad70f6a 100644
--- a/examples/compiled/bar_yearmonthdate_minBandSize.vg.json
+++ b/examples/compiled/bar_yearmonthdate_minBandSize.vg.json
@@ -17,9 +17,24 @@
"units": ["year", "month", "date"],
"as": ["yearmonthdate_date", "yearmonthdate_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('date', datum['yearmonthdate_date'], -1) + 0.5 * datum['yearmonthdate_date']",
+ "as": "yearmonthdate_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['yearmonthdate_date'] + 0.5 * datum['yearmonthdate_date_end']",
+ "as": "yearmonthdate_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
- "groupby": ["yearmonthdate_date", "yearmonthdate_date_end"],
+ "groupby": [
+ "yearmonthdate_date",
+ "yearmonthdate_date_end",
+ "yearmonthdate_date_offsetted_rect_start",
+ "yearmonthdate_date_offsetted_rect_end"
+ ],
"ops": ["mean"],
"fields": ["temp_max"],
"as": ["mean_temp_max"]
@@ -46,14 +61,14 @@
},
"x2": {
"scale": "x",
- "field": "yearmonthdate_date",
+ "field": "yearmonthdate_date_offsetted_rect_start",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"yearmonthdate_date_end\"]) - scale(\"x\", datum[\"yearmonthdate_date\"])) < 2 ? -0.5 * (2 - (abs(scale(\"x\", datum[\"yearmonthdate_date_end\"]) - scale(\"x\", datum[\"yearmonthdate_date\"])))) : 0.5)"
}
},
"x": {
"scale": "x",
- "field": "yearmonthdate_date_end",
+ "field": "yearmonthdate_date_offsetted_rect_end",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"yearmonthdate_date_end\"]) - scale(\"x\", datum[\"yearmonthdate_date\"])) < 2 ? 0.5 * (2 - (abs(scale(\"x\", datum[\"yearmonthdate_date_end\"]) - scale(\"x\", datum[\"yearmonthdate_date\"])))) : -0.5)"
}
@@ -70,7 +85,10 @@
"type": "time",
"domain": {
"data": "source_0",
- "fields": ["yearmonthdate_date", "yearmonthdate_date_end"]
+ "fields": [
+ "yearmonthdate_date_offsetted_rect_start",
+ "yearmonthdate_date_offsetted_rect_end"
+ ]
},
"range": [0, {"signal": "width"}]
},
diff --git a/examples/compiled/concat_weather.vg.json b/examples/compiled/concat_weather.vg.json
index 7db19ec215..b78537c078 100644
--- a/examples/compiled/concat_weather.vg.json
+++ b/examples/compiled/concat_weather.vg.json
@@ -20,6 +20,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date"],
diff --git a/examples/compiled/hconcat_weather.vg.json b/examples/compiled/hconcat_weather.vg.json
index 240bcd9e94..7f15cbe1e7 100644
--- a/examples/compiled/hconcat_weather.vg.json
+++ b/examples/compiled/hconcat_weather.vg.json
@@ -21,6 +21,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date"],
diff --git a/examples/compiled/layer_bar_month.vg.json b/examples/compiled/layer_bar_month.vg.json
index 98c23e75f6..4f1ab24d14 100644
--- a/examples/compiled/layer_bar_month.vg.json
+++ b/examples/compiled/layer_bar_month.vg.json
@@ -20,6 +20,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date"],
diff --git a/examples/compiled/layer_falkensee.vg.json b/examples/compiled/layer_falkensee.vg.json
index 1a44900ffb..6579b8be76 100644
--- a/examples/compiled/layer_falkensee.vg.json
+++ b/examples/compiled/layer_falkensee.vg.json
@@ -104,6 +104,16 @@
"units": ["year"],
"as": ["year_start", "year_start_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('year', datum['year_start'], -1) + 0.5 * datum['year_start']",
+ "as": "year_start_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['year_start'] + 0.5 * datum['year_start_end']",
+ "as": "year_start_offsetted_rect_end"
+ },
{
"field": "end",
"type": "timeunit",
diff --git a/examples/compiled/layer_precipitation_mean.vg.json b/examples/compiled/layer_precipitation_mean.vg.json
index 6d2e5e4be2..b46eab3c3d 100644
--- a/examples/compiled/layer_precipitation_mean.vg.json
+++ b/examples/compiled/layer_precipitation_mean.vg.json
@@ -20,6 +20,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date"],
diff --git a/examples/compiled/layer_timeunit_rect.png b/examples/compiled/layer_timeunit_rect.png
index fc3fbb3d3e..5544384851 100644
Binary files a/examples/compiled/layer_timeunit_rect.png and b/examples/compiled/layer_timeunit_rect.png differ
diff --git a/examples/compiled/layer_timeunit_rect.svg b/examples/compiled/layer_timeunit_rect.svg
index 4e1253bee3..6026d40227 100644
--- a/examples/compiled/layer_timeunit_rect.svg
+++ b/examples/compiled/layer_timeunit_rect.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/layer_timeunit_rect.vg.json b/examples/compiled/layer_timeunit_rect.vg.json
index 48330e6112..7fcdbedebe 100644
--- a/examples/compiled/layer_timeunit_rect.vg.json
+++ b/examples/compiled/layer_timeunit_rect.vg.json
@@ -22,9 +22,24 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
- "groupby": ["month_date", "month_date_end"],
+ "groupby": [
+ "month_date",
+ "month_date_end",
+ "month_date_offsetted_rect_start",
+ "month_date_offsetted_rect_end"
+ ],
"ops": ["mean"],
"fields": ["precipitation"],
"as": ["mean_precipitation"]
@@ -51,6 +66,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"field": "date_end",
"type": "timeunit",
@@ -79,14 +104,14 @@
},
"x2": {
"scale": "x",
- "field": "month_date",
+ "field": "month_date_offsetted_rect_start",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])))) : 0.5)"
}
},
"x": {
"scale": "x",
- "field": "month_date_end",
+ "field": "month_date_offsetted_rect_end",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])))) : -0.5)"
}
@@ -122,8 +147,8 @@
"type": "time",
"domain": {
"fields": [
- {"data": "source_0", "field": "month_date"},
- {"data": "source_0", "field": "month_date_end"},
+ {"data": "source_0", "field": "month_date_offsetted_rect_start"},
+ {"data": "source_0", "field": "month_date_offsetted_rect_end"},
{"data": "data_0", "field": "month_date"},
{"data": "data_0", "field": "month_date_end"}
]
diff --git a/examples/compiled/line_month_center_band_offset.png b/examples/compiled/line_month_center_band_offset.png
index cdb769d34d..14599f8a9a 100644
Binary files a/examples/compiled/line_month_center_band_offset.png and b/examples/compiled/line_month_center_band_offset.png differ
diff --git a/examples/compiled/line_month_center_band_offset.svg b/examples/compiled/line_month_center_band_offset.svg
index 0465e434de..58bc35e6a2 100644
--- a/examples/compiled/line_month_center_band_offset.svg
+++ b/examples/compiled/line_month_center_band_offset.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/line_month_center_band_offset.vg.json b/examples/compiled/line_month_center_band_offset.vg.json
index c89e017563..27be1d52f6 100644
--- a/examples/compiled/line_month_center_band_offset.vg.json
+++ b/examples/compiled/line_month_center_band_offset.vg.json
@@ -17,9 +17,24 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
- "groupby": ["month_date", "month_date_end"],
+ "groupby": [
+ "month_date",
+ "month_date_end",
+ "month_date_offsetted_rect_start",
+ "month_date_offsetted_rect_end"
+ ],
"ops": ["mean"],
"fields": ["precipitation"],
"as": ["mean_precipitation"]
@@ -46,14 +61,14 @@
},
"x2": {
"scale": "x",
- "field": "month_date",
+ "field": "month_date_offsetted_rect_start",
"offset": {
"signal": "0.5 + (2 + (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])))) : 0.5))"
}
},
"x": {
"scale": "x",
- "field": "month_date_end",
+ "field": "month_date_offsetted_rect_end",
"offset": {
"signal": "0.5 + (-2 + (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"x\", datum[\"month_date_end\"]) - scale(\"x\", datum[\"month_date\"])))) : -0.5))"
}
@@ -70,7 +85,10 @@
"type": "time",
"domain": {
"data": "source_0",
- "fields": ["month_date", "month_date_end"]
+ "fields": [
+ "month_date_offsetted_rect_start",
+ "month_date_offsetted_rect_end"
+ ]
},
"range": [0, {"signal": "width"}]
},
diff --git a/examples/compiled/rect_heatmap_weather.vg.json b/examples/compiled/rect_heatmap_weather.vg.json
index 6c00cfca80..0e0baa8e3e 100644
--- a/examples/compiled/rect_heatmap_weather.vg.json
+++ b/examples/compiled/rect_heatmap_weather.vg.json
@@ -22,12 +22,32 @@
"units": ["date"],
"as": ["date_date", "date_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('date', datum['date_date'], -1) + 0.5 * datum['date_date']",
+ "as": "date_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['date_date'] + 0.5 * datum['date_date_end']",
+ "as": "date_date_offsetted_rect_end"
+ },
{
"field": "date",
"type": "timeunit",
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["date_date", "month_date"],
diff --git a/examples/compiled/rect_lasagna.vg.json b/examples/compiled/rect_lasagna.vg.json
index 95f0ff9d87..efc7976664 100644
--- a/examples/compiled/rect_lasagna.vg.json
+++ b/examples/compiled/rect_lasagna.vg.json
@@ -18,6 +18,16 @@
"units": ["year", "month", "date"],
"as": ["yearmonthdate_date", "yearmonthdate_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('date', datum['yearmonthdate_date'], -1) + 0.5 * datum['yearmonthdate_date']",
+ "as": "yearmonthdate_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['yearmonthdate_date'] + 0.5 * datum['yearmonthdate_date_end']",
+ "as": "yearmonthdate_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["yearmonthdate_date", "symbol"],
diff --git a/examples/compiled/selection_layer_bar_month.vg.json b/examples/compiled/selection_layer_bar_month.vg.json
index bf4b4c590d..aecb7eacad 100644
--- a/examples/compiled/selection_layer_bar_month.vg.json
+++ b/examples/compiled/selection_layer_bar_month.vg.json
@@ -16,6 +16,22 @@
"type": "timeunit",
"units": ["month"],
"as": ["month_date", "month_date_end"]
+ },
+ {
+ "field": "date",
+ "type": "timeunit",
+ "units": ["month"],
+ "as": ["month_date", "month_date_end"]
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
}
]
},
diff --git a/examples/compiled/stacked_bar_count.vg.json b/examples/compiled/stacked_bar_count.vg.json
index 122e0b7c50..163b53c4f7 100644
--- a/examples/compiled/stacked_bar_count.vg.json
+++ b/examples/compiled/stacked_bar_count.vg.json
@@ -16,6 +16,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date", "weather"],
diff --git a/examples/compiled/stacked_bar_count_corner_radius_config.vg.json b/examples/compiled/stacked_bar_count_corner_radius_config.vg.json
index 71509e63d7..08a449aee0 100644
--- a/examples/compiled/stacked_bar_count_corner_radius_config.vg.json
+++ b/examples/compiled/stacked_bar_count_corner_radius_config.vg.json
@@ -16,6 +16,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date", "weather"],
diff --git a/examples/compiled/stacked_bar_count_corner_radius_mark.vg.json b/examples/compiled/stacked_bar_count_corner_radius_mark.vg.json
index 0c06b8c8ec..cb147c3d49 100644
--- a/examples/compiled/stacked_bar_count_corner_radius_mark.vg.json
+++ b/examples/compiled/stacked_bar_count_corner_radius_mark.vg.json
@@ -16,6 +16,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date", "weather"],
diff --git a/examples/compiled/stacked_bar_count_corner_radius_mark_x.vg.json b/examples/compiled/stacked_bar_count_corner_radius_mark_x.vg.json
index 984baf0d17..acdbb8fa49 100644
--- a/examples/compiled/stacked_bar_count_corner_radius_mark_x.vg.json
+++ b/examples/compiled/stacked_bar_count_corner_radius_mark_x.vg.json
@@ -16,6 +16,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date", "weather"],
diff --git a/examples/compiled/stacked_bar_count_corner_radius_stroke.vg.json b/examples/compiled/stacked_bar_count_corner_radius_stroke.vg.json
index 15bd6cdf6c..67da150fd2 100644
--- a/examples/compiled/stacked_bar_count_corner_radius_stroke.vg.json
+++ b/examples/compiled/stacked_bar_count_corner_radius_stroke.vg.json
@@ -16,6 +16,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date", "weather"],
diff --git a/examples/compiled/stacked_bar_size.vg.json b/examples/compiled/stacked_bar_size.vg.json
index 7008e2f790..cb96993aac 100644
--- a/examples/compiled/stacked_bar_size.vg.json
+++ b/examples/compiled/stacked_bar_size.vg.json
@@ -16,6 +16,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date", "weather"],
diff --git a/examples/compiled/stacked_bar_weather.vg.json b/examples/compiled/stacked_bar_weather.vg.json
index 14721fff3b..8341b9f0ea 100644
--- a/examples/compiled/stacked_bar_weather.vg.json
+++ b/examples/compiled/stacked_bar_weather.vg.json
@@ -16,6 +16,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date", "weather"],
diff --git a/examples/compiled/time_custom_step.png b/examples/compiled/time_custom_step.png
index 09ac809ba0..472cfe9708 100644
Binary files a/examples/compiled/time_custom_step.png and b/examples/compiled/time_custom_step.png differ
diff --git a/examples/compiled/time_custom_step.svg b/examples/compiled/time_custom_step.svg
index ff9d209909..68157409c9 100644
--- a/examples/compiled/time_custom_step.svg
+++ b/examples/compiled/time_custom_step.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/compiled/time_custom_step.vg.json b/examples/compiled/time_custom_step.vg.json
index f6ed2a1bf3..f355eb9235 100644
--- a/examples/compiled/time_custom_step.vg.json
+++ b/examples/compiled/time_custom_step.vg.json
@@ -40,9 +40,24 @@
"step": 5,
"as": ["minutes_step_5_date", "minutes_step_5_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('minutes', datum['minutes_step_5_date'], -5) + 0.5 * datum['minutes_step_5_date']",
+ "as": "minutes_step_5_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['minutes_step_5_date'] + 0.5 * datum['minutes_step_5_date_end']",
+ "as": "minutes_step_5_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
- "groupby": ["minutes_step_5_date", "minutes_step_5_date_end"],
+ "groupby": [
+ "minutes_step_5_date",
+ "minutes_step_5_date_end",
+ "minutes_step_5_date_offsetted_rect_start",
+ "minutes_step_5_date_offsetted_rect_end"
+ ],
"ops": ["sum"],
"fields": ["distance"],
"as": ["sum_distance"]
@@ -69,14 +84,14 @@
},
"x2": {
"scale": "x",
- "field": "minutes_step_5_date",
+ "field": "minutes_step_5_date_offsetted_rect_start",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"minutes_step_5_date_end\"]) - scale(\"x\", datum[\"minutes_step_5_date\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"x\", datum[\"minutes_step_5_date_end\"]) - scale(\"x\", datum[\"minutes_step_5_date\"])))) : 0.5)"
}
},
"x": {
"scale": "x",
- "field": "minutes_step_5_date_end",
+ "field": "minutes_step_5_date_offsetted_rect_end",
"offset": {
"signal": "0.5 + (abs(scale(\"x\", datum[\"minutes_step_5_date_end\"]) - scale(\"x\", datum[\"minutes_step_5_date\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"x\", datum[\"minutes_step_5_date_end\"]) - scale(\"x\", datum[\"minutes_step_5_date\"])))) : -0.5)"
}
@@ -93,7 +108,10 @@
"type": "time",
"domain": {
"data": "data_0",
- "fields": ["minutes_step_5_date", "minutes_step_5_date_end"]
+ "fields": [
+ "minutes_step_5_date_offsetted_rect_start",
+ "minutes_step_5_date_offsetted_rect_end"
+ ]
},
"range": [0, {"signal": "width"}]
},
diff --git a/examples/compiled/time_parse_binnedutc.vg.json b/examples/compiled/time_parse_binnedutc.vg.json
index 55dc8f7d78..96fb9eecd6 100644
--- a/examples/compiled/time_parse_binnedutc.vg.json
+++ b/examples/compiled/time_parse_binnedutc.vg.json
@@ -18,6 +18,16 @@
"type": "formula",
"expr": "utcOffset('hours', datum['date'], 1)",
"as": "date_end"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * utcOffset('hours', 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"
}
]
}
diff --git a/examples/compiled/vconcat_weather.vg.json b/examples/compiled/vconcat_weather.vg.json
index 3db6ba2d6b..c9e2c3b9e1 100644
--- a/examples/compiled/vconcat_weather.vg.json
+++ b/examples/compiled/vconcat_weather.vg.json
@@ -20,6 +20,16 @@
"units": ["month"],
"as": ["month_date", "month_date_end"]
},
+ {
+ "type": "formula",
+ "expr": "0.5 * timeOffset('month', datum['month_date'], -1) + 0.5 * datum['month_date']",
+ "as": "month_date_offsetted_rect_start"
+ },
+ {
+ "type": "formula",
+ "expr": "0.5 * datum['month_date'] + 0.5 * datum['month_date_end']",
+ "as": "month_date_offsetted_rect_end"
+ },
{
"type": "aggregate",
"groupby": ["month_date"],