Skip to content

Commit

Permalink
fix: correctly place unfiltered null values for line (#9326) (#9334)
Browse files Browse the repository at this point in the history
## PR Description

Previously we forgot to add conditional logic for invalid values when
filtering is disabled (mark.invalid = null)

Interestingly, given area applies stack layout by default, it doesn't
suffer from the same bug that line does.

---------

Co-authored-by: GitHub Actions Bot <vega-actions-bot@users.noreply.github.com>
  • Loading branch information
kanitw and GitHub Actions Bot committed May 2, 2024
1 parent 5b7a596 commit b617c84
Show file tree
Hide file tree
Showing 9 changed files with 370 additions and 7 deletions.
Binary file added examples/compiled/area_invalid_null.png
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/area_invalid_null.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
141 changes: 141 additions & 0 deletions examples/compiled/area_invalid_null.vg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"background": "white",
"padding": 5,
"width": 200,
"height": 200,
"style": "cell",
"data": [
{
"name": "source_0",
"values": [
{"x": -1, "y": null},
{"x": 1, "y": 10},
{"x": 2, "y": 30},
{"x": 3, "y": null},
{"x": 4, "y": 15},
{"x": 5, "y": 30},
{"x": 6, "y": 40},
{"x": 7, "y": 20},
{"x": 10, "y": null}
]
},
{
"name": "data_0",
"source": "source_0",
"transform": [
{"type": "formula", "expr": "toNumber(datum[\"x\"])", "as": "x"},
{
"type": "impute",
"field": "y",
"groupby": [],
"key": "x",
"method": "value",
"value": 0
},
{
"type": "stack",
"groupby": ["x"],
"field": "y",
"sort": {"field": [], "order": []},
"as": ["y_start", "y_end"],
"offset": "zero"
}
]
}
],
"marks": [
{
"name": "marks",
"type": "area",
"style": ["area"],
"sort": {"field": "datum[\"x\"]"},
"from": {"data": "data_0"},
"encode": {
"update": {
"orient": {"value": "vertical"},
"fill": {"value": "#4c78a8"},
"description": {
"signal": "\"x: \" + (format(datum[\"x\"], \"\")) + \"; y: \" + (format(datum[\"y\"], \"\"))"
},
"x": [
{
"test": "!isValid(datum[\"x\"]) || !isFinite(+datum[\"x\"])",
"value": 0
},
{"scale": "x", "field": "x"}
],
"y": {"scale": "y", "field": "y_end"},
"y2": {"scale": "y", "field": "y_start"}
}
}
}
],
"scales": [
{
"name": "x",
"type": "linear",
"domain": {"data": "data_0", "field": "x"},
"range": [0, {"signal": "width"}],
"nice": true,
"zero": false
},
{
"name": "y",
"type": "linear",
"domain": {"data": "data_0", "fields": ["y_start", "y_end"]},
"range": [{"signal": "height"}, 0],
"nice": true,
"zero": true
}
],
"axes": [
{
"scale": "x",
"orient": "bottom",
"gridScale": "y",
"grid": true,
"tickCount": {"signal": "ceil(width/40)"},
"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": "x",
"labelFlush": true,
"labelOverlap": true,
"tickCount": {"signal": "ceil(width/40)"},
"zindex": 0
},
{
"scale": "y",
"orient": "left",
"grid": false,
"title": "y",
"labelOverlap": true,
"tickCount": {"signal": "ceil(height/40)"},
"zindex": 0
}
]
}
Binary file added examples/compiled/line_invalid_null.png
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/line_invalid_null.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 b617c84

Please sign in to comment.