Skip to content

Commit

Permalink
fix(#8338,#8126): make boxplot work with single value per group (#8339)
Browse files Browse the repository at this point in the history
Fixes #8338, fixes #8126

---------

Co-authored-by: GitHub Actions Bot <vega-actions-bot@users.noreply.github.com>
  • Loading branch information
kanitw and GitHub Actions Bot committed Apr 8, 2024
1 parent 64d6daf commit 4e55836
Show file tree
Hide file tree
Showing 42 changed files with 1,277 additions and 20 deletions.
8 changes: 7 additions & 1 deletion examples/compiled/boxplot_1D_horizontal.vg.json
Expand Up @@ -219,7 +219,13 @@
"encode": {
"update": {
"opacity": {"value": 0.7},
"fill": {"value": "white"},
"fill": [
{
"test": "datum['lower_box_Body Mass (g)'] >= datum['upper_box_Body Mass (g)']",
"value": "#4c78a8"
},
{"value": "white"}
],
"tooltip": {
"signal": "{\"Max of Body Mass (g)\": format(datum[\"max_Body Mass (g)\"], \"\"), \"Q3 of Body Mass (g)\": format(datum[\"upper_box_Body Mass (g)\"], \"\"), \"Median of Body Mass (g)\": format(datum[\"mid_box_Body Mass (g)\"], \"\"), \"Q1 of Body Mass (g)\": format(datum[\"lower_box_Body Mass (g)\"], \"\"), \"Min of Body Mass (g)\": format(datum[\"min_Body Mass (g)\"], \"\")}"
},
Expand Down
8 changes: 7 additions & 1 deletion examples/compiled/boxplot_1D_horizontal_custom_mark.vg.json
Expand Up @@ -269,7 +269,13 @@
"encode": {
"update": {
"opacity": {"value": 0.7},
"fill": {"value": "red"},
"fill": [
{
"test": "datum['lower_box_Body Mass (g)'] >= datum['upper_box_Body Mass (g)']",
"value": "#4c78a8"
},
{"value": "red"}
],
"tooltip": {
"signal": "{\"Max of Body Mass (g)\": format(datum[\"max_Body Mass (g)\"], \"\"), \"Q3 of Body Mass (g)\": format(datum[\"upper_box_Body Mass (g)\"], \"\"), \"Median of Body Mass (g)\": format(datum[\"mid_box_Body Mass (g)\"], \"\"), \"Q1 of Body Mass (g)\": format(datum[\"lower_box_Body Mass (g)\"], \"\"), \"Min of Body Mass (g)\": format(datum[\"min_Body Mass (g)\"], \"\")}"
},
Expand Down
8 changes: 7 additions & 1 deletion examples/compiled/boxplot_1D_horizontal_explicit.vg.json
Expand Up @@ -219,7 +219,13 @@
"encode": {
"update": {
"opacity": {"value": 0.7},
"fill": {"value": "white"},
"fill": [
{
"test": "datum['lower_box_Body Mass (g)'] >= datum['upper_box_Body Mass (g)']",
"value": "#4c78a8"
},
{"value": "white"}
],
"tooltip": {
"signal": "{\"Max of Body Mass (g)\": format(datum[\"max_Body Mass (g)\"], \"\"), \"Q3 of Body Mass (g)\": format(datum[\"upper_box_Body Mass (g)\"], \"\"), \"Median of Body Mass (g)\": format(datum[\"mid_box_Body Mass (g)\"], \"\"), \"Q1 of Body Mass (g)\": format(datum[\"lower_box_Body Mass (g)\"], \"\"), \"Min of Body Mass (g)\": format(datum[\"min_Body Mass (g)\"], \"\")}"
},
Expand Down
8 changes: 7 additions & 1 deletion examples/compiled/boxplot_1D_invalid.vg.json
Expand Up @@ -207,7 +207,13 @@
"encode": {
"update": {
"opacity": {"value": 0.7},
"fill": {"value": "white"},
"fill": [
{
"test": "datum['lower_box_b'] >= datum['upper_box_b']",
"value": "#4c78a8"
},
{"value": "white"}
],
"tooltip": {
"signal": "{\"Max of b\": format(datum[\"max_b\"], \"\"), \"Q3 of b\": format(datum[\"upper_box_b\"], \"\"), \"Median of b\": format(datum[\"mid_box_b\"], \"\"), \"Q1 of b\": format(datum[\"lower_box_b\"], \"\"), \"Min of b\": format(datum[\"min_b\"], \"\"), \"a\": format(datum[\"a\"], \"\")}"
},
Expand Down
8 changes: 7 additions & 1 deletion examples/compiled/boxplot_1D_vertical.vg.json
Expand Up @@ -219,7 +219,13 @@
"encode": {
"update": {
"opacity": {"value": 0.7},
"fill": {"value": "white"},
"fill": [
{
"test": "datum['lower_box_Body Mass (g)'] >= datum['upper_box_Body Mass (g)']",
"value": "#4c78a8"
},
{"value": "white"}
],
"tooltip": {
"signal": "{\"Max of Body Mass (g)\": format(datum[\"max_Body Mass (g)\"], \"\"), \"Q3 of Body Mass (g)\": format(datum[\"upper_box_Body Mass (g)\"], \"\"), \"Median of Body Mass (g)\": format(datum[\"mid_box_Body Mass (g)\"], \"\"), \"Q1 of Body Mass (g)\": format(datum[\"lower_box_Body Mass (g)\"], \"\"), \"Min of Body Mass (g)\": format(datum[\"min_Body Mass (g)\"], \"\")}"
},
Expand Down
8 changes: 7 additions & 1 deletion examples/compiled/boxplot_2D_horizontal.vg.json
Expand Up @@ -222,7 +222,13 @@
"encode": {
"update": {
"opacity": {"value": 0.7},
"fill": {"value": "white"},
"fill": [
{
"test": "datum['lower_box_Body Mass (g)'] >= datum['upper_box_Body Mass (g)']",
"value": "#4c78a8"
},
{"value": "white"}
],
"tooltip": {
"signal": "{\"Max of Body Mass (g)\": format(datum[\"max_Body Mass (g)\"], \"\"), \"Q3 of Body Mass (g)\": format(datum[\"upper_box_Body Mass (g)\"], \"\"), \"Median of Body Mass (g)\": format(datum[\"mid_box_Body Mass (g)\"], \"\"), \"Q1 of Body Mass (g)\": format(datum[\"lower_box_Body Mass (g)\"], \"\"), \"Min of Body Mass (g)\": format(datum[\"min_Body Mass (g)\"], \"\"), \"Species\": isValid(datum[\"Species\"]) ? datum[\"Species\"] : \"\"+datum[\"Species\"]}"
},
Expand Down
8 changes: 7 additions & 1 deletion examples/compiled/boxplot_2D_horizontal_color_size.vg.json
Expand Up @@ -222,7 +222,13 @@
"encode": {
"update": {
"opacity": {"value": 0.7},
"fill": {"value": "white"},
"fill": [
{
"test": "datum['lower_box_Body Mass (g)'] >= datum['upper_box_Body Mass (g)']",
"value": "teal"
},
{"value": "white"}
],
"tooltip": {
"signal": "{\"Max of Body Mass (g)\": format(datum[\"max_Body Mass (g)\"], \"\"), \"Q3 of Body Mass (g)\": format(datum[\"upper_box_Body Mass (g)\"], \"\"), \"Median of Body Mass (g)\": format(datum[\"mid_box_Body Mass (g)\"], \"\"), \"Q1 of Body Mass (g)\": format(datum[\"lower_box_Body Mass (g)\"], \"\"), \"Min of Body Mass (g)\": format(datum[\"min_Body Mass (g)\"], \"\"), \"Species\": isValid(datum[\"Species\"]) ? datum[\"Species\"] : \"\"+datum[\"Species\"]}"
},
Expand Down
12 changes: 10 additions & 2 deletions examples/compiled/boxplot_2D_vertical.vg.json
Expand Up @@ -222,7 +222,14 @@
"encode": {
"update": {
"opacity": {"value": 0.7},
"fill": {"value": "white"},
"fill": [
{
"test": "datum['lower_box_Body Mass (g)'] >= datum['upper_box_Body Mass (g)']",
"scale": "color",
"field": "Species"
},
{"value": "white"}
],
"tooltip": {
"signal": "{\"Max of Body Mass (g)\": format(datum[\"max_Body Mass (g)\"], \"\"), \"Q3 of Body Mass (g)\": format(datum[\"upper_box_Body Mass (g)\"], \"\"), \"Median of Body Mass (g)\": format(datum[\"mid_box_Body Mass (g)\"], \"\"), \"Q1 of Body Mass (g)\": format(datum[\"lower_box_Body Mass (g)\"], \"\"), \"Min of Body Mass (g)\": format(datum[\"min_Body Mass (g)\"], \"\"), \"Species\": isValid(datum[\"Species\"]) ? datum[\"Species\"] : \"\"+datum[\"Species\"]}"
},
Expand Down Expand Up @@ -277,7 +284,8 @@
"domain": {
"fields": [
{"data": "data_1", "field": "Species"},
{"data": "data_6", "field": "Species"}
{"data": "data_6", "field": "Species"},
{"data": "data_7", "field": "Species"}
],
"sort": true
},
Expand Down
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/boxplot_2D_vertical_single_per_group.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4e55836

Please sign in to comment.