diff --git a/build/vega-lite-schema.json b/build/vega-lite-schema.json index fca40a25b6..b7ee57aa85 100644 --- a/build/vega-lite-schema.json +++ b/build/vega-lite-schema.json @@ -513,15 +513,15 @@ ] }, "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null + "anyOf": [ + { + "$ref": "#/definitions/MarkInvalidDataMode" + }, + { + "type": "null" + } ], - "type": [ - "string", - "null" - ] + "description": "Invalid data mode, which defines how the marks and corresponding scales should represent invalid values (`null` and `NaN` in continuous scales *without* defined output for invalid values).\n\n- `\"filter\"` — *Exclude* all invalid values from the visualization's *marks* and *scales*. For path marks (for line, area, trail), this option will create paths that connect valid points, as if the data rows with invalid values do not exist.\n\n- `\"break-paths-filter-domains\"` — Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `\"filter\"`. All *scale* domains will *exclude* these filtered data points.\n\n- `\"break-paths-show-domains\"` — Break paths (for line, area, trail) at invalid values. Hide invalid values for non-path marks. All *scale* domains will *include* these filtered data points (for both path and non-path marks).\n\n- `\"show\"` or `null` — Show all data points in the marks and scale domains. Each scale will use the output for invalid values defined in `config.scale.invalid` or, if unspecified, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero).\n\n- `\"break-paths-show-path-domains\"` (default) — This is equivalent to `\"break-paths-show-domains\"` for path-based marks (line/area/trail) and `\"filter\"` for non-path marks.\n\n__Note__: If any channel's scale has an output for invalid values defined in `config.scale.invalid`, all values for the scales will be considered \"valid\" since they can produce a reasonable output for the scales. Thus, fields for such channels will not be filtered and will not cause path breaks." }, "limit": { "anyOf": [ @@ -3383,15 +3383,15 @@ ] }, "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null + "anyOf": [ + { + "$ref": "#/definitions/MarkInvalidDataMode" + }, + { + "type": "null" + } ], - "type": [ - "string", - "null" - ] + "description": "Invalid data mode, which defines how the marks and corresponding scales should represent invalid values (`null` and `NaN` in continuous scales *without* defined output for invalid values).\n\n- `\"filter\"` — *Exclude* all invalid values from the visualization's *marks* and *scales*. For path marks (for line, area, trail), this option will create paths that connect valid points, as if the data rows with invalid values do not exist.\n\n- `\"break-paths-filter-domains\"` — Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `\"filter\"`. All *scale* domains will *exclude* these filtered data points.\n\n- `\"break-paths-show-domains\"` — Break paths (for line, area, trail) at invalid values. Hide invalid values for non-path marks. All *scale* domains will *include* these filtered data points (for both path and non-path marks).\n\n- `\"show\"` or `null` — Show all data points in the marks and scale domains. Each scale will use the output for invalid values defined in `config.scale.invalid` or, if unspecified, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero).\n\n- `\"break-paths-show-path-domains\"` (default) — This is equivalent to `\"break-paths-show-domains\"` for path-based marks (line/area/trail) and `\"filter\"` for non-path marks.\n\n__Note__: If any channel's scale has an output for invalid values defined in `config.scale.invalid`, all values for the scales will be considered \"valid\" since they can produce a reasonable output for the scales. Thus, fields for such channels will not be filtered and will not cause path breaks." }, "limit": { "anyOf": [ @@ -4613,15 +4613,15 @@ "description": "The extent of the whiskers. Available options include:\n- `\"min-max\"`: min and max are the lower and upper whiskers respectively.\n- A number representing multiple of the interquartile range. This number will be multiplied by the IQR to determine whisker boundary, which spans from the smallest data to the largest data within the range _[Q1 - k * IQR, Q3 + k * IQR]_ where _Q1_ and _Q3_ are the first and third quartiles while _IQR_ is the interquartile range (_Q3-Q1_).\n\n__Default value:__ `1.5`." }, "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null + "anyOf": [ + { + "$ref": "#/definitions/MarkInvalidDataMode" + }, + { + "type": "null" + } ], - "type": [ - "string", - "null" - ] + "description": "Invalid data mode, which defines how the marks and corresponding scales should represent invalid values (`null` and `NaN` in continuous scales *without* defined output for invalid values).\n\n- `\"filter\"` — *Exclude* all invalid values from the visualization's *marks* and *scales*. For path marks (for line, area, trail), this option will create paths that connect valid points, as if the data rows with invalid values do not exist.\n\n- `\"break-paths-filter-domains\"` — Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `\"filter\"`. All *scale* domains will *exclude* these filtered data points.\n\n- `\"break-paths-show-domains\"` — Break paths (for line, area, trail) at invalid values. Hide invalid values for non-path marks. All *scale* domains will *include* these filtered data points (for both path and non-path marks).\n\n- `\"show\"` or `null` — Show all data points in the marks and scale domains. Each scale will use the output for invalid values defined in `config.scale.invalid` or, if unspecified, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero).\n\n- `\"break-paths-show-path-domains\"` (default) — This is equivalent to `\"break-paths-show-domains\"` for path-based marks (line/area/trail) and `\"filter\"` for non-path marks.\n\n__Note__: If any channel's scale has an output for invalid values defined in `config.scale.invalid`, all values for the scales will be considered \"valid\" since they can produce a reasonable output for the scales. Thus, fields for such channels will not be filtered and will not cause path breaks." }, "median": { "anyOf": [ @@ -15059,15 +15059,15 @@ ] }, "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null + "anyOf": [ + { + "$ref": "#/definitions/MarkInvalidDataMode" + }, + { + "type": "null" + } ], - "type": [ - "string", - "null" - ] + "description": "Invalid data mode, which defines how the marks and corresponding scales should represent invalid values (`null` and `NaN` in continuous scales *without* defined output for invalid values).\n\n- `\"filter\"` — *Exclude* all invalid values from the visualization's *marks* and *scales*. For path marks (for line, area, trail), this option will create paths that connect valid points, as if the data rows with invalid values do not exist.\n\n- `\"break-paths-filter-domains\"` — Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `\"filter\"`. All *scale* domains will *exclude* these filtered data points.\n\n- `\"break-paths-show-domains\"` — Break paths (for line, area, trail) at invalid values. Hide invalid values for non-path marks. All *scale* domains will *include* these filtered data points (for both path and non-path marks).\n\n- `\"show\"` or `null` — Show all data points in the marks and scale domains. Each scale will use the output for invalid values defined in `config.scale.invalid` or, if unspecified, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero).\n\n- `\"break-paths-show-path-domains\"` (default) — This is equivalent to `\"break-paths-show-domains\"` for path-based marks (line/area/trail) and `\"filter\"` for non-path marks.\n\n__Note__: If any channel's scale has an output for invalid values defined in `config.scale.invalid`, all values for the scales will be considered \"valid\" since they can produce a reasonable output for the scales. Thus, fields for such channels will not be filtered and will not cause path breaks." }, "limit": { "anyOf": [ @@ -16214,15 +16214,15 @@ ] }, "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null + "anyOf": [ + { + "$ref": "#/definitions/MarkInvalidDataMode" + }, + { + "type": "null" + } ], - "type": [ - "string", - "null" - ] + "description": "Invalid data mode, which defines how the marks and corresponding scales should represent invalid values (`null` and `NaN` in continuous scales *without* defined output for invalid values).\n\n- `\"filter\"` — *Exclude* all invalid values from the visualization's *marks* and *scales*. For path marks (for line, area, trail), this option will create paths that connect valid points, as if the data rows with invalid values do not exist.\n\n- `\"break-paths-filter-domains\"` — Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `\"filter\"`. All *scale* domains will *exclude* these filtered data points.\n\n- `\"break-paths-show-domains\"` — Break paths (for line, area, trail) at invalid values. Hide invalid values for non-path marks. All *scale* domains will *include* these filtered data points (for both path and non-path marks).\n\n- `\"show\"` or `null` — Show all data points in the marks and scale domains. Each scale will use the output for invalid values defined in `config.scale.invalid` or, if unspecified, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero).\n\n- `\"break-paths-show-path-domains\"` (default) — This is equivalent to `\"break-paths-show-domains\"` for path-based marks (line/area/trail) and `\"filter\"` for non-path marks.\n\n__Note__: If any channel's scale has an output for invalid values defined in `config.scale.invalid`, all values for the scales will be considered \"valid\" since they can produce a reasonable output for the scales. Thus, fields for such channels will not be filtered and will not cause path breaks." }, "limit": { "anyOf": [ @@ -17058,15 +17058,15 @@ ] }, "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null + "anyOf": [ + { + "$ref": "#/definitions/MarkInvalidDataMode" + }, + { + "type": "null" + } ], - "type": [ - "string", - "null" - ] + "description": "Invalid data mode, which defines how the marks and corresponding scales should represent invalid values (`null` and `NaN` in continuous scales *without* defined output for invalid values).\n\n- `\"filter\"` — *Exclude* all invalid values from the visualization's *marks* and *scales*. For path marks (for line, area, trail), this option will create paths that connect valid points, as if the data rows with invalid values do not exist.\n\n- `\"break-paths-filter-domains\"` — Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `\"filter\"`. All *scale* domains will *exclude* these filtered data points.\n\n- `\"break-paths-show-domains\"` — Break paths (for line, area, trail) at invalid values. Hide invalid values for non-path marks. All *scale* domains will *include* these filtered data points (for both path and non-path marks).\n\n- `\"show\"` or `null` — Show all data points in the marks and scale domains. Each scale will use the output for invalid values defined in `config.scale.invalid` or, if unspecified, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero).\n\n- `\"break-paths-show-path-domains\"` (default) — This is equivalent to `\"break-paths-show-domains\"` for path-based marks (line/area/trail) and `\"filter\"` for non-path marks.\n\n__Note__: If any channel's scale has an output for invalid values defined in `config.scale.invalid`, all values for the scales will be considered \"valid\" since they can produce a reasonable output for the scales. Thus, fields for such channels will not be filtered and will not cause path breaks." }, "limit": { "anyOf": [ @@ -17640,6 +17640,16 @@ ], "type": "object" }, + "MarkInvalidDataMode": { + "enum": [ + "filter", + "break-paths-filter-domains", + "break-paths-show-domains", + "break-paths-show-path-domains", + "show" + ], + "type": "string" + }, "MarkPropDef<(Gradient|string|null)>": { "anyOf": [ { @@ -18596,15 +18606,15 @@ ] }, "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null + "anyOf": [ + { + "$ref": "#/definitions/MarkInvalidDataMode" + }, + { + "type": "null" + } ], - "type": [ - "string", - "null" - ] + "description": "Invalid data mode, which defines how the marks and corresponding scales should represent invalid values (`null` and `NaN` in continuous scales *without* defined output for invalid values).\n\n- `\"filter\"` — *Exclude* all invalid values from the visualization's *marks* and *scales*. For path marks (for line, area, trail), this option will create paths that connect valid points, as if the data rows with invalid values do not exist.\n\n- `\"break-paths-filter-domains\"` — Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `\"filter\"`. All *scale* domains will *exclude* these filtered data points.\n\n- `\"break-paths-show-domains\"` — Break paths (for line, area, trail) at invalid values. Hide invalid values for non-path marks. All *scale* domains will *include* these filtered data points (for both path and non-path marks).\n\n- `\"show\"` or `null` — Show all data points in the marks and scale domains. Each scale will use the output for invalid values defined in `config.scale.invalid` or, if unspecified, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero).\n\n- `\"break-paths-show-path-domains\"` (default) — This is equivalent to `\"break-paths-show-domains\"` for path-based marks (line/area/trail) and `\"filter\"` for non-path marks.\n\n__Note__: If any channel's scale has an output for invalid values defined in `config.scale.invalid`, all values for the scales will be considered \"valid\" since they can produce a reasonable output for the scales. Thus, fields for such channels will not be filtered and will not cause path breaks." }, "limit": { "anyOf": [ @@ -20892,15 +20902,15 @@ ] }, "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null + "anyOf": [ + { + "$ref": "#/definitions/MarkInvalidDataMode" + }, + { + "type": "null" + } ], - "type": [ - "string", - "null" - ] + "description": "Invalid data mode, which defines how the marks and corresponding scales should represent invalid values (`null` and `NaN` in continuous scales *without* defined output for invalid values).\n\n- `\"filter\"` — *Exclude* all invalid values from the visualization's *marks* and *scales*. For path marks (for line, area, trail), this option will create paths that connect valid points, as if the data rows with invalid values do not exist.\n\n- `\"break-paths-filter-domains\"` — Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `\"filter\"`. All *scale* domains will *exclude* these filtered data points.\n\n- `\"break-paths-show-domains\"` — Break paths (for line, area, trail) at invalid values. Hide invalid values for non-path marks. All *scale* domains will *include* these filtered data points (for both path and non-path marks).\n\n- `\"show\"` or `null` — Show all data points in the marks and scale domains. Each scale will use the output for invalid values defined in `config.scale.invalid` or, if unspecified, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero).\n\n- `\"break-paths-show-path-domains\"` (default) — This is equivalent to `\"break-paths-show-domains\"` for path-based marks (line/area/trail) and `\"filter\"` for non-path marks.\n\n__Note__: If any channel's scale has an output for invalid values defined in `config.scale.invalid`, all values for the scales will be considered \"valid\" since they can produce a reasonable output for the scales. Thus, fields for such channels will not be filtered and will not cause path breaks." }, "limit": { "anyOf": [ @@ -22102,13 +22112,17 @@ "description": "Default padding for continuous x/y scales.\n\n__Default:__ The bar width for continuous x-scale of a vertical bar and continuous y-scale of a horizontal bar.; `0` otherwise.", "minimum": 0 }, + "invalid": { + "$ref": "#/definitions/ScaleInvalidDataConfig", + "description": "An object that defines scale outputs per channel for invalid values (nulls and NaNs on a continuous scale).\n- The keys in this object are the scale channels.\n- The values is either `\"zero-or-min\"` (use zero if the scale includes zero or min value otherwise) or a value definition `{value: ...}`.\n\n_Example:_ Setting this `config.scale.invalid` property to `{color: {value: '#aaa'}}` will make the visualization color all invalid values with '#aaa'.\n\nSee [https://vega.github.io/vega-lite/docs/invalid-data.html](Invalid Data Docs) for more details." + }, "maxBandSize": { "description": "The default max value for mapping quantitative fields to bar's size/bandSize.\n\nIf undefined (default), we will use the axis's size (width or height) - 1.", "minimum": 0, "type": "number" }, "maxFontSize": { - "description": "The default max value for mapping quantitative fields to text's size/fontSize.\n\n__Default value:__ `40`", + "description": "The default max value for mapping quantitative fields to text's size/fontSize scale.\n\n__Default value:__ `40`", "minimum": 0, "type": "number" }, @@ -22134,7 +22148,7 @@ "type": "number" }, "minFontSize": { - "description": "The default min value for mapping quantitative fields to tick's size/fontSize scale.\n\n__Default value:__ `8`", + "description": "The default min value for mapping quantitative fields to text's size/fontSize scale.\n\n__Default value:__ `8`", "minimum": 0, "type": "number" }, @@ -22411,6 +22425,486 @@ ], "type": "object" }, + "ScaleInvalidDataConfig": { + "additionalProperties": false, + "properties": { + "angle": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"angle\">" + }, + "color": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"color\">" + }, + "fill": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"fill\">" + }, + "fillOpacity": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"fillOpacity\">" + }, + "opacity": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"opacity\">" + }, + "radius": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"radius\">" + }, + "shape": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"shape\">" + }, + "size": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"size\">" + }, + "stroke": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"stroke\">" + }, + "strokeDash": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"strokeDash\">" + }, + "strokeOpacity": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"strokeOpacity\">" + }, + "strokeWidth": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"strokeWidth\">" + }, + "theta": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"theta\">" + }, + "x": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"x\">" + }, + "xOffset": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"xOffset\">" + }, + "y": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"y\">" + }, + "yOffset": { + "$ref": "#/definitions/ScaleInvalidDataShowAs<\"yOffset\">" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAs<\"angle\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"angle\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"color\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"color\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"fill\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"fill\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"fillOpacity\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"fillOpacity\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"opacity\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"opacity\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"radius\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"radius\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"shape\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"shape\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"size\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"size\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"stroke\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"stroke\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"strokeDash\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"strokeDash\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"strokeOpacity\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"strokeOpacity\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"strokeWidth\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"strokeWidth\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"theta\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"theta\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"x\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"x\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"xOffset\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"xOffset\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"y\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"y\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAs<\"yOffset\">": { + "anyOf": [ + { + "$ref": "#/definitions/ScaleInvalidDataShowAsValue<\"yOffset\">" + }, + { + "const": "zero-or-min", + "type": "string" + } + ] + }, + "ScaleInvalidDataShowAsValue<\"angle\">": { + "additionalProperties": false, + "properties": { + "value": { + "description": "The rotation angle of the text, in degrees.", + "maximum": 360, + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"color\">": { + "additionalProperties": false, + "properties": { + "value": { + "anyOf": [ + { + "$ref": "#/definitions/Color" + }, + { + "$ref": "#/definitions/Gradient" + } + ], + "description": "Default color.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__\n- This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n- The `fill` and `stroke` properties have higher precedence than `color` and will override `color`." + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"fill\">": { + "additionalProperties": false, + "properties": { + "value": { + "anyOf": [ + { + "$ref": "#/definitions/Color" + }, + { + "$ref": "#/definitions/Gradient" + }, + { + "type": "null" + } + ], + "description": "Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n\n__Default value:__ (None)" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"fillOpacity\">": { + "additionalProperties": false, + "properties": { + "value": { + "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`", + "maximum": 1, + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"opacity\">": { + "additionalProperties": false, + "properties": { + "value": { + "description": "The overall opacity (value between [0,1]).\n\n__Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.", + "maximum": 1, + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"radius\">": { + "additionalProperties": false, + "properties": { + "value": { + "description": "For arc mark, the primary (outer) radius in pixels.\n\nFor text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.\n\n__Default value:__ `min(plot_width, plot_height)/2`", + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"shape\">": { + "additionalProperties": false, + "properties": { + "value": { + "anyOf": [ + { + "$ref": "#/definitions/SymbolShape" + }, + { + "type": "string" + } + ], + "description": "Shape of the point marks. Supported values include:\n- plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n- the line symbol `\"stroke\"`\n- centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n- a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n\n__Default value:__ `\"circle\"`" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"size\">": { + "additionalProperties": false, + "properties": { + "value": { + "description": "Default size for marks.\n- For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n- For `bar`, this represents the band size of the bar, in pixels.\n- For `text`, this represents the font size, in pixels.\n\n__Default value:__\n- `30` for point, circle, square marks; width/height's `step`\n- `2` for bar marks with discrete dimensions;\n- `5` for bar marks with continuous dimensions;\n- `11` for text marks.", + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"stroke\">": { + "additionalProperties": false, + "properties": { + "value": { + "anyOf": [ + { + "$ref": "#/definitions/Color" + }, + { + "$ref": "#/definitions/Gradient" + }, + { + "type": "null" + } + ], + "description": "Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n\n__Default value:__ (None)" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"strokeDash\">": { + "additionalProperties": false, + "properties": { + "value": { + "description": "An array of alternating stroke, space lengths for creating dashed or dotted lines.", + "items": { + "type": "number" + }, + "type": "array" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"strokeOpacity\">": { + "additionalProperties": false, + "properties": { + "value": { + "description": "The stroke opacity (value between [0,1]).\n\n__Default value:__ `1`", + "maximum": 1, + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"strokeWidth\">": { + "additionalProperties": false, + "properties": { + "value": { + "description": "The stroke width, in pixels.", + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"theta\">": { + "additionalProperties": false, + "properties": { + "value": { + "description": "- For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n\n- For text marks, polar coordinate angle in radians.", + "maximum": 360, + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"x\">": { + "additionalProperties": false, + "properties": { + "value": { + "anyOf": [ + { + "type": "number" + }, + { + "const": "width", + "type": "string" + } + ], + "description": "X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n\nThe `value` of this channel can be a number or a string `\"width\"` for the width of the plot." + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"xOffset\">": { + "additionalProperties": false, + "properties": { + "value": { + "description": "Offset for x-position.", + "type": "number" + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"y\">": { + "additionalProperties": false, + "properties": { + "value": { + "anyOf": [ + { + "type": "number" + }, + { + "const": "height", + "type": "string" + } + ], + "description": "Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n\nThe `value` of this channel can be a number or a string `\"height\"` for the height of the plot." + } + }, + "type": "object" + }, + "ScaleInvalidDataShowAsValue<\"yOffset\">": { + "additionalProperties": false, + "properties": { + "value": { + "description": "Offset for y-position.", + "type": "number" + } + }, + "type": "object" + }, "ScaleResolveMap": { "additionalProperties": false, "properties": { @@ -28111,15 +28605,15 @@ ] }, "invalid": { - "description": "Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n- If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n- If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.", - "enum": [ - "filter", - null + "anyOf": [ + { + "$ref": "#/definitions/MarkInvalidDataMode" + }, + { + "type": "null" + } ], - "type": [ - "string", - "null" - ] + "description": "Invalid data mode, which defines how the marks and corresponding scales should represent invalid values (`null` and `NaN` in continuous scales *without* defined output for invalid values).\n\n- `\"filter\"` — *Exclude* all invalid values from the visualization's *marks* and *scales*. For path marks (for line, area, trail), this option will create paths that connect valid points, as if the data rows with invalid values do not exist.\n\n- `\"break-paths-filter-domains\"` — Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `\"filter\"`. All *scale* domains will *exclude* these filtered data points.\n\n- `\"break-paths-show-domains\"` — Break paths (for line, area, trail) at invalid values. Hide invalid values for non-path marks. All *scale* domains will *include* these filtered data points (for both path and non-path marks).\n\n- `\"show\"` or `null` — Show all data points in the marks and scale domains. Each scale will use the output for invalid values defined in `config.scale.invalid` or, if unspecified, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero).\n\n- `\"break-paths-show-path-domains\"` (default) — This is equivalent to `\"break-paths-show-domains\"` for path-based marks (line/area/trail) and `\"filter\"` for non-path marks.\n\n__Note__: If any channel's scale has an output for invalid values defined in `config.scale.invalid`, all values for the scales will be considered \"valid\" since they can produce a reasonable output for the scales. Thus, fields for such channels will not be filtered and will not cause path breaks." }, "limit": { "anyOf": [ diff --git a/examples/compiled/area_invalid_null.vg.json b/examples/compiled/area_invalid_null.vg.json index d57ccf4e83..bf8eeebdbb 100644 --- a/examples/compiled/area_invalid_null.vg.json +++ b/examples/compiled/area_invalid_null.vg.json @@ -61,7 +61,7 @@ "x": [ { "test": "!isValid(datum[\"x\"]) || !isFinite(+datum[\"x\"])", - "value": 0 + "signal": "scale('x', inrange(0, domain('x')) ? 0 : domain('x')[0])" }, {"scale": "x", "field": "x"} ], diff --git a/examples/compiled/bar_distinct.vg.json b/examples/compiled/bar_distinct.vg.json index 17721c5355..2cb76e2371 100644 --- a/examples/compiled/bar_distinct.vg.json +++ b/examples/compiled/bar_distinct.vg.json @@ -16,10 +16,6 @@ "ops": ["distinct"], "fields": ["Name"], "as": ["distinct_Name"] - }, - { - "type": "filter", - "expr": "isValid(datum[\"distinct_Name\"]) && isFinite(+datum[\"distinct_Name\"])" } ] } diff --git a/examples/compiled/bar_grouped_repeated.vg.json b/examples/compiled/bar_grouped_repeated.vg.json index 8174ba5b62..eda23bb99d 100644 --- a/examples/compiled/bar_grouped_repeated.vg.json +++ b/examples/compiled/bar_grouped_repeated.vg.json @@ -52,7 +52,8 @@ "y": [ { "test": "!isValid(datum[\"sum_Worldwide Gross\"]) || !isFinite(+datum[\"sum_Worldwide Gross\"])", - "field": {"group": "height"} + "scale": "y", + "value": 0 }, {"scale": "y", "field": "sum_Worldwide Gross"} ], @@ -81,7 +82,8 @@ "y": [ { "test": "!isValid(datum[\"sum_US Gross\"]) || !isFinite(+datum[\"sum_US Gross\"])", - "field": {"group": "height"} + "scale": "y", + "value": 0 }, {"scale": "y", "field": "sum_US Gross"} ], diff --git a/examples/compiled/bar_grouped_thin.vg.json b/examples/compiled/bar_grouped_thin.vg.json index 69c532b3bc..f8a193afd4 100644 --- a/examples/compiled/bar_grouped_thin.vg.json +++ b/examples/compiled/bar_grouped_thin.vg.json @@ -49,7 +49,8 @@ "y": [ { "test": "!isValid(datum[\"mean_Rotten Tomatoes Rating\"]) || !isFinite(+datum[\"mean_Rotten Tomatoes Rating\"])", - "field": {"group": "height"} + "scale": "y", + "value": 0 }, {"scale": "y", "field": "mean_Rotten Tomatoes Rating"} ], diff --git a/examples/compiled/bar_grouped_thin_minBandSize.vg.json b/examples/compiled/bar_grouped_thin_minBandSize.vg.json index ce94c87630..0a23466f8e 100644 --- a/examples/compiled/bar_grouped_thin_minBandSize.vg.json +++ b/examples/compiled/bar_grouped_thin_minBandSize.vg.json @@ -49,7 +49,8 @@ "y": [ { "test": "!isValid(datum[\"mean_Rotten Tomatoes Rating\"]) || !isFinite(+datum[\"mean_Rotten Tomatoes Rating\"])", - "field": {"group": "height"} + "scale": "y", + "value": 0 }, {"scale": "y", "field": "mean_Rotten Tomatoes Rating"} ], diff --git a/examples/compiled/bar_invalid_color_show.png b/examples/compiled/bar_invalid_color_show.png new file mode 100644 index 0000000000..15a45c2080 Binary files /dev/null and b/examples/compiled/bar_invalid_color_show.png differ diff --git a/examples/compiled/bar_invalid_color_show.svg b/examples/compiled/bar_invalid_color_show.svg new file mode 100644 index 0000000000..7034b097ee --- /dev/null +++ b/examples/compiled/bar_invalid_color_show.svg @@ -0,0 +1 @@ +1.01.52.02.53.0a020406080100b1.01.21.41.61.82.0c \ No newline at end of file diff --git a/examples/compiled/bar_invalid_color_show.vg.json b/examples/compiled/bar_invalid_color_show.vg.json new file mode 100644 index 0000000000..84ea16785d --- /dev/null +++ b/examples/compiled/bar_invalid_color_show.vg.json @@ -0,0 +1,159 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "width": 200, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + } + ], + "marks": [ + { + "name": "marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('color', inrange(0, domain('color')) ? 0 : domain('color')[0])" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "xc": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('x', inrange(0, domain('x')) ? 0 : domain('x')[0])" + }, + {"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 + }, + { + "name": "color", + "type": "linear", + "domain": {"data": "data_0", "field": "c"}, + "range": "ramp", + "interpolate": "hcl", + "zero": false + } + ], + "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": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(width/40)"}, + "zindex": 0 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ], + "legends": [ + { + "fill": "color", + "gradientLength": {"signal": "clamp(height, 64, 200)"}, + "title": "c" + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/bar_invalid_color_show_override.png b/examples/compiled/bar_invalid_color_show_override.png new file mode 100644 index 0000000000..a73e2f118e Binary files /dev/null and b/examples/compiled/bar_invalid_color_show_override.png differ diff --git a/examples/compiled/bar_invalid_color_show_override.svg b/examples/compiled/bar_invalid_color_show_override.svg new file mode 100644 index 0000000000..862b351951 --- /dev/null +++ b/examples/compiled/bar_invalid_color_show_override.svg @@ -0,0 +1 @@ +1.01.52.02.53.0a020406080100b1.01.21.41.61.82.0c \ No newline at end of file diff --git a/examples/compiled/bar_invalid_color_show_override.vg.json b/examples/compiled/bar_invalid_color_show_override.vg.json new file mode 100644 index 0000000000..adb1c1fdd2 --- /dev/null +++ b/examples/compiled/bar_invalid_color_show_override.vg.json @@ -0,0 +1,159 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "width": 200, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + } + ], + "marks": [ + { + "name": "marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": "red" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "xc": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('x', inrange(0, domain('x')) ? 0 : domain('x')[0])" + }, + {"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 + }, + { + "name": "color", + "type": "linear", + "domain": {"data": "data_0", "field": "c"}, + "range": "ramp", + "interpolate": "hcl", + "zero": false + } + ], + "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": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(width/40)"}, + "zindex": 0 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ], + "legends": [ + { + "fill": "color", + "gradientLength": {"signal": "clamp(height, 64, 200)"}, + "title": "c" + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/layer_null_data.png b/examples/compiled/layer_null_data.png new file mode 100644 index 0000000000..9d63aa7d93 Binary files /dev/null and b/examples/compiled/layer_null_data.png differ diff --git a/examples/compiled/layer_null_data.svg b/examples/compiled/layer_null_data.svg new file mode 100644 index 0000000000..7d12cb7653 --- /dev/null +++ b/examples/compiled/layer_null_data.svg @@ -0,0 +1 @@ +01 Jan02 Jan03 Jan04 Jan05 Jan06 Jan07 Jan08 Jana (year-month-date)01020304050b \ No newline at end of file diff --git a/examples/compiled/layer_null_data.vg.json b/examples/compiled/layer_null_data.vg.json new file mode 100644 index 0000000000..ba3703026a --- /dev/null +++ b/examples/compiled/layer_null_data.vg.json @@ -0,0 +1,201 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "background": "white", + "padding": 5, + "width": 300, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "values": [ + {"a": "Jan 1, 2000", "b": 28}, + {"a": "Jan 2, 2000", "b": 55}, + {"a": "Jan 3, 2000", "b": null}, + {"a": "Jan 4, 2000", "b": 55}, + {"a": "Jan 5, 2000", "b": 43}, + {"a": "Jan 6, 2000", "b": null}, + {"a": "Jan 7, 2000", "b": 55}, + {"a": "Jan 8, 2000", "b": 43} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + {"type": "formula", "expr": "toDate(datum[\"a\"])", "as": "a"} + ] + }, + { + "name": "data_1", + "source": "data_0", + "transform": [ + { + "field": "a", + "type": "timeunit", + "units": ["year", "month", "date"], + "as": ["yearmonthdate_a", "yearmonthdate_a_end"] + } + ] + }, + { + "name": "data_2", + "source": "data_0", + "transform": [ + {"type": "filter", "expr": "datum.b === null"}, + { + "field": "a", + "type": "timeunit", + "units": ["year", "month", "date"], + "as": ["yearmonthdate_a", "yearmonthdate_a_end"] + }, + { + "type": "formula", + "expr": "0.5 * timeOffset('date', datum['yearmonthdate_a'], -1) + 0.5 * datum['yearmonthdate_a']", + "as": "yearmonthdate_a_offsetted_rect_start" + }, + { + "type": "formula", + "expr": "0.5 * datum['yearmonthdate_a'] + 0.5 * datum['yearmonthdate_a_end']", + "as": "yearmonthdate_a_offsetted_rect_end" + }, + { + "type": "filter", + "expr": "(isDate(datum[\"yearmonthdate_a\"]) || (isValid(datum[\"yearmonthdate_a\"]) && isFinite(+datum[\"yearmonthdate_a\"])))" + } + ] + } + ], + "marks": [ + { + "name": "layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": {"data": "data_1"}, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "description": { + "signal": "\"a (year-month-date): \" + (timeFormat(datum[\"yearmonthdate_a\"], '%d %b')) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "x", "field": "yearmonthdate_a"}, + "y": {"scale": "y", "field": "b"}, + "defined": { + "signal": "isValid(datum[\"yearmonthdate_a\"]) && isFinite(+datum[\"yearmonthdate_a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + }, + { + "name": "layer_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "opacity": {"value": 0.2}, + "fill": {"value": "red"}, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a (year-month-date): \" + (timeFormat(datum[\"yearmonthdate_a\"], timeUnitSpecifier([\"year\",\"month\",\"date\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})))" + }, + "x2": { + "scale": "x", + "field": "yearmonthdate_a_offsetted_rect_start", + "offset": { + "signal": "0.5 + (abs(scale(\"x\", datum[\"yearmonthdate_a_end\"]) - scale(\"x\", datum[\"yearmonthdate_a\"])) < 0.25 ? -0.5 * (0.25 - (abs(scale(\"x\", datum[\"yearmonthdate_a_end\"]) - scale(\"x\", datum[\"yearmonthdate_a\"])))) : 0.5)" + } + }, + "x": { + "scale": "x", + "field": "yearmonthdate_a_offsetted_rect_end", + "offset": { + "signal": "0.5 + (abs(scale(\"x\", datum[\"yearmonthdate_a_end\"]) - scale(\"x\", datum[\"yearmonthdate_a\"])) < 0.25 ? 0.5 * (0.25 - (abs(scale(\"x\", datum[\"yearmonthdate_a_end\"]) - scale(\"x\", datum[\"yearmonthdate_a\"])))) : -0.5)" + } + }, + "y": {"value": 0}, + "y2": {"field": {"group": "height"}} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "time", + "domain": { + "fields": [ + {"data": "data_1", "field": "yearmonthdate_a"}, + {"data": "data_2", "field": "yearmonthdate_a_offsetted_rect_start"}, + {"data": "data_2", "field": "yearmonthdate_a_offsetted_rect_end"} + ] + }, + "range": [0, {"signal": "width"}] + }, + { + "name": "y", + "type": "linear", + "domain": {"data": "data_1", "field": "b"}, + "range": [{"signal": "height"}, 0], + "nice": true, + "zero": true + } + ], + "axes": [ + { + "scale": "x", + "orient": "bottom", + "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, + "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 (year-month-date)", + "format": "%d %b", + "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 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ] +} diff --git a/examples/compiled/line_invalid_null.vg.json b/examples/compiled/line_invalid_null.vg.json index a989f1dce8..2f728a52c4 100644 --- a/examples/compiled/line_invalid_null.vg.json +++ b/examples/compiled/line_invalid_null.vg.json @@ -44,14 +44,15 @@ "x": [ { "test": "!isValid(datum[\"x\"]) || !isFinite(+datum[\"x\"])", - "value": 0 + "signal": "scale('x', inrange(0, domain('x')) ? 0 : domain('x')[0])" }, {"scale": "x", "field": "x"} ], "y": [ { "test": "!isValid(datum[\"y\"]) || !isFinite(+datum[\"y\"])", - "field": {"group": "height"} + "scale": "y", + "value": 0 }, {"scale": "y", "field": "y"} ] diff --git a/examples/compiled/line_quarter_legend.vg.json b/examples/compiled/line_quarter_legend.vg.json index ef38f0be97..32a109b83f 100644 --- a/examples/compiled/line_quarter_legend.vg.json +++ b/examples/compiled/line_quarter_legend.vg.json @@ -67,7 +67,7 @@ "x": {"scale": "x", "field": "year_date"}, "y": {"scale": "y", "field": "mean_price"}, "defined": { - "signal": "isValid(datum[\"year_date\"]) && isFinite(+datum[\"year_date\"]) && isValid(datum[\"mean_price\"]) && isFinite(+datum[\"mean_price\"])" + "signal": "isValid(datum[\"year_date\"]) && isFinite(+datum[\"year_date\"]) && isValid(datum[\"mean_price\"]) && isFinite(+datum[\"mean_price\"]) && isValid(datum[\"quarter_date\"]) && isFinite(+datum[\"quarter_date\"])" } } } diff --git a/examples/compiled/point_invalid_color.vg.json b/examples/compiled/point_invalid_color.vg.json index 70020d6db6..5c03dd5ff7 100644 --- a/examples/compiled/point_invalid_color.vg.json +++ b/examples/compiled/point_invalid_color.vg.json @@ -32,6 +32,7 @@ "x": [ { "test": "!isValid(datum[\"IMDB Rating\"]) || !isFinite(+datum[\"IMDB Rating\"])", + "scale": "x", "value": 0 }, {"scale": "x", "field": "IMDB Rating"} @@ -39,7 +40,8 @@ "y": [ { "test": "!isValid(datum[\"Rotten Tomatoes Rating\"]) || !isFinite(+datum[\"Rotten Tomatoes Rating\"])", - "field": {"group": "height"} + "scale": "y", + "value": 0 }, {"scale": "y", "field": "Rotten Tomatoes Rating"} ] diff --git a/examples/compiled/point_invalid_size_show.png b/examples/compiled/point_invalid_size_show.png new file mode 100644 index 0000000000..a399a9650d Binary files /dev/null and b/examples/compiled/point_invalid_size_show.png differ diff --git a/examples/compiled/point_invalid_size_show.svg b/examples/compiled/point_invalid_size_show.svg new file mode 100644 index 0000000000..2ae4ee19d6 --- /dev/null +++ b/examples/compiled/point_invalid_size_show.svg @@ -0,0 +1 @@ +0123a02040bQuantitative X0.00.51.01.52.0c \ No newline at end of file diff --git a/examples/compiled/point_invalid_size_show.vg.json b/examples/compiled/point_invalid_size_show.vg.json new file mode 100644 index 0000000000..7453159e6f --- /dev/null +++ b/examples/compiled/point_invalid_size_show.vg.json @@ -0,0 +1,172 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "height": 100, + "data": [ + { + "name": "source_0", + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + } + ], + "signals": [{"name": "childWidth", "value": 100}], + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Quantitative X", "frame": "group"}, + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "height"} + } + }, + "marks": [ + { + "name": "concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "scale": "concat_0_x", + "value": 0 + }, + {"scale": "concat_0_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_0_y", + "value": 0 + }, + {"scale": "concat_0_y", "field": "b"} + ], + "size": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "scale": "size", + "value": 0 + }, + {"scale": "size", "field": "c"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_y", + "orient": "left", + "gridScale": "concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(height/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ] + } + ], + "scales": [ + { + "name": "size", + "type": "linear", + "domain": {"data": "source_0", "field": "c"}, + "range": [4, 361], + "zero": true + }, + { + "name": "concat_0_x", + "type": "linear", + "domain": {"data": "source_0", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_y", + "type": "linear", + "domain": {"data": "source_0", "field": "b"}, + "range": [{"signal": "height"}, 0], + "nice": true, + "zero": true + } + ], + "legends": [ + { + "size": "size", + "symbolType": "circle", + "title": "c", + "encode": { + "symbols": { + "update": { + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "opacity": {"value": 0.7} + } + } + } + } + ] +} diff --git a/examples/compiled/stacked_area_binned.vg.json b/examples/compiled/stacked_area_binned.vg.json index bccef5148e..039489e9b3 100644 --- a/examples/compiled/stacked_area_binned.vg.json +++ b/examples/compiled/stacked_area_binned.vg.json @@ -97,7 +97,7 @@ "y": {"scale": "y", "field": "__count_end"}, "y2": {"scale": "y", "field": "__count_start"}, "defined": { - "signal": "isValid(datum[\"bin_maxbins_10_IMDB Rating_mid\"]) && isFinite(+datum[\"bin_maxbins_10_IMDB Rating_mid\"]) && isValid(datum[\"__count\"]) && isFinite(+datum[\"__count\"])" + "signal": "isValid(datum[\"bin_maxbins_10_IMDB Rating_mid\"]) && isFinite(+datum[\"bin_maxbins_10_IMDB Rating_mid\"])" } } } diff --git a/examples/compiled/test_invalid_break_paths_filter_domains.png b/examples/compiled/test_invalid_break_paths_filter_domains.png new file mode 100644 index 0000000000..cc6e8e6051 Binary files /dev/null and b/examples/compiled/test_invalid_break_paths_filter_domains.png differ diff --git a/examples/compiled/test_invalid_break_paths_filter_domains.svg b/examples/compiled/test_invalid_break_paths_filter_domains.svg new file mode 100644 index 0000000000..c91dd809d5 --- /dev/null +++ b/examples/compiled/test_invalid_break_paths_filter_domains.svg @@ -0,0 +1 @@ +−505a−2002040b−505a−2002040b−505a−2002040b−505a−2002040bQuantitative Xnull-5-115a050100bnull-5-115a050100bnull-5-115a050100bnull-5-115a050100bOrdinal X \ No newline at end of file diff --git a/examples/compiled/test_invalid_break_paths_filter_domains.vg.json b/examples/compiled/test_invalid_break_paths_filter_domains.vg.json new file mode 100644 index 0000000000..bef469315b --- /dev/null +++ b/examples/compiled/test_invalid_break_paths_filter_domains.vg.json @@ -0,0 +1,969 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "data": [ + { + "name": "source_0", + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + {"type": "formula", "expr": "toNumber(datum[\"a\"])", "as": "a"} + ] + }, + { + "name": "data_2", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_3", + "source": "data_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\"])" + } + ] + }, + { + "name": "data_4", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": [], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_5", + "source": "data_4", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_6", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_7", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_8", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": [], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_9", + "source": "data_8", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + } + ], + "signals": [ + {"name": "childHeight", "value": 100}, + {"name": "concat_0_childWidth", "value": 100}, + {"name": "concat_1_childWidth", "value": 100} + ], + "layout": {"padding": 20, "columns": 1, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Quantitative X", "anchor": "start"}, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_0_x", "field": "a"}, + "y": {"scale": "concat_0_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "gridScale": "concat_0_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_3"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "xc": {"scale": "concat_0_concat_1_x", "field": "a"}, + "width": {"value": 5}, + "y": {"scale": "concat_0_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "gridScale": "concat_0_concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "gridScale": "concat_0_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": {"data": "data_0"}, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"}, + "defined": { + "signal": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "gridScale": "concat_0_concat_2_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "gridScale": "concat_0_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "data_4"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_3_x", "field": "a"}, + "y": {"scale": "concat_0_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_3_y", "field": "b_start"}, + "defined": { + "signal": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "gridScale": "concat_0_concat_3_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "gridScale": "concat_0_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Ordinal X", "anchor": "start"}, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_1_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_6"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_0_x", "field": "a"}, + "y": {"scale": "concat_1_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "gridScale": "concat_1_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_7"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_1_x", "field": "a"}, + "width": { + "signal": "max(0.25, bandwidth('concat_1_concat_1_x'))" + }, + "y": {"scale": "concat_1_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "gridScale": "concat_1_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": {"data": "data_0"}, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"}, + "defined": { + "signal": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_6"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "gridScale": "concat_1_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "data_8"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_3_x", "field": "a"}, + "y": {"scale": "concat_1_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_3_y", "field": "b_start"}, + "defined": { + "signal": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "gridScale": "concat_1_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + } + ], + "scales": [ + { + "name": "concat_0_concat_0_x", + "type": "linear", + "domain": {"data": "data_2", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_0_y", + "type": "linear", + "domain": {"data": "data_2", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_1_x", + "type": "linear", + "domain": {"data": "data_3", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": false, + "padding": 5 + }, + { + "name": "concat_0_concat_1_y", + "type": "linear", + "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_2_x", + "type": "linear", + "domain": {"data": "data_2", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_2_y", + "type": "linear", + "domain": {"data": "data_2", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_3_x", + "type": "linear", + "domain": {"data": "data_5", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_3_y", + "type": "linear", + "domain": {"data": "data_5", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_0_x", + "type": "point", + "domain": {"data": "data_6", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_0_y", + "type": "linear", + "domain": {"data": "data_6", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_1_x", + "type": "band", + "domain": {"data": "data_7", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "concat_1_concat_1_y", + "type": "linear", + "domain": {"data": "data_7", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_2_x", + "type": "point", + "domain": {"data": "data_6", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_2_y", + "type": "linear", + "domain": {"data": "data_6", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_3_x", + "type": "point", + "domain": {"data": "data_9", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_3_y", + "type": "linear", + "domain": {"data": "data_9", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/test_invalid_break_paths_show_domains.png b/examples/compiled/test_invalid_break_paths_show_domains.png new file mode 100644 index 0000000000..a8d0e6bd55 Binary files /dev/null and b/examples/compiled/test_invalid_break_paths_show_domains.png differ diff --git a/examples/compiled/test_invalid_break_paths_show_domains.svg b/examples/compiled/test_invalid_break_paths_show_domains.svg new file mode 100644 index 0000000000..8bd25d26d9 --- /dev/null +++ b/examples/compiled/test_invalid_break_paths_show_domains.svg @@ -0,0 +1 @@ +−10−50510a050100b−10010a050100b−10−50510a050100b−10−50510a050100bQuantitative Xnull-10-5-101510a050100bnull-10-5-101510a050100bnull-10-5-101510a050100bnull-10-5-101510a050100bOrdinal X \ No newline at end of file diff --git a/examples/compiled/test_invalid_break_paths_show_domains.vg.json b/examples/compiled/test_invalid_break_paths_show_domains.vg.json new file mode 100644 index 0000000000..4fa60a64a7 --- /dev/null +++ b/examples/compiled/test_invalid_break_paths_show_domains.vg.json @@ -0,0 +1,961 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "data": [ + { + "name": "source_0", + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + {"type": "formula", "expr": "toNumber(datum[\"a\"])", "as": "a"} + ] + }, + { + "name": "data_2", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_3", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_4", + "source": "data_3", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_5", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": [], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_6", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_7", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_8", + "source": "data_7", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_9", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": [], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + } + ], + "signals": [ + {"name": "childHeight", "value": 100}, + {"name": "concat_0_childWidth", "value": 100}, + {"name": "concat_1_childWidth", "value": 100} + ], + "layout": {"padding": 20, "columns": 1, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Quantitative X", "anchor": "start"}, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_0_x", "field": "a"}, + "y": {"scale": "concat_0_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "gridScale": "concat_0_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "xc": {"scale": "concat_0_concat_1_x", "field": "a"}, + "width": {"value": 5}, + "y": {"scale": "concat_0_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "gridScale": "concat_0_concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "gridScale": "concat_0_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": {"data": "data_0"}, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"}, + "defined": { + "signal": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "gridScale": "concat_0_concat_2_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "gridScale": "concat_0_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "data_5"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_3_x", "field": "a"}, + "y": {"scale": "concat_0_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_3_y", "field": "b_start"}, + "defined": { + "signal": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "gridScale": "concat_0_concat_3_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "gridScale": "concat_0_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Ordinal X", "anchor": "start"}, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_1_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_6"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_0_x", "field": "a"}, + "y": {"scale": "concat_1_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "gridScale": "concat_1_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_8"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_1_x", "field": "a"}, + "width": { + "signal": "max(0.25, bandwidth('concat_1_concat_1_x'))" + }, + "y": {"scale": "concat_1_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "gridScale": "concat_1_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": {"data": "data_0"}, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"}, + "defined": { + "signal": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_6"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "gridScale": "concat_1_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "data_9"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_3_x", "field": "a"}, + "y": {"scale": "concat_1_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_3_y", "field": "b_start"}, + "defined": { + "signal": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "gridScale": "concat_1_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + } + ], + "scales": [ + { + "name": "concat_0_concat_0_x", + "type": "linear", + "domain": {"data": "data_0", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_0_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_1_x", + "type": "linear", + "domain": {"data": "data_3", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": false, + "padding": 5 + }, + { + "name": "concat_0_concat_1_y", + "type": "linear", + "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_2_x", + "type": "linear", + "domain": {"data": "data_0", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_2_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_3_x", + "type": "linear", + "domain": {"data": "data_5", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_3_y", + "type": "linear", + "domain": {"data": "data_5", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_0_x", + "type": "point", + "domain": {"data": "data_0", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_0_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_1_x", + "type": "band", + "domain": {"data": "data_7", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "concat_1_concat_1_y", + "type": "linear", + "domain": {"data": "data_7", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_2_x", + "type": "point", + "domain": {"data": "data_0", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_2_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_3_x", + "type": "point", + "domain": {"data": "data_9", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_3_y", + "type": "linear", + "domain": {"data": "data_9", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/test_invalid_break_paths_show_path_domains.png b/examples/compiled/test_invalid_break_paths_show_path_domains.png new file mode 100644 index 0000000000..41eb254fc8 Binary files /dev/null and b/examples/compiled/test_invalid_break_paths_show_path_domains.png differ diff --git a/examples/compiled/test_invalid_break_paths_show_path_domains.svg b/examples/compiled/test_invalid_break_paths_show_path_domains.svg new file mode 100644 index 0000000000..fd3f096e5f --- /dev/null +++ b/examples/compiled/test_invalid_break_paths_show_path_domains.svg @@ -0,0 +1 @@ +−505a−2002040b−505a−2002040b−10−50510a050100b−10−50510a050100bQuantitative Xnull-5-115a050100bnull-5-115a050100bnull-10-5-101510a050100bnull-10-5-101510a050100bOrdinal X \ No newline at end of file diff --git a/examples/compiled/test_invalid_break_paths_show_path_domains.vg.json b/examples/compiled/test_invalid_break_paths_show_path_domains.vg.json new file mode 100644 index 0000000000..8920562bae --- /dev/null +++ b/examples/compiled/test_invalid_break_paths_show_path_domains.vg.json @@ -0,0 +1,970 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "data": [ + { + "name": "source_0", + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + {"type": "formula", "expr": "toNumber(datum[\"a\"])", "as": "a"} + ] + }, + { + "name": "data_2", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_3", + "source": "data_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\"])" + } + ] + }, + { + "name": "data_4", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": [], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_5", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_6", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_7", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": [], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + } + ], + "signals": [ + {"name": "childHeight", "value": 100}, + {"name": "concat_0_childWidth", "value": 100}, + {"name": "concat_1_childWidth", "value": 100} + ], + "layout": {"padding": 20, "columns": 1, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Quantitative X", "anchor": "start"}, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_0_x", "field": "a"}, + "y": {"scale": "concat_0_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "gridScale": "concat_0_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_3"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "xc": {"scale": "concat_0_concat_1_x", "field": "a"}, + "width": {"value": 5}, + "y": {"scale": "concat_0_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "gridScale": "concat_0_concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "gridScale": "concat_0_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": {"data": "data_0"}, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"}, + "defined": { + "signal": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "gridScale": "concat_0_concat_2_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "gridScale": "concat_0_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "data_4"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_3_x", "field": "a"}, + "y": {"scale": "concat_0_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_3_y", "field": "b_start"}, + "defined": { + "signal": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "gridScale": "concat_0_concat_3_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "gridScale": "concat_0_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Ordinal X", "anchor": "start"}, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_1_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_5"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_0_x", "field": "a"}, + "y": {"scale": "concat_1_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "gridScale": "concat_1_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_6"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_1_x", "field": "a"}, + "width": { + "signal": "max(0.25, bandwidth('concat_1_concat_1_x'))" + }, + "y": {"scale": "concat_1_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "gridScale": "concat_1_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": {"data": "data_0"}, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"}, + "defined": { + "signal": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_5"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "gridScale": "concat_1_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "data_7"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_3_x", "field": "a"}, + "y": {"scale": "concat_1_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_3_y", "field": "b_start"}, + "defined": { + "signal": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "gridScale": "concat_1_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + } + ], + "scales": [ + { + "name": "concat_0_concat_0_x", + "type": "linear", + "domain": {"data": "data_2", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_0_y", + "type": "linear", + "domain": {"data": "data_2", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_1_x", + "type": "linear", + "domain": {"data": "data_3", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": false, + "padding": 5 + }, + { + "name": "concat_0_concat_1_y", + "type": "linear", + "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_2_x", + "type": "linear", + "domain": { + "fields": [ + {"data": "data_0", "field": "a"}, + {"data": "data_2", "field": "a"} + ] + }, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_2_y", + "type": "linear", + "domain": { + "fields": [ + {"data": "data_0", "field": "b"}, + {"data": "data_2", "field": "b"} + ] + }, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_3_x", + "type": "linear", + "domain": {"data": "data_4", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_3_y", + "type": "linear", + "domain": {"data": "data_4", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_0_x", + "type": "point", + "domain": {"data": "data_5", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_0_y", + "type": "linear", + "domain": {"data": "data_5", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_1_x", + "type": "band", + "domain": {"data": "data_6", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "concat_1_concat_1_y", + "type": "linear", + "domain": {"data": "data_6", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_2_x", + "type": "point", + "domain": { + "fields": [ + {"data": "data_0", "field": "a"}, + {"data": "data_5", "field": "a"} + ], + "sort": true + }, + "range": [0, {"signal": "concat_1_childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_2_y", + "type": "linear", + "domain": { + "fields": [ + {"data": "data_0", "field": "b"}, + {"data": "data_5", "field": "b"} + ] + }, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_3_x", + "type": "point", + "domain": {"data": "data_7", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_3_y", + "type": "linear", + "domain": {"data": "data_7", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/test_invalid_color_filter.png b/examples/compiled/test_invalid_color_filter.png new file mode 100644 index 0000000000..4843d35a5f Binary files /dev/null and b/examples/compiled/test_invalid_color_filter.png differ diff --git a/examples/compiled/test_invalid_color_filter.svg b/examples/compiled/test_invalid_color_filter.svg new file mode 100644 index 0000000000..75f6dbe4d0 --- /dev/null +++ b/examples/compiled/test_invalid_color_filter.svg @@ -0,0 +1 @@ +0123a0102030b123a02040b1.01.52.02.53.0a0102030b1.01.52.02.53.0a02040bQuantitative X123a0102030b123a02040b123a0102030b123a02040bOrdinal X1.01.21.41.61.82.0c \ No newline at end of file diff --git a/examples/compiled/test_invalid_color_filter.vg.json b/examples/compiled/test_invalid_color_filter.vg.json new file mode 100644 index 0000000000..22fbdcb340 --- /dev/null +++ b/examples/compiled/test_invalid_color_filter.vg.json @@ -0,0 +1,1062 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "data": [ + { + "name": "source_0", + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + {"type": "formula", "expr": "toNumber(datum[\"a\"])", "as": "a"} + ] + }, + { + "name": "data_1", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + }, + { + "name": "data_2", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + }, + { + "name": "data_3", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": ["c"], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + }, + { + "name": "data_4", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + }, + { + "name": "data_5", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + }, + { + "name": "data_6", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": ["c"], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + } + ], + "signals": [ + {"name": "childWidth", "value": 100}, + {"name": "concat_0_childHeight", "value": 100}, + {"name": "concat_1_childHeight", "value": 100} + ], + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Quantitative X", "anchor": "start"}, + "layout": { + "padding": 20, + "columns": 1, + "bounds": "full", + "align": "each" + }, + "marks": [ + { + "type": "group", + "name": "concat_0_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_1"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"scale": "color", "field": "c"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_0_x", "field": "a"}, + "y": {"scale": "concat_0_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "gridScale": "concat_0_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "fill": {"scale": "color", "field": "c"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "xc": {"scale": "concat_0_concat_1_x", "field": "a"}, + "width": {"value": 5}, + "y": {"scale": "concat_0_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "gridScale": "concat_0_concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "gridScale": "concat_0_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_0_concat_2_layer_0_main", + "data": "data_1", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": { + "data": "faceted_path_concat_0_concat_2_layer_0_main" + }, + "encode": { + "update": { + "stroke": {"scale": "color", "field": "c"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } + } + ] + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_1"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"scale": "color", "field": "c"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "gridScale": "concat_0_concat_2_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "gridScale": "concat_0_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_0_concat_3_main", + "data": "data_3", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "faceted_path_concat_0_concat_3_main"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"scale": "color", "field": "c"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_3_x", "field": "a"}, + "y": {"scale": "concat_0_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_3_y", "field": "b_start"} + } + } + } + ] + } + ], + "axes": [ + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "gridScale": "concat_0_concat_3_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "gridScale": "concat_0_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Ordinal X", "anchor": "start"}, + "layout": { + "padding": 20, + "columns": 1, + "bounds": "full", + "align": "each" + }, + "marks": [ + { + "type": "group", + "name": "concat_1_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"scale": "color", "field": "c"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_0_x", "field": "a"}, + "y": {"scale": "concat_1_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "gridScale": "concat_1_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_5"}, + "encode": { + "update": { + "fill": {"scale": "color", "field": "c"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_1_x", "field": "a"}, + "width": { + "signal": "max(0.25, bandwidth('concat_1_concat_1_x'))" + }, + "y": {"scale": "concat_1_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "gridScale": "concat_1_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_1_concat_2_layer_0_main", + "data": "data_4", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": { + "data": "faceted_path_concat_1_concat_2_layer_0_main" + }, + "encode": { + "update": { + "stroke": {"scale": "color", "field": "c"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } + } + ] + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"scale": "color", "field": "c"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "gridScale": "concat_1_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_1_concat_3_main", + "data": "data_6", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "faceted_path_concat_1_concat_3_main"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"scale": "color", "field": "c"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_3_x", "field": "a"}, + "y": {"scale": "concat_1_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_3_y", "field": "b_start"} + } + } + } + ] + } + ], + "axes": [ + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "gridScale": "concat_1_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + } + ], + "scales": [ + { + "name": "color", + "type": "linear", + "domain": { + "fields": [ + {"data": "data_1", "field": "c"}, + {"data": "data_2", "field": "c"}, + {"data": "data_3", "field": "c"}, + {"data": "data_4", "field": "c"}, + {"data": "data_5", "field": "c"}, + {"data": "data_6", "field": "c"} + ] + }, + "range": "ramp", + "interpolate": "hcl", + "zero": false + }, + { + "name": "concat_0_concat_0_x", + "type": "linear", + "domain": {"data": "data_1", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_0_y", + "type": "linear", + "domain": {"data": "data_1", "field": "b"}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_1_x", + "type": "linear", + "domain": {"data": "data_2", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false, + "padding": 5 + }, + { + "name": "concat_0_concat_1_y", + "type": "linear", + "domain": {"data": "data_2", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_2_x", + "type": "linear", + "domain": {"data": "data_1", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_2_y", + "type": "linear", + "domain": {"data": "data_1", "field": "b"}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_3_x", + "type": "linear", + "domain": {"data": "data_3", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_3_y", + "type": "linear", + "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_0_x", + "type": "point", + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_0_y", + "type": "linear", + "domain": {"data": "data_4", "field": "b"}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_1_x", + "type": "band", + "domain": {"data": "data_5", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "concat_1_concat_1_y", + "type": "linear", + "domain": {"data": "data_5", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_2_x", + "type": "point", + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_2_y", + "type": "linear", + "domain": {"data": "data_4", "field": "b"}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_3_x", + "type": "point", + "domain": {"data": "data_6", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_3_y", + "type": "linear", + "domain": {"data": "data_6", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + } + ], + "legends": [ + { + "stroke": "color", + "gradientLength": {"signal": "clamp(concat_0_childHeight, 64, 200)"}, + "title": "c", + "encode": {"gradient": {"update": {"opacity": {"value": 0.7}}}}, + "fill": "color" + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/test_invalid_color_filter_but_include_in_scale_invalid.png b/examples/compiled/test_invalid_color_filter_but_include_in_scale_invalid.png new file mode 100644 index 0000000000..44e481ce63 Binary files /dev/null and b/examples/compiled/test_invalid_color_filter_but_include_in_scale_invalid.png differ diff --git a/examples/compiled/test_invalid_color_filter_but_include_in_scale_invalid.svg b/examples/compiled/test_invalid_color_filter_but_include_in_scale_invalid.svg new file mode 100644 index 0000000000..bb48b40d80 --- /dev/null +++ b/examples/compiled/test_invalid_color_filter_but_include_in_scale_invalid.svg @@ -0,0 +1 @@ +0123a02040b123a050100b1.01.52.02.53.0a02040b1.01.52.02.53.0a050100bQuantitative X123a02040b123a050100b123a02040b123a050100bOrdinal X1.01.21.41.61.82.0c \ No newline at end of file diff --git a/examples/compiled/test_invalid_color_filter_but_include_in_scale_invalid.vg.json b/examples/compiled/test_invalid_color_filter_but_include_in_scale_invalid.vg.json new file mode 100644 index 0000000000..9947ced8b4 --- /dev/null +++ b/examples/compiled/test_invalid_color_filter_but_include_in_scale_invalid.vg.json @@ -0,0 +1,1122 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "data": [ + { + "name": "source_0", + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + {"type": "formula", "expr": "toNumber(datum[\"a\"])", "as": "a"} + ] + }, + { + "name": "data_1", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_2", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_3", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": ["c"], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_4", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_5", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_6", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": ["c"], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + } + ], + "signals": [ + {"name": "childWidth", "value": 100}, + {"name": "concat_0_childHeight", "value": 100}, + {"name": "concat_1_childHeight", "value": 100} + ], + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Quantitative X", "anchor": "start"}, + "layout": { + "padding": 20, + "columns": 1, + "bounds": "full", + "align": "each" + }, + "marks": [ + { + "type": "group", + "name": "concat_0_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_1"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": "red" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_0_x", "field": "a"}, + "y": {"scale": "concat_0_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "gridScale": "concat_0_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": "red" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "xc": {"scale": "concat_0_concat_1_x", "field": "a"}, + "width": {"value": 5}, + "y": {"scale": "concat_0_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "gridScale": "concat_0_concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "gridScale": "concat_0_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_0_concat_2_layer_0_main", + "data": "data_1", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": { + "data": "faceted_path_concat_0_concat_2_layer_0_main" + }, + "encode": { + "update": { + "stroke": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": "red" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } + } + ] + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_1"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": "red" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "gridScale": "concat_0_concat_2_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "gridScale": "concat_0_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_0_concat_3_main", + "data": "data_3", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "faceted_path_concat_0_concat_3_main"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": "red" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_3_x", "field": "a"}, + "y": {"scale": "concat_0_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_3_y", "field": "b_start"} + } + } + } + ] + } + ], + "axes": [ + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "gridScale": "concat_0_concat_3_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "gridScale": "concat_0_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Ordinal X", "anchor": "start"}, + "layout": { + "padding": 20, + "columns": 1, + "bounds": "full", + "align": "each" + }, + "marks": [ + { + "type": "group", + "name": "concat_1_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": "red" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_0_x", "field": "a"}, + "y": {"scale": "concat_1_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "gridScale": "concat_1_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_5"}, + "encode": { + "update": { + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": "red" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_1_x", "field": "a"}, + "width": { + "signal": "max(0.25, bandwidth('concat_1_concat_1_x'))" + }, + "y": {"scale": "concat_1_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "gridScale": "concat_1_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_1_concat_2_layer_0_main", + "data": "data_4", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": { + "data": "faceted_path_concat_1_concat_2_layer_0_main" + }, + "encode": { + "update": { + "stroke": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": "red" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } + } + ] + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": "red" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "gridScale": "concat_1_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_1_concat_3_main", + "data": "data_6", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "faceted_path_concat_1_concat_3_main"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": "red" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_3_x", "field": "a"}, + "y": {"scale": "concat_1_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_3_y", "field": "b_start"} + } + } + } + ] + } + ], + "axes": [ + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "gridScale": "concat_1_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + } + ], + "scales": [ + { + "name": "color", + "type": "linear", + "domain": { + "fields": [ + {"data": "data_1", "field": "c"}, + {"data": "data_2", "field": "c"}, + {"data": "data_3", "field": "c"}, + {"data": "data_4", "field": "c"}, + {"data": "data_5", "field": "c"}, + {"data": "data_6", "field": "c"} + ] + }, + "range": "ramp", + "interpolate": "hcl", + "zero": false + }, + { + "name": "concat_0_concat_0_x", + "type": "linear", + "domain": {"data": "data_1", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_0_y", + "type": "linear", + "domain": {"data": "data_1", "field": "b"}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_1_x", + "type": "linear", + "domain": {"data": "data_2", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false, + "padding": 5 + }, + { + "name": "concat_0_concat_1_y", + "type": "linear", + "domain": {"data": "data_2", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_2_x", + "type": "linear", + "domain": {"data": "data_1", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_2_y", + "type": "linear", + "domain": {"data": "data_1", "field": "b"}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_3_x", + "type": "linear", + "domain": {"data": "data_3", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_3_y", + "type": "linear", + "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_0_x", + "type": "point", + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_0_y", + "type": "linear", + "domain": {"data": "data_4", "field": "b"}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_1_x", + "type": "band", + "domain": {"data": "data_5", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "concat_1_concat_1_y", + "type": "linear", + "domain": {"data": "data_5", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_2_x", + "type": "point", + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_2_y", + "type": "linear", + "domain": {"data": "data_4", "field": "b"}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_3_x", + "type": "point", + "domain": {"data": "data_6", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_3_y", + "type": "linear", + "domain": {"data": "data_6", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + } + ], + "legends": [ + { + "stroke": "color", + "gradientLength": {"signal": "clamp(concat_0_childHeight, 64, 200)"}, + "title": "c", + "encode": {"gradient": {"update": {"opacity": {"value": 0.7}}}}, + "fill": "color" + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/test_invalid_color_show.png b/examples/compiled/test_invalid_color_show.png new file mode 100644 index 0000000000..ccd0363a01 Binary files /dev/null and b/examples/compiled/test_invalid_color_show.png differ diff --git a/examples/compiled/test_invalid_color_show.svg b/examples/compiled/test_invalid_color_show.svg new file mode 100644 index 0000000000..0da6eb7437 --- /dev/null +++ b/examples/compiled/test_invalid_color_show.svg @@ -0,0 +1 @@ +0123a02040b123a050100b1.01.52.02.53.0a02040b1.01.52.02.53.0a050100bQuantitative X123a02040b123a050100b123a02040b123a050100bOrdinal X1.01.21.41.61.82.0c \ No newline at end of file diff --git a/examples/compiled/test_invalid_color_show.vg.json b/examples/compiled/test_invalid_color_show.vg.json new file mode 100644 index 0000000000..0c326eb84a --- /dev/null +++ b/examples/compiled/test_invalid_color_show.vg.json @@ -0,0 +1,1158 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "data": [ + { + "name": "source_0", + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + {"type": "formula", "expr": "toNumber(datum[\"a\"])", "as": "a"} + ] + }, + { + "name": "data_2", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_3", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": ["c"], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_4", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_5", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": ["c"], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + } + ], + "signals": [ + {"name": "childWidth", "value": 100}, + {"name": "concat_0_childHeight", "value": 100}, + {"name": "concat_1_childHeight", "value": 100} + ], + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Quantitative X", "anchor": "start"}, + "layout": { + "padding": 20, + "columns": 1, + "bounds": "full", + "align": "each" + }, + "marks": [ + { + "type": "group", + "name": "concat_0_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('color', inrange(0, domain('color')) ? 0 : domain('color')[0])" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "scale": "concat_0_concat_0_x", + "value": 0 + }, + {"scale": "concat_0_concat_0_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_0_concat_0_y", + "value": 0 + }, + {"scale": "concat_0_concat_0_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "gridScale": "concat_0_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('color', inrange(0, domain('color')) ? 0 : domain('color')[0])" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "xc": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_1_x', inrange(0, domain('concat_0_concat_1_x')) ? 0 : domain('concat_0_concat_1_x')[0])" + }, + {"scale": "concat_0_concat_1_x", "field": "a"} + ], + "width": {"value": 5}, + "y": {"scale": "concat_0_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "gridScale": "concat_0_concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "gridScale": "concat_0_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_0_concat_2_layer_0_main", + "data": "data_0", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": { + "data": "faceted_path_concat_0_concat_2_layer_0_main" + }, + "encode": { + "update": { + "stroke": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('color', inrange(0, domain('color')) ? 0 : domain('color')[0])" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_2_x', inrange(0, domain('concat_0_concat_2_x')) ? 0 : domain('concat_0_concat_2_x')[0])" + }, + {"scale": "concat_0_concat_2_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_0_concat_2_y", + "value": 0 + }, + {"scale": "concat_0_concat_2_y", "field": "b"} + ] + } + } + } + ] + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('color', inrange(0, domain('color')) ? 0 : domain('color')[0])" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_2_x', inrange(0, domain('concat_0_concat_2_x')) ? 0 : domain('concat_0_concat_2_x')[0])" + }, + {"scale": "concat_0_concat_2_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_0_concat_2_y", + "value": 0 + }, + {"scale": "concat_0_concat_2_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "gridScale": "concat_0_concat_2_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "gridScale": "concat_0_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_0_concat_3_main", + "data": "data_3", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "faceted_path_concat_0_concat_3_main"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('color', inrange(0, domain('color')) ? 0 : domain('color')[0])" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_3_x', inrange(0, domain('concat_0_concat_3_x')) ? 0 : domain('concat_0_concat_3_x')[0])" + }, + {"scale": "concat_0_concat_3_x", "field": "a"} + ], + "y": {"scale": "concat_0_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_3_y", "field": "b_start"} + } + } + } + ] + } + ], + "axes": [ + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "gridScale": "concat_0_concat_3_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "gridScale": "concat_0_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Ordinal X", "anchor": "start"}, + "layout": { + "padding": 20, + "columns": 1, + "bounds": "full", + "align": "each" + }, + "marks": [ + { + "type": "group", + "name": "concat_1_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('color', inrange(0, domain('color')) ? 0 : domain('color')[0])" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_0_x", "field": "a"}, + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_1_concat_0_y", + "value": 0 + }, + {"scale": "concat_1_concat_0_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "gridScale": "concat_1_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('color', inrange(0, domain('color')) ? 0 : domain('color')[0])" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_1_x", "field": "a"}, + "width": { + "signal": "max(0.25, bandwidth('concat_1_concat_1_x'))" + }, + "y": {"scale": "concat_1_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "gridScale": "concat_1_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_1_concat_2_layer_0_main", + "data": "data_0", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": { + "data": "faceted_path_concat_1_concat_2_layer_0_main" + }, + "encode": { + "update": { + "stroke": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('color', inrange(0, domain('color')) ? 0 : domain('color')[0])" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_1_concat_2_y", + "value": 0 + }, + {"scale": "concat_1_concat_2_y", "field": "b"} + ] + } + } + } + ] + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('color', inrange(0, domain('color')) ? 0 : domain('color')[0])" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_1_concat_2_y", + "value": 0 + }, + {"scale": "concat_1_concat_2_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "gridScale": "concat_1_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_1_concat_3_main", + "data": "data_5", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "faceted_path_concat_1_concat_3_main"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('color', inrange(0, domain('color')) ? 0 : domain('color')[0])" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_3_x", "field": "a"}, + "y": {"scale": "concat_1_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_3_y", "field": "b_start"} + } + } + } + ] + } + ], + "axes": [ + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "gridScale": "concat_1_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + } + ], + "scales": [ + { + "name": "color", + "type": "linear", + "domain": { + "fields": [ + {"data": "data_0", "field": "c"}, + {"data": "data_2", "field": "c"}, + {"data": "data_3", "field": "c"}, + {"data": "data_4", "field": "c"}, + {"data": "data_5", "field": "c"} + ] + }, + "range": "ramp", + "interpolate": "hcl", + "zero": false + }, + { + "name": "concat_0_concat_0_x", + "type": "linear", + "domain": {"data": "data_0", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_0_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_1_x", + "type": "linear", + "domain": {"data": "data_2", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false, + "padding": 5 + }, + { + "name": "concat_0_concat_1_y", + "type": "linear", + "domain": {"data": "data_2", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_2_x", + "type": "linear", + "domain": {"data": "data_0", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_2_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_3_x", + "type": "linear", + "domain": {"data": "data_3", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_3_y", + "type": "linear", + "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_0_x", + "type": "point", + "domain": {"data": "data_0", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_0_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_1_x", + "type": "band", + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "concat_1_concat_1_y", + "type": "linear", + "domain": {"data": "data_4", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_2_x", + "type": "point", + "domain": {"data": "data_0", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_2_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_3_x", + "type": "point", + "domain": {"data": "data_5", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_3_y", + "type": "linear", + "domain": {"data": "data_5", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + } + ], + "legends": [ + { + "stroke": "color", + "gradientLength": {"signal": "clamp(concat_0_childHeight, 64, 200)"}, + "title": "c", + "encode": {"gradient": {"update": {"opacity": {"value": 0.7}}}}, + "fill": "color" + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/test_invalid_color_size_config_scale.png b/examples/compiled/test_invalid_color_size_config_scale.png new file mode 100644 index 0000000000..1208bdd247 Binary files /dev/null and b/examples/compiled/test_invalid_color_size_config_scale.png differ diff --git a/examples/compiled/test_invalid_color_size_config_scale.svg b/examples/compiled/test_invalid_color_size_config_scale.svg new file mode 100644 index 0000000000..641c8d1c4d --- /dev/null +++ b/examples/compiled/test_invalid_color_size_config_scale.svg @@ -0,0 +1 @@ +0123a02040bColor0123a02040bSize0.00.51.01.52.0c \ No newline at end of file diff --git a/examples/compiled/test_invalid_color_size_config_scale.vg.json b/examples/compiled/test_invalid_color_size_config_scale.vg.json new file mode 100644 index 0000000000..66bc925dcd --- /dev/null +++ b/examples/compiled/test_invalid_color_size_config_scale.vg.json @@ -0,0 +1,280 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "height": 100, + "data": [ + { + "name": "source_0", + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + } + ], + "signals": [{"name": "childWidth", "value": 100}], + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Color", "frame": "group"}, + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "height"} + } + }, + "marks": [ + { + "name": "concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": "#aaa" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_x", "field": "a"}, + "y": {"scale": "concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_y", + "orient": "left", + "gridScale": "concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(height/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Size", "frame": "group"}, + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "height"} + } + }, + "marks": [ + { + "name": "concat_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_x", "field": "a"}, + "y": {"scale": "concat_1_y", "field": "b"}, + "size": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": 4 + }, + {"scale": "size", "field": "c"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_1_x", + "orient": "bottom", + "gridScale": "concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_y", + "orient": "left", + "gridScale": "concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(height/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ] + } + ], + "scales": [ + { + "name": "color", + "type": "linear", + "domain": {"data": "data_0", "field": "c"}, + "range": "ramp", + "interpolate": "hcl", + "zero": false + }, + { + "name": "size", + "type": "linear", + "domain": {"data": "data_0", "field": "c"}, + "range": [4, 361], + "zero": true + }, + { + "name": "concat_0_x", + "type": "linear", + "domain": {"data": "data_0", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "height"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_x", + "type": "linear", + "domain": {"data": "data_0", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_1_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "height"}, 0], + "nice": true, + "zero": true + } + ], + "legends": [ + { + "stroke": "color", + "gradientLength": {"signal": "clamp(height, 64, 200)"}, + "title": "c", + "encode": {"gradient": {"update": {"opacity": {"value": 0.7}}}}, + "symbolType": "circle", + "size": "size" + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/test_invalid_color_size_mark_filter_only.png b/examples/compiled/test_invalid_color_size_mark_filter_only.png new file mode 100644 index 0000000000..a85c93a053 Binary files /dev/null and b/examples/compiled/test_invalid_color_size_mark_filter_only.png differ diff --git a/examples/compiled/test_invalid_color_size_mark_filter_only.svg b/examples/compiled/test_invalid_color_size_mark_filter_only.svg new file mode 100644 index 0000000000..47e5a6ce4e --- /dev/null +++ b/examples/compiled/test_invalid_color_size_mark_filter_only.svg @@ -0,0 +1 @@ +0123a0102030bColor0123a0102030bSize0.00.51.01.52.0c \ No newline at end of file diff --git a/examples/compiled/test_invalid_color_size_mark_filter_only.vg.json b/examples/compiled/test_invalid_color_size_mark_filter_only.vg.json new file mode 100644 index 0000000000..01d38a2c2c --- /dev/null +++ b/examples/compiled/test_invalid_color_size_mark_filter_only.vg.json @@ -0,0 +1,268 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "height": 100, + "data": [ + { + "name": "source_0", + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + } + ], + "signals": [{"name": "childWidth", "value": 100}], + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Color", "frame": "group"}, + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "height"} + } + }, + "marks": [ + { + "name": "concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"scale": "color", "field": "c"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_x", "field": "a"}, + "y": {"scale": "concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_y", + "orient": "left", + "gridScale": "concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(height/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Size", "frame": "group"}, + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "height"} + } + }, + "marks": [ + { + "name": "concat_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_x", "field": "a"}, + "y": {"scale": "concat_1_y", "field": "b"}, + "size": {"scale": "size", "field": "c"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_x", + "orient": "bottom", + "gridScale": "concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_y", + "orient": "left", + "gridScale": "concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(height/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ] + } + ], + "scales": [ + { + "name": "color", + "type": "linear", + "domain": {"data": "data_0", "field": "c"}, + "range": "ramp", + "interpolate": "hcl", + "zero": false + }, + { + "name": "size", + "type": "linear", + "domain": {"data": "data_0", "field": "c"}, + "range": [4, 361], + "zero": true + }, + { + "name": "concat_0_x", + "type": "linear", + "domain": {"data": "data_0", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "height"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_x", + "type": "linear", + "domain": {"data": "data_0", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_1_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "height"}, 0], + "nice": true, + "zero": true + } + ], + "legends": [ + { + "stroke": "color", + "gradientLength": {"signal": "clamp(height, 64, 200)"}, + "title": "c", + "encode": {"gradient": {"update": {"opacity": {"value": 0.7}}}}, + "symbolType": "circle", + "size": "size" + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/test_invalid_color_size_mark_show_only.png b/examples/compiled/test_invalid_color_size_mark_show_only.png new file mode 100644 index 0000000000..26589d8c9f Binary files /dev/null and b/examples/compiled/test_invalid_color_size_mark_show_only.png differ diff --git a/examples/compiled/test_invalid_color_size_mark_show_only.svg b/examples/compiled/test_invalid_color_size_mark_show_only.svg new file mode 100644 index 0000000000..fbe2695055 --- /dev/null +++ b/examples/compiled/test_invalid_color_size_mark_show_only.svg @@ -0,0 +1 @@ +0123a02040bColor0123a02040bSize0.00.51.01.52.0c \ No newline at end of file diff --git a/examples/compiled/test_invalid_color_size_mark_show_only.vg.json b/examples/compiled/test_invalid_color_size_mark_show_only.vg.json new file mode 100644 index 0000000000..6c756d6227 --- /dev/null +++ b/examples/compiled/test_invalid_color_size_mark_show_only.vg.json @@ -0,0 +1,299 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "height": 100, + "data": [ + { + "name": "source_0", + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + } + ], + "signals": [{"name": "childWidth", "value": 100}], + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Color", "frame": "group"}, + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "height"} + } + }, + "marks": [ + { + "name": "concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('color', inrange(0, domain('color')) ? 0 : domain('color')[0])" + }, + {"scale": "color", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "scale": "concat_0_x", + "value": 0 + }, + {"scale": "concat_0_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_0_y", + "value": 0 + }, + {"scale": "concat_0_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_y", + "orient": "left", + "gridScale": "concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(height/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Size", "frame": "group"}, + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "height"} + } + }, + "marks": [ + { + "name": "concat_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "source_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "scale": "concat_1_x", + "value": 0 + }, + {"scale": "concat_1_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_1_y", + "value": 0 + }, + {"scale": "concat_1_y", "field": "b"} + ], + "size": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "scale": "size", + "value": 0 + }, + {"scale": "size", "field": "c"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_1_x", + "orient": "bottom", + "gridScale": "concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_y", + "orient": "left", + "gridScale": "concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(height/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ] + } + ], + "scales": [ + { + "name": "color", + "type": "linear", + "domain": {"data": "source_0", "field": "c"}, + "range": "ramp", + "interpolate": "hcl", + "zero": false + }, + { + "name": "size", + "type": "linear", + "domain": {"data": "source_0", "field": "c"}, + "range": [4, 361], + "zero": true + }, + { + "name": "concat_0_x", + "type": "linear", + "domain": {"data": "source_0", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_y", + "type": "linear", + "domain": {"data": "source_0", "field": "b"}, + "range": [{"signal": "height"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_x", + "type": "linear", + "domain": {"data": "source_0", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_1_y", + "type": "linear", + "domain": {"data": "source_0", "field": "b"}, + "range": [{"signal": "height"}, 0], + "nice": true, + "zero": true + } + ], + "legends": [ + { + "stroke": "color", + "gradientLength": {"signal": "clamp(height, 64, 200)"}, + "title": "c", + "encode": {"gradient": {"update": {"opacity": {"value": 0.7}}}}, + "symbolType": "circle", + "size": "size" + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/test_invalid_default.png b/examples/compiled/test_invalid_default.png index 0dbec24637..41eb254fc8 100644 Binary files a/examples/compiled/test_invalid_default.png and b/examples/compiled/test_invalid_default.png differ diff --git a/examples/compiled/test_invalid_default.svg b/examples/compiled/test_invalid_default.svg index 63d8efdae2..fd3f096e5f 100644 --- a/examples/compiled/test_invalid_default.svg +++ b/examples/compiled/test_invalid_default.svg @@ -1 +1 @@ -−505a010203040b−505a010203040b−10−50510a05001,000b−10−50510a05001,000bQuantitative Xnull-5-115a05001,000bnull-5-115a05001,000bnull-10-5-101510a05001,000bnull-10-5-101510a05001,000bOrdinal X \ No newline at end of file +−505a−2002040b−505a−2002040b−10−50510a050100b−10−50510a050100bQuantitative Xnull-5-115a050100bnull-5-115a050100bnull-10-5-101510a050100bnull-10-5-101510a050100bOrdinal X \ No newline at end of file diff --git a/examples/compiled/test_invalid_default.vg.json b/examples/compiled/test_invalid_default.vg.json index b19317c8a7..8920562bae 100644 --- a/examples/compiled/test_invalid_default.vg.json +++ b/examples/compiled/test_invalid_default.vg.json @@ -7,10 +7,10 @@ { "name": "source_0", "values": [ - {"a": null, "b": 1000}, + {"a": null, "b": 100}, {"a": -10, "b": null}, - {"a": -5, "b": 25}, - {"a": -1, "b": 20}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, {"a": 0, "b": null}, {"a": 1, "b": 30}, {"a": 5, "b": 40}, @@ -126,22 +126,17 @@ } ], "signals": [ - {"name": "childWidth", "value": 100}, - {"name": "concat_0_childHeight", "value": 100}, - {"name": "concat_1_childHeight", "value": 100} + {"name": "childHeight", "value": 100}, + {"name": "concat_0_childWidth", "value": 100}, + {"name": "concat_1_childWidth", "value": 100} ], - "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "layout": {"padding": 20, "columns": 1, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", "name": "concat_0_group", "title": {"text": "Quantitative X", "anchor": "start"}, - "layout": { - "padding": 20, - "columns": 1, - "bounds": "full", - "align": "each" - }, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", @@ -149,8 +144,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_0_childHeight"} + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -164,6 +159,9 @@ "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" @@ -180,7 +178,7 @@ "orient": "bottom", "gridScale": "concat_0_concat_0_y", "grid": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "domain": false, "labels": false, "aria": false, @@ -194,7 +192,7 @@ "orient": "left", "gridScale": "concat_0_concat_0_x", "grid": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -210,7 +208,7 @@ "title": "a", "labelFlush": true, "labelOverlap": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "zindex": 0 }, { @@ -219,7 +217,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -230,8 +228,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_0_childHeight"} + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -243,6 +241,9 @@ "encode": { "update": { "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" @@ -261,7 +262,7 @@ "orient": "bottom", "gridScale": "concat_0_concat_1_y", "grid": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "domain": false, "labels": false, "aria": false, @@ -275,7 +276,7 @@ "orient": "left", "gridScale": "concat_0_concat_1_x", "grid": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -291,7 +292,7 @@ "title": "a", "labelFlush": true, "labelOverlap": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "zindex": 0 }, { @@ -300,7 +301,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -311,13 +312,13 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_0_childHeight"} + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ { - "name": "concat_0_concat_2_marks", + "name": "concat_0_concat_2_layer_0_marks", "type": "line", "style": ["line"], "sort": {"field": "x"}, @@ -325,6 +326,9 @@ "encode": { "update": { "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, "description": { "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, @@ -335,6 +339,27 @@ } } } + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } } ], "axes": [ @@ -343,7 +368,7 @@ "orient": "bottom", "gridScale": "concat_0_concat_2_y", "grid": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "domain": false, "labels": false, "aria": false, @@ -357,7 +382,7 @@ "orient": "left", "gridScale": "concat_0_concat_2_x", "grid": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -373,7 +398,7 @@ "title": "a", "labelFlush": true, "labelOverlap": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "zindex": 0 }, { @@ -382,7 +407,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -393,8 +418,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_0_childHeight"} + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -408,6 +433,9 @@ "update": { "orient": {"value": "vertical"}, "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, "description": { "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, @@ -427,7 +455,7 @@ "orient": "bottom", "gridScale": "concat_0_concat_3_y", "grid": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "domain": false, "labels": false, "aria": false, @@ -441,7 +469,7 @@ "orient": "left", "gridScale": "concat_0_concat_3_x", "grid": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -457,7 +485,7 @@ "title": "a", "labelFlush": true, "labelOverlap": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "zindex": 0 }, { @@ -466,7 +494,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -477,12 +505,7 @@ "type": "group", "name": "concat_1_group", "title": {"text": "Ordinal X", "anchor": "start"}, - "layout": { - "padding": 20, - "columns": 1, - "bounds": "full", - "align": "each" - }, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", @@ -490,8 +513,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_1_childHeight"} + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -505,6 +528,9 @@ "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" @@ -521,7 +547,7 @@ "orient": "left", "gridScale": "concat_1_concat_0_x", "grid": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -546,7 +572,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -557,8 +583,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_1_childHeight"} + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -570,6 +596,9 @@ "encode": { "update": { "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" @@ -590,7 +619,7 @@ "orient": "left", "gridScale": "concat_1_concat_1_x", "grid": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -615,7 +644,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -626,13 +655,13 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_1_childHeight"} + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ { - "name": "concat_1_concat_2_marks", + "name": "concat_1_concat_2_layer_0_marks", "type": "line", "style": ["line"], "sort": {"field": "x"}, @@ -640,6 +669,9 @@ "encode": { "update": { "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, @@ -650,6 +682,27 @@ } } } + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_5"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } } ], "axes": [ @@ -658,7 +711,7 @@ "orient": "left", "gridScale": "concat_1_concat_2_x", "grid": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -683,7 +736,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -694,8 +747,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_1_childHeight"} + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -709,6 +762,9 @@ "update": { "orient": {"value": "vertical"}, "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, @@ -728,7 +784,7 @@ "orient": "left", "gridScale": "concat_1_concat_3_x", "grid": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -753,7 +809,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -766,7 +822,7 @@ "name": "concat_0_concat_0_x", "type": "linear", "domain": {"data": "data_2", "field": "a"}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_0_childWidth"}], "nice": true, "zero": true }, @@ -774,7 +830,7 @@ "name": "concat_0_concat_0_y", "type": "linear", "domain": {"data": "data_2", "field": "b"}, - "range": [{"signal": "concat_0_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, @@ -782,7 +838,7 @@ "name": "concat_0_concat_1_x", "type": "linear", "domain": {"data": "data_3", "field": "a"}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_0_childWidth"}], "nice": true, "zero": false, "padding": 5 @@ -791,23 +847,33 @@ "name": "concat_0_concat_1_y", "type": "linear", "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, - "range": [{"signal": "concat_0_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "concat_0_concat_2_x", "type": "linear", - "domain": {"data": "data_0", "field": "a"}, - "range": [0, {"signal": "childWidth"}], + "domain": { + "fields": [ + {"data": "data_0", "field": "a"}, + {"data": "data_2", "field": "a"} + ] + }, + "range": [0, {"signal": "concat_0_childWidth"}], "nice": true, "zero": false }, { "name": "concat_0_concat_2_y", "type": "linear", - "domain": {"data": "data_0", "field": "b"}, - "range": [{"signal": "concat_0_childHeight"}, 0], + "domain": { + "fields": [ + {"data": "data_0", "field": "b"}, + {"data": "data_2", "field": "b"} + ] + }, + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, @@ -815,7 +881,7 @@ "name": "concat_0_concat_3_x", "type": "linear", "domain": {"data": "data_4", "field": "a"}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_0_childWidth"}], "nice": true, "zero": false }, @@ -823,7 +889,7 @@ "name": "concat_0_concat_3_y", "type": "linear", "domain": {"data": "data_4", "fields": ["b_start", "b_end"]}, - "range": [{"signal": "concat_0_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, @@ -831,14 +897,14 @@ "name": "concat_1_concat_0_x", "type": "point", "domain": {"data": "data_5", "field": "a", "sort": true}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_1_childWidth"}], "padding": 0.5 }, { "name": "concat_1_concat_0_y", "type": "linear", "domain": {"data": "data_5", "field": "b"}, - "range": [{"signal": "concat_1_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, @@ -846,7 +912,7 @@ "name": "concat_1_concat_1_x", "type": "band", "domain": {"data": "data_6", "field": "a", "sort": true}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_1_childWidth"}], "paddingInner": 0.1, "paddingOuter": 0.05 }, @@ -854,22 +920,33 @@ "name": "concat_1_concat_1_y", "type": "linear", "domain": {"data": "data_6", "fields": ["b_start", "b_end"]}, - "range": [{"signal": "concat_1_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "concat_1_concat_2_x", "type": "point", - "domain": {"data": "data_0", "field": "a", "sort": true}, - "range": [0, {"signal": "childWidth"}], + "domain": { + "fields": [ + {"data": "data_0", "field": "a"}, + {"data": "data_5", "field": "a"} + ], + "sort": true + }, + "range": [0, {"signal": "concat_1_childWidth"}], "padding": 0.5 }, { "name": "concat_1_concat_2_y", "type": "linear", - "domain": {"data": "data_0", "field": "b"}, - "range": [{"signal": "concat_1_childHeight"}, 0], + "domain": { + "fields": [ + {"data": "data_0", "field": "b"}, + {"data": "data_5", "field": "b"} + ] + }, + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, @@ -877,16 +954,17 @@ "name": "concat_1_concat_3_x", "type": "point", "domain": {"data": "data_7", "field": "a", "sort": true}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_1_childWidth"}], "padding": 0.5 }, { "name": "concat_1_concat_3_y", "type": "linear", "domain": {"data": "data_7", "fields": ["b_start", "b_end"]}, - "range": [{"signal": "concat_1_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true } - ] + ], + "config": {"mark": {"tooltip": true}} } diff --git a/examples/compiled/test_invalid_filter.png b/examples/compiled/test_invalid_filter.png index 0dbec24637..492012eb23 100644 Binary files a/examples/compiled/test_invalid_filter.png and b/examples/compiled/test_invalid_filter.png differ diff --git a/examples/compiled/test_invalid_filter.svg b/examples/compiled/test_invalid_filter.svg index 63d8efdae2..92ac7c6825 100644 --- a/examples/compiled/test_invalid_filter.svg +++ b/examples/compiled/test_invalid_filter.svg @@ -1 +1 @@ -−505a010203040b−505a010203040b−10−50510a05001,000b−10−50510a05001,000bQuantitative Xnull-5-115a05001,000bnull-5-115a05001,000bnull-10-5-101510a05001,000bnull-10-5-101510a05001,000bOrdinal X \ No newline at end of file +−505a−2002040b−505a−2002040b−505a−2002040b−505a−2002040bQuantitative Xnull-5-115a050100bnull-5-115a050100bnull-5-115a050100bnull-5-115a050100bOrdinal X \ No newline at end of file diff --git a/examples/compiled/test_invalid_filter.vg.json b/examples/compiled/test_invalid_filter.vg.json index b19317c8a7..0b5c1a789e 100644 --- a/examples/compiled/test_invalid_filter.vg.json +++ b/examples/compiled/test_invalid_filter.vg.json @@ -7,10 +7,10 @@ { "name": "source_0", "values": [ - {"a": null, "b": 1000}, + {"a": null, "b": 100}, {"a": -10, "b": null}, - {"a": -5, "b": 25}, - {"a": -1, "b": 20}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, {"a": 0, "b": null}, {"a": 1, "b": 30}, {"a": 5, "b": 40}, @@ -25,7 +25,7 @@ ] }, { - "name": "data_2", + "name": "data_1", "source": "data_0", "transform": [ { @@ -35,7 +35,7 @@ ] }, { - "name": "data_3", + "name": "data_2", "source": "data_0", "transform": [ { @@ -53,7 +53,7 @@ ] }, { - "name": "data_4", + "name": "data_3", "source": "data_0", "transform": [ { @@ -71,11 +71,15 @@ "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\"])" } ] }, { - "name": "data_5", + "name": "data_4", "source": "data_0", "transform": [ { @@ -85,7 +89,7 @@ ] }, { - "name": "data_6", + "name": "data_5", "source": "data_0", "transform": [ { @@ -103,7 +107,7 @@ ] }, { - "name": "data_7", + "name": "data_6", "source": "data_0", "transform": [ { @@ -121,27 +125,26 @@ "sort": {"field": [], "order": []}, "as": ["b_start", "b_end"], "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" } ] } ], "signals": [ - {"name": "childWidth", "value": 100}, - {"name": "concat_0_childHeight", "value": 100}, - {"name": "concat_1_childHeight", "value": 100} + {"name": "childHeight", "value": 100}, + {"name": "concat_0_childWidth", "value": 100}, + {"name": "concat_1_childWidth", "value": 100} ], - "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "layout": {"padding": 20, "columns": 1, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", "name": "concat_0_group", "title": {"text": "Quantitative X", "anchor": "start"}, - "layout": { - "padding": 20, - "columns": 1, - "bounds": "full", - "align": "each" - }, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", @@ -149,8 +152,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_0_childHeight"} + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -158,12 +161,15 @@ "name": "concat_0_concat_0_marks", "type": "symbol", "style": ["point"], - "from": {"data": "data_2"}, + "from": {"data": "data_1"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" @@ -180,7 +186,7 @@ "orient": "bottom", "gridScale": "concat_0_concat_0_y", "grid": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "domain": false, "labels": false, "aria": false, @@ -194,7 +200,7 @@ "orient": "left", "gridScale": "concat_0_concat_0_x", "grid": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -210,7 +216,7 @@ "title": "a", "labelFlush": true, "labelOverlap": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "zindex": 0 }, { @@ -219,7 +225,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -230,8 +236,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_0_childHeight"} + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -239,10 +245,13 @@ "name": "concat_0_concat_1_marks", "type": "rect", "style": ["bar"], - "from": {"data": "data_3"}, + "from": {"data": "data_2"}, "encode": { "update": { "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" @@ -261,7 +270,7 @@ "orient": "bottom", "gridScale": "concat_0_concat_1_y", "grid": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "domain": false, "labels": false, "aria": false, @@ -275,7 +284,7 @@ "orient": "left", "gridScale": "concat_0_concat_1_x", "grid": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -291,7 +300,7 @@ "title": "a", "labelFlush": true, "labelOverlap": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "zindex": 0 }, { @@ -300,7 +309,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -311,28 +320,49 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_0_childHeight"} + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ { - "name": "concat_0_concat_2_marks", + "name": "concat_0_concat_2_layer_0_marks", "type": "line", "style": ["line"], "sort": {"field": "x"}, - "from": {"data": "data_0"}, + "from": {"data": "data_1"}, "encode": { "update": { "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_1"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, "x": {"scale": "concat_0_concat_2_x", "field": "a"}, - "y": {"scale": "concat_0_concat_2_y", "field": "b"}, - "defined": { - "signal": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" - } + "y": {"scale": "concat_0_concat_2_y", "field": "b"} } } } @@ -343,7 +373,7 @@ "orient": "bottom", "gridScale": "concat_0_concat_2_y", "grid": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "domain": false, "labels": false, "aria": false, @@ -357,7 +387,7 @@ "orient": "left", "gridScale": "concat_0_concat_2_x", "grid": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -373,7 +403,7 @@ "title": "a", "labelFlush": true, "labelOverlap": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "zindex": 0 }, { @@ -382,7 +412,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -393,8 +423,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_0_childHeight"} + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -403,20 +433,20 @@ "type": "area", "style": ["area"], "sort": {"field": "x"}, - "from": {"data": "data_4"}, + "from": {"data": "data_3"}, "encode": { "update": { "orient": {"value": "vertical"}, "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, "description": { "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, "x": {"scale": "concat_0_concat_3_x", "field": "a"}, "y": {"scale": "concat_0_concat_3_y", "field": "b_end"}, - "y2": {"scale": "concat_0_concat_3_y", "field": "b_start"}, - "defined": { - "signal": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" - } + "y2": {"scale": "concat_0_concat_3_y", "field": "b_start"} } } } @@ -427,7 +457,7 @@ "orient": "bottom", "gridScale": "concat_0_concat_3_y", "grid": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "domain": false, "labels": false, "aria": false, @@ -441,7 +471,7 @@ "orient": "left", "gridScale": "concat_0_concat_3_x", "grid": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -457,7 +487,7 @@ "title": "a", "labelFlush": true, "labelOverlap": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "zindex": 0 }, { @@ -466,7 +496,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -477,12 +507,7 @@ "type": "group", "name": "concat_1_group", "title": {"text": "Ordinal X", "anchor": "start"}, - "layout": { - "padding": 20, - "columns": 1, - "bounds": "full", - "align": "each" - }, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", @@ -490,8 +515,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_1_childHeight"} + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -499,12 +524,15 @@ "name": "concat_1_concat_0_marks", "type": "symbol", "style": ["point"], - "from": {"data": "data_5"}, + "from": {"data": "data_4"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" @@ -521,7 +549,7 @@ "orient": "left", "gridScale": "concat_1_concat_0_x", "grid": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -546,7 +574,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -557,8 +585,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_1_childHeight"} + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -566,10 +594,13 @@ "name": "concat_1_concat_1_marks", "type": "rect", "style": ["bar"], - "from": {"data": "data_6"}, + "from": {"data": "data_5"}, "encode": { "update": { "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" @@ -590,7 +621,7 @@ "orient": "left", "gridScale": "concat_1_concat_1_x", "grid": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -615,7 +646,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -626,28 +657,49 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_1_childHeight"} + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ { - "name": "concat_1_concat_2_marks", + "name": "concat_1_concat_2_layer_0_marks", "type": "line", "style": ["line"], "sort": {"field": "x"}, - "from": {"data": "data_0"}, + "from": {"data": "data_4"}, "encode": { "update": { "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, "x": {"scale": "concat_1_concat_2_x", "field": "a"}, - "y": {"scale": "concat_1_concat_2_y", "field": "b"}, - "defined": { - "signal": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" - } + "y": {"scale": "concat_1_concat_2_y", "field": "b"} } } } @@ -658,7 +710,7 @@ "orient": "left", "gridScale": "concat_1_concat_2_x", "grid": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -683,7 +735,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -694,8 +746,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_1_childHeight"} + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -704,20 +756,20 @@ "type": "area", "style": ["area"], "sort": {"field": "x"}, - "from": {"data": "data_7"}, + "from": {"data": "data_6"}, "encode": { "update": { "orient": {"value": "vertical"}, "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, "x": {"scale": "concat_1_concat_3_x", "field": "a"}, "y": {"scale": "concat_1_concat_3_y", "field": "b_end"}, - "y2": {"scale": "concat_1_concat_3_y", "field": "b_start"}, - "defined": { - "signal": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" - } + "y2": {"scale": "concat_1_concat_3_y", "field": "b_start"} } } } @@ -728,7 +780,7 @@ "orient": "left", "gridScale": "concat_1_concat_3_x", "grid": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -753,7 +805,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -765,24 +817,24 @@ { "name": "concat_0_concat_0_x", "type": "linear", - "domain": {"data": "data_2", "field": "a"}, - "range": [0, {"signal": "childWidth"}], + "domain": {"data": "data_1", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], "nice": true, "zero": true }, { "name": "concat_0_concat_0_y", "type": "linear", - "domain": {"data": "data_2", "field": "b"}, - "range": [{"signal": "concat_0_childHeight"}, 0], + "domain": {"data": "data_1", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "concat_0_concat_1_x", "type": "linear", - "domain": {"data": "data_3", "field": "a"}, - "range": [0, {"signal": "childWidth"}], + "domain": {"data": "data_2", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], "nice": true, "zero": false, "padding": 5 @@ -790,103 +842,104 @@ { "name": "concat_0_concat_1_y", "type": "linear", - "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, - "range": [{"signal": "concat_0_childHeight"}, 0], + "domain": {"data": "data_2", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "concat_0_concat_2_x", "type": "linear", - "domain": {"data": "data_0", "field": "a"}, - "range": [0, {"signal": "childWidth"}], + "domain": {"data": "data_1", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], "nice": true, "zero": false }, { "name": "concat_0_concat_2_y", "type": "linear", - "domain": {"data": "data_0", "field": "b"}, - "range": [{"signal": "concat_0_childHeight"}, 0], + "domain": {"data": "data_1", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "concat_0_concat_3_x", "type": "linear", - "domain": {"data": "data_4", "field": "a"}, - "range": [0, {"signal": "childWidth"}], + "domain": {"data": "data_3", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], "nice": true, "zero": false }, { "name": "concat_0_concat_3_y", "type": "linear", - "domain": {"data": "data_4", "fields": ["b_start", "b_end"]}, - "range": [{"signal": "concat_0_childHeight"}, 0], + "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "concat_1_concat_0_x", "type": "point", - "domain": {"data": "data_5", "field": "a", "sort": true}, - "range": [0, {"signal": "childWidth"}], + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], "padding": 0.5 }, { "name": "concat_1_concat_0_y", "type": "linear", - "domain": {"data": "data_5", "field": "b"}, - "range": [{"signal": "concat_1_childHeight"}, 0], + "domain": {"data": "data_4", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "concat_1_concat_1_x", "type": "band", - "domain": {"data": "data_6", "field": "a", "sort": true}, - "range": [0, {"signal": "childWidth"}], + "domain": {"data": "data_5", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], "paddingInner": 0.1, "paddingOuter": 0.05 }, { "name": "concat_1_concat_1_y", "type": "linear", - "domain": {"data": "data_6", "fields": ["b_start", "b_end"]}, - "range": [{"signal": "concat_1_childHeight"}, 0], + "domain": {"data": "data_5", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "concat_1_concat_2_x", "type": "point", - "domain": {"data": "data_0", "field": "a", "sort": true}, - "range": [0, {"signal": "childWidth"}], + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], "padding": 0.5 }, { "name": "concat_1_concat_2_y", "type": "linear", - "domain": {"data": "data_0", "field": "b"}, - "range": [{"signal": "concat_1_childHeight"}, 0], + "domain": {"data": "data_4", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "concat_1_concat_3_x", "type": "point", - "domain": {"data": "data_7", "field": "a", "sort": true}, - "range": [0, {"signal": "childWidth"}], + "domain": {"data": "data_6", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], "padding": 0.5 }, { "name": "concat_1_concat_3_y", "type": "linear", - "domain": {"data": "data_7", "fields": ["b_start", "b_end"]}, - "range": [{"signal": "concat_1_childHeight"}, 0], + "domain": {"data": "data_6", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true } - ] + ], + "config": {"mark": {"tooltip": true}} } diff --git a/examples/compiled/test_invalid_null.png b/examples/compiled/test_invalid_null.png index 8ff7b7c3c9..a1a5de1321 100644 Binary files a/examples/compiled/test_invalid_null.png and b/examples/compiled/test_invalid_null.png differ diff --git a/examples/compiled/test_invalid_null.svg b/examples/compiled/test_invalid_null.svg index 3c52e46b56..f4635611ae 100644 --- a/examples/compiled/test_invalid_null.svg +++ b/examples/compiled/test_invalid_null.svg @@ -1 +1 @@ -−10−50510a05001,000b−10010a05001,000b−10−50510a05001,000b−10−50510a05001,000bQuantitative Xnull-10-5-101510a05001,000bnull-10-5-101510a05001,000bnull-10-5-101510a05001,000bnull-10-5-101510a05001,000bOrdinal X \ No newline at end of file +−10−50510a050100b−10010a050100b−10−50510a050100b−10−50510a050100bQuantitative Xnull-10-5-101510a050100bnull-10-5-101510a050100bnull-10-5-101510a050100bnull-10-5-101510a050100bOrdinal X \ No newline at end of file diff --git a/examples/compiled/test_invalid_null.vg.json b/examples/compiled/test_invalid_null.vg.json index 0ea097f958..d4134b54da 100644 --- a/examples/compiled/test_invalid_null.vg.json +++ b/examples/compiled/test_invalid_null.vg.json @@ -7,10 +7,10 @@ { "name": "source_0", "values": [ - {"a": null, "b": 1000}, + {"a": null, "b": 100}, {"a": -10, "b": null}, - {"a": -5, "b": 25}, - {"a": -1, "b": 20}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, {"a": 0, "b": null}, {"a": 1, "b": 30}, {"a": 5, "b": 40}, @@ -98,22 +98,17 @@ } ], "signals": [ - {"name": "childWidth", "value": 100}, - {"name": "concat_0_childHeight", "value": 100}, - {"name": "concat_1_childHeight", "value": 100} + {"name": "childHeight", "value": 100}, + {"name": "concat_0_childWidth", "value": 100}, + {"name": "concat_1_childWidth", "value": 100} ], - "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "layout": {"padding": 20, "columns": 1, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", "name": "concat_0_group", "title": {"text": "Quantitative X", "anchor": "start"}, - "layout": { - "padding": 20, - "columns": 1, - "bounds": "full", - "align": "each" - }, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", @@ -121,8 +116,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_0_childHeight"} + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -136,6 +131,9 @@ "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" @@ -143,6 +141,7 @@ "x": [ { "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "scale": "concat_0_concat_0_x", "value": 0 }, {"scale": "concat_0_concat_0_x", "field": "a"} @@ -150,7 +149,8 @@ "y": [ { "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", - "field": {"group": "height"} + "scale": "concat_0_concat_0_y", + "value": 0 }, {"scale": "concat_0_concat_0_y", "field": "b"} ] @@ -164,7 +164,7 @@ "orient": "bottom", "gridScale": "concat_0_concat_0_y", "grid": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "domain": false, "labels": false, "aria": false, @@ -178,7 +178,7 @@ "orient": "left", "gridScale": "concat_0_concat_0_x", "grid": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -194,7 +194,7 @@ "title": "a", "labelFlush": true, "labelOverlap": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "zindex": 0 }, { @@ -203,7 +203,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -214,8 +214,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_0_childHeight"} + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -227,6 +227,9 @@ "encode": { "update": { "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" @@ -234,7 +237,7 @@ "xc": [ { "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", - "value": 0 + "signal": "scale('concat_0_concat_1_x', inrange(0, domain('concat_0_concat_1_x')) ? 0 : domain('concat_0_concat_1_x')[0])" }, {"scale": "concat_0_concat_1_x", "field": "a"} ], @@ -251,7 +254,7 @@ "orient": "bottom", "gridScale": "concat_0_concat_1_y", "grid": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "domain": false, "labels": false, "aria": false, @@ -265,7 +268,7 @@ "orient": "left", "gridScale": "concat_0_concat_1_x", "grid": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -281,7 +284,7 @@ "title": "a", "labelFlush": true, "labelOverlap": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "zindex": 0 }, { @@ -290,7 +293,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -301,13 +304,13 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_0_childHeight"} + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ { - "name": "concat_0_concat_2_marks", + "name": "concat_0_concat_2_layer_0_marks", "type": "line", "style": ["line"], "sort": {"field": "x"}, @@ -315,20 +318,58 @@ "encode": { "update": { "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, "description": { "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, "x": [ { "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_2_x', inrange(0, domain('concat_0_concat_2_x')) ? 0 : domain('concat_0_concat_2_x')[0])" + }, + {"scale": "concat_0_concat_2_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_0_concat_2_y", "value": 0 }, + {"scale": "concat_0_concat_2_y", "field": "b"} + ] + } + } + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_2_x', inrange(0, domain('concat_0_concat_2_x')) ? 0 : domain('concat_0_concat_2_x')[0])" + }, {"scale": "concat_0_concat_2_x", "field": "a"} ], "y": [ { "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", - "field": {"group": "height"} + "scale": "concat_0_concat_2_y", + "value": 0 }, {"scale": "concat_0_concat_2_y", "field": "b"} ] @@ -342,7 +383,7 @@ "orient": "bottom", "gridScale": "concat_0_concat_2_y", "grid": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "domain": false, "labels": false, "aria": false, @@ -356,7 +397,7 @@ "orient": "left", "gridScale": "concat_0_concat_2_x", "grid": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -372,7 +413,7 @@ "title": "a", "labelFlush": true, "labelOverlap": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "zindex": 0 }, { @@ -381,7 +422,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -392,8 +433,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_0_childHeight"} + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -407,13 +448,16 @@ "update": { "orient": {"value": "vertical"}, "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, "description": { "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, "x": [ { "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", - "value": 0 + "signal": "scale('concat_0_concat_3_x', inrange(0, domain('concat_0_concat_3_x')) ? 0 : domain('concat_0_concat_3_x')[0])" }, {"scale": "concat_0_concat_3_x", "field": "a"} ], @@ -429,7 +473,7 @@ "orient": "bottom", "gridScale": "concat_0_concat_3_y", "grid": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "domain": false, "labels": false, "aria": false, @@ -443,7 +487,7 @@ "orient": "left", "gridScale": "concat_0_concat_3_x", "grid": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -459,7 +503,7 @@ "title": "a", "labelFlush": true, "labelOverlap": true, - "tickCount": {"signal": "ceil(childWidth/40)"}, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, "zindex": 0 }, { @@ -468,7 +512,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -479,12 +523,7 @@ "type": "group", "name": "concat_1_group", "title": {"text": "Ordinal X", "anchor": "start"}, - "layout": { - "padding": 20, - "columns": 1, - "bounds": "full", - "align": "each" - }, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", @@ -492,8 +531,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_1_childHeight"} + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -507,6 +546,9 @@ "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" @@ -515,7 +557,8 @@ "y": [ { "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", - "field": {"group": "height"} + "scale": "concat_1_concat_0_y", + "value": 0 }, {"scale": "concat_1_concat_0_y", "field": "b"} ] @@ -529,7 +572,7 @@ "orient": "left", "gridScale": "concat_1_concat_0_x", "grid": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -554,7 +597,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -565,8 +608,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_1_childHeight"} + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -578,6 +621,9 @@ "encode": { "update": { "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" @@ -598,7 +644,7 @@ "orient": "left", "gridScale": "concat_1_concat_1_x", "grid": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -623,7 +669,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -634,13 +680,13 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_1_childHeight"} + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ { - "name": "concat_1_concat_2_marks", + "name": "concat_1_concat_2_layer_0_marks", "type": "line", "style": ["line"], "sort": {"field": "x"}, @@ -648,6 +694,37 @@ "encode": { "update": { "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_1_concat_2_y", + "value": 0 + }, + {"scale": "concat_1_concat_2_y", "field": "b"} + ] + } + } + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, @@ -655,7 +732,8 @@ "y": [ { "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", - "field": {"group": "height"} + "scale": "concat_1_concat_2_y", + "value": 0 }, {"scale": "concat_1_concat_2_y", "field": "b"} ] @@ -669,7 +747,7 @@ "orient": "left", "gridScale": "concat_1_concat_2_x", "grid": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -694,7 +772,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -705,8 +783,8 @@ "style": "cell", "encode": { "update": { - "width": {"signal": "childWidth"}, - "height": {"signal": "concat_1_childHeight"} + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} } }, "marks": [ @@ -720,6 +798,9 @@ "update": { "orient": {"value": "vertical"}, "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, "description": { "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" }, @@ -736,7 +817,7 @@ "orient": "left", "gridScale": "concat_1_concat_3_x", "grid": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, @@ -761,7 +842,7 @@ "grid": false, "title": "b", "labelOverlap": true, - "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] @@ -774,7 +855,7 @@ "name": "concat_0_concat_0_x", "type": "linear", "domain": {"data": "data_0", "field": "a"}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_0_childWidth"}], "nice": true, "zero": true }, @@ -782,7 +863,7 @@ "name": "concat_0_concat_0_y", "type": "linear", "domain": {"data": "data_0", "field": "b"}, - "range": [{"signal": "concat_0_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, @@ -790,7 +871,7 @@ "name": "concat_0_concat_1_x", "type": "linear", "domain": {"data": "data_2", "field": "a"}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_0_childWidth"}], "nice": true, "zero": false, "padding": 5 @@ -799,7 +880,7 @@ "name": "concat_0_concat_1_y", "type": "linear", "domain": {"data": "data_2", "fields": ["b_start", "b_end"]}, - "range": [{"signal": "concat_0_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, @@ -807,7 +888,7 @@ "name": "concat_0_concat_2_x", "type": "linear", "domain": {"data": "data_0", "field": "a"}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_0_childWidth"}], "nice": true, "zero": false }, @@ -815,7 +896,7 @@ "name": "concat_0_concat_2_y", "type": "linear", "domain": {"data": "data_0", "field": "b"}, - "range": [{"signal": "concat_0_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, @@ -823,7 +904,7 @@ "name": "concat_0_concat_3_x", "type": "linear", "domain": {"data": "data_3", "field": "a"}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_0_childWidth"}], "nice": true, "zero": false }, @@ -831,7 +912,7 @@ "name": "concat_0_concat_3_y", "type": "linear", "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, - "range": [{"signal": "concat_0_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, @@ -839,14 +920,14 @@ "name": "concat_1_concat_0_x", "type": "point", "domain": {"data": "data_0", "field": "a", "sort": true}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_1_childWidth"}], "padding": 0.5 }, { "name": "concat_1_concat_0_y", "type": "linear", "domain": {"data": "data_0", "field": "b"}, - "range": [{"signal": "concat_1_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, @@ -854,7 +935,7 @@ "name": "concat_1_concat_1_x", "type": "band", "domain": {"data": "data_4", "field": "a", "sort": true}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_1_childWidth"}], "paddingInner": 0.1, "paddingOuter": 0.05 }, @@ -862,7 +943,7 @@ "name": "concat_1_concat_1_y", "type": "linear", "domain": {"data": "data_4", "fields": ["b_start", "b_end"]}, - "range": [{"signal": "concat_1_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, @@ -870,14 +951,14 @@ "name": "concat_1_concat_2_x", "type": "point", "domain": {"data": "data_0", "field": "a", "sort": true}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_1_childWidth"}], "padding": 0.5 }, { "name": "concat_1_concat_2_y", "type": "linear", "domain": {"data": "data_0", "field": "b"}, - "range": [{"signal": "concat_1_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, @@ -885,16 +966,17 @@ "name": "concat_1_concat_3_x", "type": "point", "domain": {"data": "data_5", "field": "a", "sort": true}, - "range": [0, {"signal": "childWidth"}], + "range": [0, {"signal": "concat_1_childWidth"}], "padding": 0.5 }, { "name": "concat_1_concat_3_y", "type": "linear", "domain": {"data": "data_5", "fields": ["b_start", "b_end"]}, - "range": [{"signal": "concat_1_childHeight"}, 0], + "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true } - ] + ], + "config": {"mark": {"tooltip": true}} } diff --git a/examples/compiled/test_invalid_opacity_filter.png b/examples/compiled/test_invalid_opacity_filter.png new file mode 100644 index 0000000000..b7023bce36 Binary files /dev/null and b/examples/compiled/test_invalid_opacity_filter.png differ diff --git a/examples/compiled/test_invalid_opacity_filter.svg b/examples/compiled/test_invalid_opacity_filter.svg new file mode 100644 index 0000000000..5bd38d9893 --- /dev/null +++ b/examples/compiled/test_invalid_opacity_filter.svg @@ -0,0 +1 @@ +0123a0102030b123a02040b1.01.52.02.53.0a0102030b1.01.52.02.53.0a02040bQuantitative X123a0102030b123a02040b123a0102030b123a02040bOrdinal X1.01.21.41.61.82.0c \ No newline at end of file diff --git a/examples/compiled/test_invalid_opacity_filter.vg.json b/examples/compiled/test_invalid_opacity_filter.vg.json new file mode 100644 index 0000000000..688632fa11 --- /dev/null +++ b/examples/compiled/test_invalid_opacity_filter.vg.json @@ -0,0 +1,1073 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "data": [ + { + "name": "source_0", + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + {"type": "formula", "expr": "toNumber(datum[\"a\"])", "as": "a"} + ] + }, + { + "name": "data_1", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + }, + { + "name": "data_2", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + }, + { + "name": "data_3", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": ["c"], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + }, + { + "name": "data_4", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + }, + { + "name": "data_5", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + }, + { + "name": "data_6", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": ["c"], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"]) && isValid(datum[\"c\"]) && isFinite(+datum[\"c\"])" + } + ] + } + ], + "signals": [ + {"name": "childWidth", "value": 100}, + {"name": "concat_0_childHeight", "value": 100}, + {"name": "concat_1_childHeight", "value": 100} + ], + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Quantitative X", "anchor": "start"}, + "layout": { + "padding": 20, + "columns": 1, + "bounds": "full", + "align": "each" + }, + "marks": [ + { + "type": "group", + "name": "concat_0_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_1"}, + "encode": { + "update": { + "opacity": {"scale": "opacity", "field": "c"}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_0_x", "field": "a"}, + "y": {"scale": "concat_0_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "gridScale": "concat_0_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "opacity": {"scale": "opacity", "field": "c"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "xc": {"scale": "concat_0_concat_1_x", "field": "a"}, + "width": {"value": 5}, + "y": {"scale": "concat_0_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "gridScale": "concat_0_concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "gridScale": "concat_0_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_0_concat_2_layer_0_main", + "data": "data_1", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": { + "data": "faceted_path_concat_0_concat_2_layer_0_main" + }, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "opacity": {"scale": "opacity", "field": "c"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } + } + ] + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_1"}, + "encode": { + "update": { + "opacity": {"scale": "opacity", "field": "c"}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "gridScale": "concat_0_concat_2_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "gridScale": "concat_0_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_0_concat_3_main", + "data": "data_3", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "faceted_path_concat_0_concat_3_main"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "opacity": {"scale": "opacity", "field": "c"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_3_x", "field": "a"}, + "y": {"scale": "concat_0_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_3_y", "field": "b_start"} + } + } + } + ] + } + ], + "axes": [ + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "gridScale": "concat_0_concat_3_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "gridScale": "concat_0_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Ordinal X", "anchor": "start"}, + "layout": { + "padding": 20, + "columns": 1, + "bounds": "full", + "align": "each" + }, + "marks": [ + { + "type": "group", + "name": "concat_1_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "opacity": {"scale": "opacity", "field": "c"}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_0_x", "field": "a"}, + "y": {"scale": "concat_1_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "gridScale": "concat_1_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_5"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "opacity": {"scale": "opacity", "field": "c"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_1_x", "field": "a"}, + "width": { + "signal": "max(0.25, bandwidth('concat_1_concat_1_x'))" + }, + "y": {"scale": "concat_1_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "gridScale": "concat_1_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_1_concat_2_layer_0_main", + "data": "data_4", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": { + "data": "faceted_path_concat_1_concat_2_layer_0_main" + }, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "opacity": {"scale": "opacity", "field": "c"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } + } + ] + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "opacity": {"scale": "opacity", "field": "c"}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "gridScale": "concat_1_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_1_concat_3_main", + "data": "data_6", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "faceted_path_concat_1_concat_3_main"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "opacity": {"scale": "opacity", "field": "c"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_3_x", "field": "a"}, + "y": {"scale": "concat_1_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_3_y", "field": "b_start"} + } + } + } + ] + } + ], + "axes": [ + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "gridScale": "concat_1_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + } + ], + "scales": [ + { + "name": "opacity", + "type": "linear", + "domain": { + "fields": [ + {"data": "data_1", "field": "c"}, + {"data": "data_2", "field": "c"}, + {"data": "data_3", "field": "c"}, + {"data": "data_4", "field": "c"}, + {"data": "data_5", "field": "c"}, + {"data": "data_6", "field": "c"} + ] + }, + "range": [0.3, 0.8], + "zero": false + }, + { + "name": "concat_0_concat_0_x", + "type": "linear", + "domain": {"data": "data_1", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_0_y", + "type": "linear", + "domain": {"data": "data_1", "field": "b"}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_1_x", + "type": "linear", + "domain": {"data": "data_2", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false, + "padding": 5 + }, + { + "name": "concat_0_concat_1_y", + "type": "linear", + "domain": {"data": "data_2", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_2_x", + "type": "linear", + "domain": {"data": "data_1", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_2_y", + "type": "linear", + "domain": {"data": "data_1", "field": "b"}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_3_x", + "type": "linear", + "domain": {"data": "data_3", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_3_y", + "type": "linear", + "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_0_x", + "type": "point", + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_0_y", + "type": "linear", + "domain": {"data": "data_4", "field": "b"}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_1_x", + "type": "band", + "domain": {"data": "data_5", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "concat_1_concat_1_y", + "type": "linear", + "domain": {"data": "data_5", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_2_x", + "type": "point", + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_2_y", + "type": "linear", + "domain": {"data": "data_4", "field": "b"}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_3_x", + "type": "point", + "domain": {"data": "data_6", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_3_y", + "type": "linear", + "domain": {"data": "data_6", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + } + ], + "legends": [ + { + "opacity": "opacity", + "symbolType": "circle", + "title": "c", + "encode": { + "symbols": { + "update": { + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"} + } + } + } + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/test_invalid_opacity_filter_but_include_in_scale_invalid.png b/examples/compiled/test_invalid_opacity_filter_but_include_in_scale_invalid.png new file mode 100644 index 0000000000..05a2fc7335 Binary files /dev/null and b/examples/compiled/test_invalid_opacity_filter_but_include_in_scale_invalid.png differ diff --git a/examples/compiled/test_invalid_opacity_filter_but_include_in_scale_invalid.svg b/examples/compiled/test_invalid_opacity_filter_but_include_in_scale_invalid.svg new file mode 100644 index 0000000000..67540caf76 --- /dev/null +++ b/examples/compiled/test_invalid_opacity_filter_but_include_in_scale_invalid.svg @@ -0,0 +1 @@ +0123a02040b123a050100b1.01.52.02.53.0a02040b1.01.52.02.53.0a050100bQuantitative X123a02040b123a050100b123a02040b123a050100bOrdinal X1.01.21.41.61.82.0c \ No newline at end of file diff --git a/examples/compiled/test_invalid_opacity_filter_but_include_in_scale_invalid.vg.json b/examples/compiled/test_invalid_opacity_filter_but_include_in_scale_invalid.vg.json new file mode 100644 index 0000000000..da3940ae50 --- /dev/null +++ b/examples/compiled/test_invalid_opacity_filter_but_include_in_scale_invalid.vg.json @@ -0,0 +1,1133 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "data": [ + { + "name": "source_0", + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + {"type": "formula", "expr": "toNumber(datum[\"a\"])", "as": "a"} + ] + }, + { + "name": "data_1", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_2", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_3", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": ["c"], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_4", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_5", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + }, + { + "name": "data_6", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": ["c"], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + }, + { + "type": "filter", + "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + } + ], + "signals": [ + {"name": "childWidth", "value": 100}, + {"name": "concat_0_childHeight", "value": 100}, + {"name": "concat_1_childHeight", "value": 100} + ], + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Quantitative X", "anchor": "start"}, + "layout": { + "padding": 20, + "columns": 1, + "bounds": "full", + "align": "each" + }, + "marks": [ + { + "type": "group", + "name": "concat_0_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_1"}, + "encode": { + "update": { + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": 0.1 + }, + {"scale": "opacity", "field": "c"} + ], + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_0_x", "field": "a"}, + "y": {"scale": "concat_0_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "gridScale": "concat_0_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": 0.1 + }, + {"scale": "opacity", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "xc": {"scale": "concat_0_concat_1_x", "field": "a"}, + "width": {"value": 5}, + "y": {"scale": "concat_0_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "gridScale": "concat_0_concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "gridScale": "concat_0_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_0_concat_2_layer_0_main", + "data": "data_1", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": { + "data": "faceted_path_concat_0_concat_2_layer_0_main" + }, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": 0.1 + }, + {"scale": "opacity", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } + } + ] + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_1"}, + "encode": { + "update": { + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": 0.1 + }, + {"scale": "opacity", "field": "c"} + ], + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_2_x", "field": "a"}, + "y": {"scale": "concat_0_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "gridScale": "concat_0_concat_2_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "gridScale": "concat_0_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_0_concat_3_main", + "data": "data_3", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "faceted_path_concat_0_concat_3_main"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": 0.1 + }, + {"scale": "opacity", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_0_concat_3_x", "field": "a"}, + "y": {"scale": "concat_0_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_3_y", "field": "b_start"} + } + } + } + ] + } + ], + "axes": [ + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "gridScale": "concat_0_concat_3_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "gridScale": "concat_0_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Ordinal X", "anchor": "start"}, + "layout": { + "padding": 20, + "columns": 1, + "bounds": "full", + "align": "each" + }, + "marks": [ + { + "type": "group", + "name": "concat_1_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": 0.1 + }, + {"scale": "opacity", "field": "c"} + ], + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_0_x", "field": "a"}, + "y": {"scale": "concat_1_concat_0_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "gridScale": "concat_1_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_5"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": 0.1 + }, + {"scale": "opacity", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_1_x", "field": "a"}, + "width": { + "signal": "max(0.25, bandwidth('concat_1_concat_1_x'))" + }, + "y": {"scale": "concat_1_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "gridScale": "concat_1_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_1_concat_2_layer_0_main", + "data": "data_4", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": { + "data": "faceted_path_concat_1_concat_2_layer_0_main" + }, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": 0.1 + }, + {"scale": "opacity", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } + } + ] + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": 0.1 + }, + {"scale": "opacity", "field": "c"} + ], + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": {"scale": "concat_1_concat_2_y", "field": "b"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "gridScale": "concat_1_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_1_concat_3_main", + "data": "data_6", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "faceted_path_concat_1_concat_3_main"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "value": 0.1 + }, + {"scale": "opacity", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_3_x", "field": "a"}, + "y": {"scale": "concat_1_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_3_y", "field": "b_start"} + } + } + } + ] + } + ], + "axes": [ + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "gridScale": "concat_1_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + } + ], + "scales": [ + { + "name": "opacity", + "type": "linear", + "domain": { + "fields": [ + {"data": "data_1", "field": "c"}, + {"data": "data_2", "field": "c"}, + {"data": "data_3", "field": "c"}, + {"data": "data_4", "field": "c"}, + {"data": "data_5", "field": "c"}, + {"data": "data_6", "field": "c"} + ] + }, + "range": [0.3, 0.8], + "zero": false + }, + { + "name": "concat_0_concat_0_x", + "type": "linear", + "domain": {"data": "data_1", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_0_y", + "type": "linear", + "domain": {"data": "data_1", "field": "b"}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_1_x", + "type": "linear", + "domain": {"data": "data_2", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false, + "padding": 5 + }, + { + "name": "concat_0_concat_1_y", + "type": "linear", + "domain": {"data": "data_2", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_2_x", + "type": "linear", + "domain": {"data": "data_1", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_2_y", + "type": "linear", + "domain": {"data": "data_1", "field": "b"}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_3_x", + "type": "linear", + "domain": {"data": "data_3", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_3_y", + "type": "linear", + "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_0_x", + "type": "point", + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_0_y", + "type": "linear", + "domain": {"data": "data_4", "field": "b"}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_1_x", + "type": "band", + "domain": {"data": "data_5", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "concat_1_concat_1_y", + "type": "linear", + "domain": {"data": "data_5", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_2_x", + "type": "point", + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_2_y", + "type": "linear", + "domain": {"data": "data_4", "field": "b"}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_3_x", + "type": "point", + "domain": {"data": "data_6", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_3_y", + "type": "linear", + "domain": {"data": "data_6", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + } + ], + "legends": [ + { + "opacity": "opacity", + "symbolType": "circle", + "title": "c", + "encode": { + "symbols": { + "update": { + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"} + } + } + } + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/test_invalid_opacity_show.png b/examples/compiled/test_invalid_opacity_show.png new file mode 100644 index 0000000000..2b8cdfef24 Binary files /dev/null and b/examples/compiled/test_invalid_opacity_show.png differ diff --git a/examples/compiled/test_invalid_opacity_show.svg b/examples/compiled/test_invalid_opacity_show.svg new file mode 100644 index 0000000000..3330670d5f --- /dev/null +++ b/examples/compiled/test_invalid_opacity_show.svg @@ -0,0 +1 @@ +0123a02040b123a050100b1.01.52.02.53.0a02040b1.01.52.02.53.0a050100bQuantitative X123a02040b123a050100b123a02040b123a050100bOrdinal X1.01.21.41.61.82.0c \ No newline at end of file diff --git a/examples/compiled/test_invalid_opacity_show.vg.json b/examples/compiled/test_invalid_opacity_show.vg.json new file mode 100644 index 0000000000..00ad629972 --- /dev/null +++ b/examples/compiled/test_invalid_opacity_show.vg.json @@ -0,0 +1,1169 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "data": [ + { + "name": "source_0", + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + {"type": "formula", "expr": "toNumber(datum[\"a\"])", "as": "a"} + ] + }, + { + "name": "data_2", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_3", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": ["c"], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_4", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_5", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": ["c"], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": ["c"], "order": ["descending"]}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + } + ], + "signals": [ + {"name": "childWidth", "value": 100}, + {"name": "concat_0_childHeight", "value": 100}, + {"name": "concat_1_childHeight", "value": 100} + ], + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Quantitative X", "anchor": "start"}, + "layout": { + "padding": 20, + "columns": 1, + "bounds": "full", + "align": "each" + }, + "marks": [ + { + "type": "group", + "name": "concat_0_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('opacity', inrange(0, domain('opacity')) ? 0 : domain('opacity')[0])" + }, + {"scale": "opacity", "field": "c"} + ], + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "scale": "concat_0_concat_0_x", + "value": 0 + }, + {"scale": "concat_0_concat_0_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_0_concat_0_y", + "value": 0 + }, + {"scale": "concat_0_concat_0_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "gridScale": "concat_0_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('opacity', inrange(0, domain('opacity')) ? 0 : domain('opacity')[0])" + }, + {"scale": "opacity", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "xc": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_1_x', inrange(0, domain('concat_0_concat_1_x')) ? 0 : domain('concat_0_concat_1_x')[0])" + }, + {"scale": "concat_0_concat_1_x", "field": "a"} + ], + "width": {"value": 5}, + "y": {"scale": "concat_0_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "gridScale": "concat_0_concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "gridScale": "concat_0_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_0_concat_2_layer_0_main", + "data": "data_0", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": { + "data": "faceted_path_concat_0_concat_2_layer_0_main" + }, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('opacity', inrange(0, domain('opacity')) ? 0 : domain('opacity')[0])" + }, + {"scale": "opacity", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_2_x', inrange(0, domain('concat_0_concat_2_x')) ? 0 : domain('concat_0_concat_2_x')[0])" + }, + {"scale": "concat_0_concat_2_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_0_concat_2_y", + "value": 0 + }, + {"scale": "concat_0_concat_2_y", "field": "b"} + ] + } + } + } + ] + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('opacity', inrange(0, domain('opacity')) ? 0 : domain('opacity')[0])" + }, + {"scale": "opacity", "field": "c"} + ], + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_2_x', inrange(0, domain('concat_0_concat_2_x')) ? 0 : domain('concat_0_concat_2_x')[0])" + }, + {"scale": "concat_0_concat_2_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_0_concat_2_y", + "value": 0 + }, + {"scale": "concat_0_concat_2_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "gridScale": "concat_0_concat_2_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "gridScale": "concat_0_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_0_childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_0_concat_3_main", + "data": "data_3", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "faceted_path_concat_0_concat_3_main"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('opacity', inrange(0, domain('opacity')) ? 0 : domain('opacity')[0])" + }, + {"scale": "opacity", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_3_x', inrange(0, domain('concat_0_concat_3_x')) ? 0 : domain('concat_0_concat_3_x')[0])" + }, + {"scale": "concat_0_concat_3_x", "field": "a"} + ], + "y": {"scale": "concat_0_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_3_y", "field": "b_start"} + } + } + } + ] + } + ], + "axes": [ + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "gridScale": "concat_0_concat_3_y", + "grid": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "gridScale": "concat_0_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Ordinal X", "anchor": "start"}, + "layout": { + "padding": 20, + "columns": 1, + "bounds": "full", + "align": "each" + }, + "marks": [ + { + "type": "group", + "name": "concat_1_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('opacity', inrange(0, domain('opacity')) ? 0 : domain('opacity')[0])" + }, + {"scale": "opacity", "field": "c"} + ], + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_0_x", "field": "a"}, + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_1_concat_0_y", + "value": 0 + }, + {"scale": "concat_1_concat_0_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "gridScale": "concat_1_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('opacity', inrange(0, domain('opacity')) ? 0 : domain('opacity')[0])" + }, + {"scale": "opacity", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_1_x", "field": "a"}, + "width": { + "signal": "max(0.25, bandwidth('concat_1_concat_1_x'))" + }, + "y": {"scale": "concat_1_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "gridScale": "concat_1_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_1_concat_2_layer_0_main", + "data": "data_0", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": { + "data": "faceted_path_concat_1_concat_2_layer_0_main" + }, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('opacity', inrange(0, domain('opacity')) ? 0 : domain('opacity')[0])" + }, + {"scale": "opacity", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_1_concat_2_y", + "value": 0 + }, + {"scale": "concat_1_concat_2_y", "field": "b"} + ] + } + } + } + ] + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('opacity', inrange(0, domain('opacity')) ? 0 : domain('opacity')[0])" + }, + {"scale": "opacity", "field": "c"} + ], + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_1_concat_2_y", + "value": 0 + }, + {"scale": "concat_1_concat_2_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "gridScale": "concat_1_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "childWidth"}, + "height": {"signal": "concat_1_childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_pathgroup", + "type": "group", + "from": { + "facet": { + "name": "faceted_path_concat_1_concat_3_main", + "data": "data_5", + "groupby": ["c"] + } + }, + "encode": { + "update": { + "width": {"field": {"group": "width"}}, + "height": {"field": {"group": "height"}} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "faceted_path_concat_1_concat_3_main"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "opacity": [ + { + "test": "!isValid(datum[\"c\"]) || !isFinite(+datum[\"c\"])", + "signal": "scale('opacity', inrange(0, domain('opacity')) ? 0 : domain('opacity')[0])" + }, + {"scale": "opacity", "field": "c"} + ], + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\"), \"c\": format(datum[\"c\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\")) + \"; c: \" + (format(datum[\"c\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_3_x", "field": "a"}, + "y": {"scale": "concat_1_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_3_y", "field": "b_start"} + } + } + } + ] + } + ], + "axes": [ + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "gridScale": "concat_1_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_1_childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + } + ], + "scales": [ + { + "name": "opacity", + "type": "linear", + "domain": { + "fields": [ + {"data": "data_0", "field": "c"}, + {"data": "data_2", "field": "c"}, + {"data": "data_3", "field": "c"}, + {"data": "data_4", "field": "c"}, + {"data": "data_5", "field": "c"} + ] + }, + "range": [0.3, 0.8], + "zero": false + }, + { + "name": "concat_0_concat_0_x", + "type": "linear", + "domain": {"data": "data_0", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_0_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_1_x", + "type": "linear", + "domain": {"data": "data_2", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false, + "padding": 5 + }, + { + "name": "concat_0_concat_1_y", + "type": "linear", + "domain": {"data": "data_2", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_2_x", + "type": "linear", + "domain": {"data": "data_0", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_2_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_3_x", + "type": "linear", + "domain": {"data": "data_3", "field": "a"}, + "range": [0, {"signal": "childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_3_y", + "type": "linear", + "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_0_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_0_x", + "type": "point", + "domain": {"data": "data_0", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_0_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_1_x", + "type": "band", + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "concat_1_concat_1_y", + "type": "linear", + "domain": {"data": "data_4", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_2_x", + "type": "point", + "domain": {"data": "data_0", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_2_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_3_x", + "type": "point", + "domain": {"data": "data_5", "field": "a", "sort": true}, + "range": [0, {"signal": "childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_3_y", + "type": "linear", + "domain": {"data": "data_5", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "concat_1_childHeight"}, 0], + "nice": true, + "zero": true + } + ], + "legends": [ + { + "opacity": "opacity", + "symbolType": "circle", + "title": "c", + "encode": { + "symbols": { + "update": { + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"} + } + } + } + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/test_invalid_show.png b/examples/compiled/test_invalid_show.png new file mode 100644 index 0000000000..a1a5de1321 Binary files /dev/null and b/examples/compiled/test_invalid_show.png differ diff --git a/examples/compiled/test_invalid_show.svg b/examples/compiled/test_invalid_show.svg new file mode 100644 index 0000000000..f4635611ae --- /dev/null +++ b/examples/compiled/test_invalid_show.svg @@ -0,0 +1 @@ +−10−50510a050100b−10010a050100b−10−50510a050100b−10−50510a050100bQuantitative Xnull-10-5-101510a050100bnull-10-5-101510a050100bnull-10-5-101510a050100bnull-10-5-101510a050100bOrdinal X \ No newline at end of file diff --git a/examples/compiled/test_invalid_show.vg.json b/examples/compiled/test_invalid_show.vg.json new file mode 100644 index 0000000000..d4134b54da --- /dev/null +++ b/examples/compiled/test_invalid_show.vg.json @@ -0,0 +1,982 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Testing invalid", + "background": "white", + "padding": 5, + "data": [ + { + "name": "source_0", + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + {"type": "formula", "expr": "toNumber(datum[\"a\"])", "as": "a"} + ] + }, + { + "name": "data_2", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_3", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": [], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_4", + "source": "data_0", + "transform": [ + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + }, + { + "name": "data_5", + "source": "data_0", + "transform": [ + { + "type": "impute", + "field": "b", + "groupby": [], + "key": "a", + "method": "value", + "value": 0 + }, + { + "type": "stack", + "groupby": ["a"], + "field": "b", + "sort": {"field": [], "order": []}, + "as": ["b_start", "b_end"], + "offset": "zero" + } + ] + } + ], + "signals": [ + {"name": "childHeight", "value": 100}, + {"name": "concat_0_childWidth", "value": 100}, + {"name": "concat_1_childWidth", "value": 100} + ], + "layout": {"padding": 20, "columns": 1, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_group", + "title": {"text": "Quantitative X", "anchor": "start"}, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_0_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "scale": "concat_0_concat_0_x", + "value": 0 + }, + {"scale": "concat_0_concat_0_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_0_concat_0_y", + "value": 0 + }, + {"scale": "concat_0_concat_0_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "gridScale": "concat_0_concat_0_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "gridScale": "concat_0_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_2"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "xc": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_1_x', inrange(0, domain('concat_0_concat_1_x')) ? 0 : domain('concat_0_concat_1_x')[0])" + }, + {"scale": "concat_0_concat_1_x", "field": "a"} + ], + "width": {"value": 5}, + "y": {"scale": "concat_0_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "gridScale": "concat_0_concat_1_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "gridScale": "concat_0_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": {"data": "data_0"}, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_2_x', inrange(0, domain('concat_0_concat_2_x')) ? 0 : domain('concat_0_concat_2_x')[0])" + }, + {"scale": "concat_0_concat_2_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_0_concat_2_y", + "value": 0 + }, + {"scale": "concat_0_concat_2_y", "field": "b"} + ] + } + } + }, + { + "name": "concat_0_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_2_x', inrange(0, domain('concat_0_concat_2_x')) ? 0 : domain('concat_0_concat_2_x')[0])" + }, + {"scale": "concat_0_concat_2_x", "field": "a"} + ], + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_0_concat_2_y", + "value": 0 + }, + {"scale": "concat_0_concat_2_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "gridScale": "concat_0_concat_2_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "gridScale": "concat_0_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_0_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_0_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_0_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "data_3"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": format(datum[\"a\"], \"\"), \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": [ + { + "test": "!isValid(datum[\"a\"]) || !isFinite(+datum[\"a\"])", + "signal": "scale('concat_0_concat_3_x', inrange(0, domain('concat_0_concat_3_x')) ? 0 : domain('concat_0_concat_3_x')[0])" + }, + {"scale": "concat_0_concat_3_x", "field": "a"} + ], + "y": {"scale": "concat_0_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_0_concat_3_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "gridScale": "concat_0_concat_3_y", + "grid": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "gridScale": "concat_0_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelFlush": true, + "labelOverlap": true, + "tickCount": {"signal": "ceil(concat_0_childWidth/40)"}, + "zindex": 0 + }, + { + "scale": "concat_0_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + }, + { + "type": "group", + "name": "concat_1_group", + "title": {"text": "Ordinal X", "anchor": "start"}, + "layout": {"padding": 20, "bounds": "full", "align": "each"}, + "marks": [ + { + "type": "group", + "name": "concat_1_concat_0_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_0_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 0.7}, + "fill": {"value": "transparent"}, + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_0_x", "field": "a"}, + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_1_concat_0_y", + "value": 0 + }, + {"scale": "concat_1_concat_0_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "gridScale": "concat_1_concat_0_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_0_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_1_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_1_marks", + "type": "rect", + "style": ["bar"], + "from": {"data": "data_4"}, + "encode": { + "update": { + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "bar"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_1_x", "field": "a"}, + "width": { + "signal": "max(0.25, bandwidth('concat_1_concat_1_x'))" + }, + "y": {"scale": "concat_1_concat_1_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_1_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "gridScale": "concat_1_concat_1_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_1_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_2_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_2_layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": {"data": "data_0"}, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_1_concat_2_y", + "value": 0 + }, + {"scale": "concat_1_concat_2_y", "field": "b"} + ] + } + } + }, + { + "name": "concat_1_concat_2_layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_0"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_2_x", "field": "a"}, + "y": [ + { + "test": "!isValid(datum[\"b\"]) || !isFinite(+datum[\"b\"])", + "scale": "concat_1_concat_2_y", + "value": 0 + }, + {"scale": "concat_1_concat_2_y", "field": "b"} + ] + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "gridScale": "concat_1_concat_2_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_2_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + }, + { + "type": "group", + "name": "concat_1_concat_3_group", + "style": "cell", + "encode": { + "update": { + "width": {"signal": "concat_1_childWidth"}, + "height": {"signal": "childHeight"} + } + }, + "marks": [ + { + "name": "concat_1_concat_3_marks", + "type": "area", + "style": ["area"], + "sort": {"field": "x"}, + "from": {"data": "data_5"}, + "encode": { + "update": { + "orient": {"value": "vertical"}, + "fill": {"value": "#4c78a8"}, + "tooltip": { + "signal": "{\"a\": isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"], \"b\": format(datum[\"b\"], \"\")}" + }, + "description": { + "signal": "\"a: \" + (isValid(datum[\"a\"]) ? datum[\"a\"] : \"\"+datum[\"a\"]) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "concat_1_concat_3_x", "field": "a"}, + "y": {"scale": "concat_1_concat_3_y", "field": "b_end"}, + "y2": {"scale": "concat_1_concat_3_y", "field": "b_start"} + } + } + } + ], + "axes": [ + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "gridScale": "concat_1_concat_3_x", + "grid": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "domain": false, + "labels": false, + "aria": false, + "maxExtent": 0, + "minExtent": 0, + "ticks": false, + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_x", + "orient": "bottom", + "grid": false, + "title": "a", + "labelAlign": "right", + "labelAngle": 270, + "labelBaseline": "middle", + "zindex": 0 + }, + { + "scale": "concat_1_concat_3_y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(childHeight/40)"}, + "zindex": 0 + } + ] + } + ] + } + ], + "scales": [ + { + "name": "concat_0_concat_0_x", + "type": "linear", + "domain": {"data": "data_0", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_0_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_1_x", + "type": "linear", + "domain": {"data": "data_2", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": false, + "padding": 5 + }, + { + "name": "concat_0_concat_1_y", + "type": "linear", + "domain": {"data": "data_2", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_2_x", + "type": "linear", + "domain": {"data": "data_0", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_2_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_0_concat_3_x", + "type": "linear", + "domain": {"data": "data_3", "field": "a"}, + "range": [0, {"signal": "concat_0_childWidth"}], + "nice": true, + "zero": false + }, + { + "name": "concat_0_concat_3_y", + "type": "linear", + "domain": {"data": "data_3", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_0_x", + "type": "point", + "domain": {"data": "data_0", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_0_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_1_x", + "type": "band", + "domain": {"data": "data_4", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "paddingInner": 0.1, + "paddingOuter": 0.05 + }, + { + "name": "concat_1_concat_1_y", + "type": "linear", + "domain": {"data": "data_4", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_2_x", + "type": "point", + "domain": {"data": "data_0", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_2_y", + "type": "linear", + "domain": {"data": "data_0", "field": "b"}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + }, + { + "name": "concat_1_concat_3_x", + "type": "point", + "domain": {"data": "data_5", "field": "a", "sort": true}, + "range": [0, {"signal": "concat_1_childWidth"}], + "padding": 0.5 + }, + { + "name": "concat_1_concat_3_y", + "type": "linear", + "domain": {"data": "data_5", "fields": ["b_start", "b_end"]}, + "range": [{"signal": "childHeight"}, 0], + "nice": true, + "zero": true + } + ], + "config": {"mark": {"tooltip": true}} +} diff --git a/examples/compiled/trail_comet.vg.json b/examples/compiled/trail_comet.vg.json index c98611f715..a003de90f3 100644 --- a/examples/compiled/trail_comet.vg.json +++ b/examples/compiled/trail_comet.vg.json @@ -159,7 +159,10 @@ }, "x": {"scale": "x", "field": "year"}, "y": {"scale": "y", "field": "variety"}, - "size": {"scale": "size", "field": "yield"} + "size": {"scale": "size", "field": "yield"}, + "defined": { + "signal": "isValid(datum[\"delta\"]) && isFinite(+datum[\"delta\"]) && isValid(datum[\"yield\"]) && isFinite(+datum[\"yield\"])" + } } } } diff --git a/examples/compiled/trellis_area_seattle.vg.json b/examples/compiled/trellis_area_seattle.vg.json index a4b1619cbb..b8f0d14013 100644 --- a/examples/compiled/trellis_area_seattle.vg.json +++ b/examples/compiled/trellis_area_seattle.vg.json @@ -170,7 +170,9 @@ }, "x": {"scale": "x", "field": "monthdate_date"}, "y": {"scale": "y", "field": "mean_temperature"}, - "y2": {"field": {"group": "height"}}, + "y2": { + "signal": "scale('y', inrange(0, domain('y')) ? 0 : domain('y')[0])" + }, "defined": { "signal": "isValid(datum[\"monthdate_date\"]) && isFinite(+datum[\"monthdate_date\"]) && isValid(datum[\"mean_temperature\"]) && isFinite(+datum[\"mean_temperature\"])" } diff --git a/examples/compiled/window_impute_null.png b/examples/compiled/window_impute_null.png new file mode 100644 index 0000000000..b452c85025 Binary files /dev/null and b/examples/compiled/window_impute_null.png differ diff --git a/examples/compiled/window_impute_null.svg b/examples/compiled/window_impute_null.svg new file mode 100644 index 0000000000..be0e300c8c --- /dev/null +++ b/examples/compiled/window_impute_null.svg @@ -0,0 +1 @@ +01 Jan02 Jan03 Jan04 Jan05 Jan06 Jan07 Jan08 Jana (year-month-date)0102030405060b \ No newline at end of file diff --git a/examples/compiled/window_impute_null.vg.json b/examples/compiled/window_impute_null.vg.json new file mode 100644 index 0000000000..922f6c5453 --- /dev/null +++ b/examples/compiled/window_impute_null.vg.json @@ -0,0 +1,182 @@ +{ + "$schema": "https://vega.github.io/schema/vega/v5.json", + "description": "Using window transform to impute missing values in a line chart by averaging the previous and next values.", + "background": "white", + "padding": 5, + "width": 300, + "height": 200, + "style": "cell", + "data": [ + { + "name": "source_0", + "values": [ + {"a": "Jan 1, 2000", "b": 28}, + {"a": "Jan 2, 2000", "b": 55}, + {"a": "Jan 3, 2000", "b": null}, + {"a": "Jan 4, 2000", "b": 65}, + {"a": "Jan 5, 2000", "b": 43}, + {"a": "Jan 6, 2000", "b": null}, + {"a": "Jan 7, 2000", "b": 55}, + {"a": "Jan 8, 2000", "b": 43} + ] + }, + { + "name": "data_0", + "source": "source_0", + "transform": [ + {"type": "formula", "expr": "toDate(datum[\"a\"])", "as": "a"}, + { + "type": "window", + "params": [null, null], + "as": ["prev", "next"], + "ops": ["lag", "lead"], + "fields": ["b", "b"], + "sort": {"field": [], "order": []} + }, + { + "type": "formula", + "expr": "datum.b === null ? (datum.prev + datum.next)/2 : datum.b", + "as": "b" + }, + { + "field": "a", + "type": "timeunit", + "units": ["year", "month", "date"], + "as": ["yearmonthdate_a", "yearmonthdate_a_end"] + } + ] + }, + { + "name": "data_1", + "source": "data_0", + "transform": [ + { + "type": "filter", + "expr": "(isDate(datum[\"yearmonthdate_a\"]) || (isValid(datum[\"yearmonthdate_a\"]) && isFinite(+datum[\"yearmonthdate_a\"]))) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + ] + } + ], + "marks": [ + { + "name": "layer_0_marks", + "type": "line", + "style": ["line"], + "sort": {"field": "x"}, + "from": {"data": "data_0"}, + "encode": { + "update": { + "stroke": {"value": "#4c78a8"}, + "description": { + "signal": "\"a (year-month-date): \" + (timeFormat(datum[\"yearmonthdate_a\"], '%d %b')) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "x", "field": "yearmonthdate_a"}, + "y": {"scale": "y", "field": "b"}, + "defined": { + "signal": "isValid(datum[\"yearmonthdate_a\"]) && isFinite(+datum[\"yearmonthdate_a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" + } + } + } + }, + { + "name": "layer_1_marks", + "type": "symbol", + "style": ["point"], + "from": {"data": "data_1"}, + "encode": { + "update": { + "opacity": {"value": 1}, + "fill": {"value": "#4c78a8"}, + "ariaRoleDescription": {"value": "point"}, + "description": { + "signal": "\"a (year-month-date): \" + (timeFormat(datum[\"yearmonthdate_a\"], '%d %b')) + \"; b: \" + (format(datum[\"b\"], \"\"))" + }, + "x": {"scale": "x", "field": "yearmonthdate_a"}, + "y": {"scale": "y", "field": "b"} + } + } + } + ], + "scales": [ + { + "name": "x", + "type": "time", + "domain": { + "fields": [ + {"data": "data_0", "field": "yearmonthdate_a"}, + {"data": "data_1", "field": "yearmonthdate_a"} + ] + }, + "range": [0, {"signal": "width"}] + }, + { + "name": "y", + "type": "linear", + "domain": { + "fields": [ + {"data": "data_0", "field": "b"}, + {"data": "data_1", "field": "b"} + ] + }, + "range": [{"signal": "height"}, 0], + "nice": true, + "zero": true + } + ], + "axes": [ + { + "scale": "x", + "orient": "bottom", + "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, + "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 (year-month-date)", + "format": "%d %b", + "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 + }, + { + "scale": "y", + "orient": "left", + "grid": false, + "title": "b", + "labelOverlap": true, + "tickCount": {"signal": "ceil(height/40)"}, + "zindex": 0 + } + ] +} diff --git a/examples/specs/bar_invalid_color_show.vl.json b/examples/specs/bar_invalid_color_show.vl.json new file mode 100644 index 0000000000..0db82ee42f --- /dev/null +++ b/examples/specs/bar_invalid_color_show.vl.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "show", "tooltip": true} + }, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } +} diff --git a/examples/specs/bar_invalid_color_show_override.vl.json b/examples/specs/bar_invalid_color_show_override.vl.json new file mode 100644 index 0000000000..83f8874078 --- /dev/null +++ b/examples/specs/bar_invalid_color_show_override.vl.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "show", "tooltip": true}, + "scale": {"invalid": {"color": {"value": "red"}}} + }, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } +} diff --git a/examples/specs/layer_null_data.vl.json b/examples/specs/layer_null_data.vl.json new file mode 100644 index 0000000000..a095651c3f --- /dev/null +++ b/examples/specs/layer_null_data.vl.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "width": 300, + "data": { + "values": [ + {"a": "Jan 1, 2000", "b": 28}, + {"a": "Jan 2, 2000", "b": 55}, + {"a": "Jan 3, 2000", "b": null}, + {"a": "Jan 4, 2000", "b": 55}, + {"a": "Jan 5, 2000", "b": 43}, + {"a": "Jan 6, 2000", "b": null}, + {"a": "Jan 7, 2000", "b": 55}, + {"a": "Jan 8, 2000", "b": 43} + ] + }, + "layer": [{ + "mark": "line", + "encoding": { + "x": {"timeUnit": "yearmonthdate", "field": "a", "type": "temporal", "axis": {"format": "%d %b"}}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "transform": [{"filter": "datum.b === null"}], + "mark": {"type": "bar", "color": "red", "opacity": 0.2}, + "encoding": { + "x": {"timeUnit": "yearmonthdate", "field": "a", "type": "temporal", "bandPosition": 0} + } + }] +} diff --git a/examples/specs/normalized/test_invalid_break_paths_filter_domains_normalized.vl.json b/examples/specs/normalized/test_invalid_break_paths_filter_domains_normalized.vl.json new file mode 100644 index 0000000000..542bbe9ea1 --- /dev/null +++ b/examples/specs/normalized/test_invalid_break_paths_filter_domains_normalized.vl.json @@ -0,0 +1,125 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + "config": { + "mark": {"invalid": "break-paths-filter-domains", "tooltip": true} + }, + "vconcat": [ + { + "title": "Quantitative X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/test_invalid_break_paths_show_domains_normalized.vl.json b/examples/specs/normalized/test_invalid_break_paths_show_domains_normalized.vl.json new file mode 100644 index 0000000000..2d51b7b913 --- /dev/null +++ b/examples/specs/normalized/test_invalid_break_paths_show_domains_normalized.vl.json @@ -0,0 +1,123 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + "config": {"mark": {"invalid": "break-paths-show-domains", "tooltip": true}}, + "vconcat": [ + { + "title": "Quantitative X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/test_invalid_break_paths_show_path_domains_normalized.vl.json b/examples/specs/normalized/test_invalid_break_paths_show_path_domains_normalized.vl.json new file mode 100644 index 0000000000..ad839271ab --- /dev/null +++ b/examples/specs/normalized/test_invalid_break_paths_show_path_domains_normalized.vl.json @@ -0,0 +1,125 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + "config": { + "mark": {"invalid": "break-paths-show-path-domains", "tooltip": true} + }, + "vconcat": [ + { + "title": "Quantitative X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/test_invalid_color_filter_but_include_in_scale_invalid_normalized.vl.json b/examples/specs/normalized/test_invalid_color_filter_but_include_in_scale_invalid_normalized.vl.json new file mode 100644 index 0000000000..96307c713e --- /dev/null +++ b/examples/specs/normalized/test_invalid_color_filter_but_include_in_scale_invalid_normalized.vl.json @@ -0,0 +1,137 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "filter", "tooltip": true}, + "scale": {"invalid": {"color": {"value": "red"}}} + }, + "hconcat": [ + { + "title": "Quantitative X", + "vconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "vconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/test_invalid_color_filter_normalized.vl.json b/examples/specs/normalized/test_invalid_color_filter_normalized.vl.json new file mode 100644 index 0000000000..0f8be2c736 --- /dev/null +++ b/examples/specs/normalized/test_invalid_color_filter_normalized.vl.json @@ -0,0 +1,134 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": {"mark": {"invalid": "filter", "tooltip": true}}, + "hconcat": [ + { + "title": "Quantitative X", + "vconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "vconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/test_invalid_color_show_normalized.vl.json b/examples/specs/normalized/test_invalid_color_show_normalized.vl.json new file mode 100644 index 0000000000..7a0404e09b --- /dev/null +++ b/examples/specs/normalized/test_invalid_color_show_normalized.vl.json @@ -0,0 +1,134 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": {"mark": {"invalid": "show", "tooltip": true}}, + "hconcat": [ + { + "title": "Quantitative X", + "vconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "vconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/test_invalid_default_normalized.vl.json b/examples/specs/normalized/test_invalid_default_normalized.vl.json new file mode 100644 index 0000000000..2de1cae60e --- /dev/null +++ b/examples/specs/normalized/test_invalid_default_normalized.vl.json @@ -0,0 +1,123 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + "config": {"mark": {"tooltip": true}}, + "vconcat": [ + { + "title": "Quantitative X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/test_invalid_filter_normalized.vl.json b/examples/specs/normalized/test_invalid_filter_normalized.vl.json new file mode 100644 index 0000000000..ace0547c2a --- /dev/null +++ b/examples/specs/normalized/test_invalid_filter_normalized.vl.json @@ -0,0 +1,123 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + "config": {"mark": {"invalid": "filter", "tooltip": true}}, + "vconcat": [ + { + "title": "Quantitative X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/test_invalid_null_normalized.vl.json b/examples/specs/normalized/test_invalid_null_normalized.vl.json new file mode 100644 index 0000000000..b652b812af --- /dev/null +++ b/examples/specs/normalized/test_invalid_null_normalized.vl.json @@ -0,0 +1,123 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + "config": {"mark": {"invalid": null, "tooltip": true}}, + "vconcat": [ + { + "title": "Quantitative X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/test_invalid_opacity_filter_but_include_in_scale_invalid_normalized.vl.json b/examples/specs/normalized/test_invalid_opacity_filter_but_include_in_scale_invalid_normalized.vl.json new file mode 100644 index 0000000000..28f6354c2c --- /dev/null +++ b/examples/specs/normalized/test_invalid_opacity_filter_but_include_in_scale_invalid_normalized.vl.json @@ -0,0 +1,137 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "filter", "tooltip": true}, + "scale": {"invalid": {"opacity": {"value": 0.1}}} + }, + "hconcat": [ + { + "title": "Quantitative X", + "vconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "vconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/test_invalid_opacity_filter_normalized.vl.json b/examples/specs/normalized/test_invalid_opacity_filter_normalized.vl.json new file mode 100644 index 0000000000..6c72e57832 --- /dev/null +++ b/examples/specs/normalized/test_invalid_opacity_filter_normalized.vl.json @@ -0,0 +1,134 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": {"mark": {"invalid": "filter", "tooltip": true}}, + "hconcat": [ + { + "title": "Quantitative X", + "vconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "vconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/test_invalid_opacity_show_normalized.vl.json b/examples/specs/normalized/test_invalid_opacity_show_normalized.vl.json new file mode 100644 index 0000000000..07d0725c4b --- /dev/null +++ b/examples/specs/normalized/test_invalid_opacity_show_normalized.vl.json @@ -0,0 +1,134 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": {"mark": {"invalid": "show", "tooltip": true}}, + "hconcat": [ + { + "title": "Quantitative X", + "vconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "vconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/test_invalid_show_normalized.vl.json b/examples/specs/normalized/test_invalid_show_normalized.vl.json new file mode 100644 index 0000000000..cf661abf9c --- /dev/null +++ b/examples/specs/normalized/test_invalid_show_normalized.vl.json @@ -0,0 +1,123 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + "config": {"mark": {"invalid": "show", "tooltip": true}}, + "vconcat": [ + { + "title": "Quantitative X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "title": "Ordinal X", + "hconcat": [ + { + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "width": 100, + "height": 100, + "layer": [ + { + "mark": "line", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + }, + { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/specs/normalized/window_impute_null_normalized.vl.json b/examples/specs/normalized/window_impute_null_normalized.vl.json new file mode 100644 index 0000000000..da3c95fced --- /dev/null +++ b/examples/specs/normalized/window_impute_null_normalized.vl.json @@ -0,0 +1,55 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Using window transform to impute missing values in a line chart by averaging the previous and next values.", + "width": 300, + "data": { + "values": [ + {"a": "Jan 1, 2000", "b": 28}, + {"a": "Jan 2, 2000", "b": 55}, + {"a": "Jan 3, 2000", "b": null}, + {"a": "Jan 4, 2000", "b": 65}, + {"a": "Jan 5, 2000", "b": 43}, + {"a": "Jan 6, 2000", "b": null}, + {"a": "Jan 7, 2000", "b": 55}, + {"a": "Jan 8, 2000", "b": 43} + ] + }, + "transform": [ + { + "window": [ + {"op": "lag", "field": "b", "as": "prev"}, + {"op": "lead", "field": "b", "as": "next"} + ] + }, + { + "calculate": "datum.b === null ? (datum.prev + datum.next)/2 : datum.b", + "as": "b" + } + ], + "layer": [ + { + "mark": "line", + "encoding": { + "x": { + "timeUnit": {"unit": "yearmonthdate"}, + "field": "a", + "type": "temporal", + "axis": {"format": "%d %b"} + }, + "y": {"field": "b", "type": "quantitative"} + } + }, + { + "mark": {"type": "point", "opacity": 1, "filled": true}, + "encoding": { + "x": { + "timeUnit": {"unit": "yearmonthdate"}, + "field": "a", + "type": "temporal", + "axis": {"format": "%d %b"} + }, + "y": {"field": "b", "type": "quantitative"} + } + } + ] +} \ No newline at end of file diff --git a/examples/specs/point_invalid_size_show.vl.json b/examples/specs/point_invalid_size_show.vl.json new file mode 100644 index 0000000000..14d656d08a --- /dev/null +++ b/examples/specs/point_invalid_size_show.vl.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "show"} + }, + "concat": [{ + "title": "Quantitative X", + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "size": {"field": "c", "type": "quantitative"} + } + }] +} diff --git a/examples/specs/test_invalid_break_paths_filter_domains.vl.json b/examples/specs/test_invalid_break_paths_filter_domains.vl.json new file mode 100644 index 0000000000..f227bb9bb2 --- /dev/null +++ b/examples/specs/test_invalid_break_paths_filter_domains.vl.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + "config": { + "mark": {"invalid": "break-paths-filter-domains", "tooltip": true} + }, + "vconcat": [{ + "title": "Quantitative X", + "hconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }] + },{ + "title": "Ordinal X", + "hconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }] + }] +} diff --git a/examples/specs/test_invalid_break_paths_show_domains.vl.json b/examples/specs/test_invalid_break_paths_show_domains.vl.json new file mode 100644 index 0000000000..5c8fae98dd --- /dev/null +++ b/examples/specs/test_invalid_break_paths_show_domains.vl.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + "config": { + "mark": {"invalid": "break-paths-show-domains", "tooltip": true} + }, + "vconcat": [{ + "title": "Quantitative X", + "hconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }] + },{ + "title": "Ordinal X", + "hconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }] + }] +} diff --git a/examples/specs/test_invalid_break_paths_show_path_domains.vl.json b/examples/specs/test_invalid_break_paths_show_path_domains.vl.json new file mode 100644 index 0000000000..27f77a7c34 --- /dev/null +++ b/examples/specs/test_invalid_break_paths_show_path_domains.vl.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + "config": { + "mark": {"invalid": "break-paths-show-path-domains", "tooltip": true} + }, + "vconcat": [{ + "title": "Quantitative X", + "hconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }] + },{ + "title": "Ordinal X", + "hconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }] + }] +} diff --git a/examples/specs/test_invalid_color_filter.vl.json b/examples/specs/test_invalid_color_filter.vl.json new file mode 100644 index 0000000000..226a0ac82b --- /dev/null +++ b/examples/specs/test_invalid_color_filter.vl.json @@ -0,0 +1,99 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "filter", "tooltip": true} + }, + "hconcat": [{ + "title": "Quantitative X", + "vconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }] + },{ + "title": "Ordinal X", + "vconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }] + }] +} diff --git a/examples/specs/test_invalid_color_filter_but_include_in_scale_invalid.vl.json b/examples/specs/test_invalid_color_filter_but_include_in_scale_invalid.vl.json new file mode 100644 index 0000000000..8b720cb5cf --- /dev/null +++ b/examples/specs/test_invalid_color_filter_but_include_in_scale_invalid.vl.json @@ -0,0 +1,100 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "filter", "tooltip": true}, + "scale": {"invalid": {"color": {"value": "red"}}} + }, + "hconcat": [{ + "title": "Quantitative X", + "vconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }] + },{ + "title": "Ordinal X", + "vconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }] + }] +} diff --git a/examples/specs/test_invalid_color_show.vl.json b/examples/specs/test_invalid_color_show.vl.json new file mode 100644 index 0000000000..3cbf5d5fa3 --- /dev/null +++ b/examples/specs/test_invalid_color_show.vl.json @@ -0,0 +1,99 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "show", "tooltip": true} + }, + "hconcat": [{ + "title": "Quantitative X", + "vconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }] + },{ + "title": "Ordinal X", + "vconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }] + }] +} diff --git a/examples/specs/test_invalid_color_size_config_scale.vl.json b/examples/specs/test_invalid_color_size_config_scale.vl.json new file mode 100644 index 0000000000..89abb80964 --- /dev/null +++ b/examples/specs/test_invalid_color_size_config_scale.vl.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "filter", "tooltip": true}, + "scale": {"invalid": {"color": {"value": "#aaa"}, "size": {"value": 4}}} + }, + "concat": [{ + "title": "Color", + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "title": "Size", + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "size": {"field": "c", "type": "quantitative"} + } + }] +} diff --git a/examples/specs/test_invalid_color_size_mark_filter_only.vl.json b/examples/specs/test_invalid_color_size_mark_filter_only.vl.json new file mode 100644 index 0000000000..14cb0ef173 --- /dev/null +++ b/examples/specs/test_invalid_color_size_mark_filter_only.vl.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "filter", "tooltip": true} + }, + "concat": [{ + "title": "Color", + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "title": "Size", + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "size": {"field": "c", "type": "quantitative"} + } + }] +} diff --git a/examples/specs/test_invalid_color_size_mark_show_only.vl.json b/examples/specs/test_invalid_color_size_mark_show_only.vl.json new file mode 100644 index 0000000000..0d9ba9f132 --- /dev/null +++ b/examples/specs/test_invalid_color_size_mark_show_only.vl.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "show", "tooltip": true} + }, + "concat": [{ + "title": "Color", + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "color": {"field": "c", "type": "quantitative"} + } + }, { + "title": "Size", + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "size": {"field": "c", "type": "quantitative"} + } + }] +} diff --git a/examples/specs/test_invalid_default.vl.json b/examples/specs/test_invalid_default.vl.json index 833dc2bd82..2d16f83c3b 100644 --- a/examples/specs/test_invalid_default.vl.json +++ b/examples/specs/test_invalid_default.vl.json @@ -3,19 +3,20 @@ "description": "Testing invalid", "data": { "values": [ - {"a": null, "b": 1000}, + {"a": null, "b": 100}, {"a": -10, "b": null}, - {"a": -5, "b": 25}, - {"a": -1, "b": 20}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, {"a": 0, "b": null}, {"a": 1, "b": 30}, {"a": 5, "b": 40}, {"a": 10, "b": null} ] }, - "hconcat": [{ + "config": {"mark": {"tooltip": true}}, + "vconcat": [{ "title": "Quantitative X", - "vconcat": [{ + "hconcat": [{ "width": 100, "height": 100, "mark": "point", @@ -34,7 +35,7 @@ }, { "width": 100, "height": 100, - "mark": "line", + "mark": {"type": "line", "point": true}, "encoding": { "x": {"field": "a", "type": "quantitative"}, "y": {"field": "b", "type": "quantitative"} @@ -50,7 +51,7 @@ }] },{ "title": "Ordinal X", - "vconcat": [{ + "hconcat": [{ "width": 100, "height": 100, "mark": "point", @@ -69,7 +70,7 @@ }, { "width": 100, "height": 100, - "mark": "line", + "mark": {"type": "line", "point": true}, "encoding": { "x": {"field": "a", "type": "ordinal"}, "y": {"field": "b", "type": "quantitative"} diff --git a/examples/specs/test_invalid_filter.vl.json b/examples/specs/test_invalid_filter.vl.json index 6b904d8a4b..db2c92270d 100644 --- a/examples/specs/test_invalid_filter.vl.json +++ b/examples/specs/test_invalid_filter.vl.json @@ -3,10 +3,10 @@ "description": "Testing invalid", "data": { "values": [ - {"a": null, "b": 1000}, + {"a": null, "b": 100}, {"a": -10, "b": null}, - {"a": -5, "b": 25}, - {"a": -1, "b": 20}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, {"a": 0, "b": null}, {"a": 1, "b": 30}, {"a": 5, "b": 40}, @@ -14,11 +14,11 @@ ] }, "config": { - "mark": {"invalid": "filter"} + "mark": {"invalid": "filter", "tooltip": true} }, - "hconcat": [{ + "vconcat": [{ "title": "Quantitative X", - "vconcat": [{ + "hconcat": [{ "width": 100, "height": 100, "mark": "point", @@ -37,7 +37,7 @@ }, { "width": 100, "height": 100, - "mark": "line", + "mark": {"type": "line", "point": true}, "encoding": { "x": {"field": "a", "type": "quantitative"}, "y": {"field": "b", "type": "quantitative"} @@ -53,7 +53,7 @@ }] },{ "title": "Ordinal X", - "vconcat": [{ + "hconcat": [{ "width": 100, "height": 100, "mark": "point", @@ -72,7 +72,7 @@ }, { "width": 100, "height": 100, - "mark": "line", + "mark": {"type": "line", "point": true}, "encoding": { "x": {"field": "a", "type": "ordinal"}, "y": {"field": "b", "type": "quantitative"} diff --git a/examples/specs/test_invalid_null.vl.json b/examples/specs/test_invalid_null.vl.json index b389d96ca4..fd8eecd079 100644 --- a/examples/specs/test_invalid_null.vl.json +++ b/examples/specs/test_invalid_null.vl.json @@ -3,10 +3,10 @@ "description": "Testing invalid", "data": { "values": [ - {"a": null, "b": 1000}, + {"a": null, "b": 100}, {"a": -10, "b": null}, - {"a": -5, "b": 25}, - {"a": -1, "b": 20}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, {"a": 0, "b": null}, {"a": 1, "b": 30}, {"a": 5, "b": 40}, @@ -14,11 +14,11 @@ ] }, "config": { - "mark": {"invalid": null} + "mark": {"invalid": null, "tooltip": true} }, - "hconcat": [{ + "vconcat": [{ "title": "Quantitative X", - "vconcat": [{ + "hconcat": [{ "width": 100, "height": 100, "mark": "point", @@ -37,7 +37,7 @@ }, { "width": 100, "height": 100, - "mark": "line", + "mark": {"type": "line", "point": true}, "encoding": { "x": {"field": "a", "type": "quantitative"}, "y": {"field": "b", "type": "quantitative"} @@ -53,7 +53,7 @@ }] },{ "title": "Ordinal X", - "vconcat": [{ + "hconcat": [{ "width": 100, "height": 100, "mark": "point", @@ -72,7 +72,7 @@ }, { "width": 100, "height": 100, - "mark": "line", + "mark": {"type": "line", "point": true}, "encoding": { "x": {"field": "a", "type": "ordinal"}, "y": {"field": "b", "type": "quantitative"} diff --git a/examples/specs/test_invalid_opacity_filter.vl.json b/examples/specs/test_invalid_opacity_filter.vl.json new file mode 100644 index 0000000000..549069f712 --- /dev/null +++ b/examples/specs/test_invalid_opacity_filter.vl.json @@ -0,0 +1,99 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "filter", "tooltip": true} + }, + "hconcat": [{ + "title": "Quantitative X", + "vconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }] + },{ + "title": "Ordinal X", + "vconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }] + }] +} diff --git a/examples/specs/test_invalid_opacity_filter_but_include_in_scale_invalid.vl.json b/examples/specs/test_invalid_opacity_filter_but_include_in_scale_invalid.vl.json new file mode 100644 index 0000000000..61db197bca --- /dev/null +++ b/examples/specs/test_invalid_opacity_filter_but_include_in_scale_invalid.vl.json @@ -0,0 +1,100 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "filter", "tooltip": true}, + "scale": {"invalid": {"opacity": {"value": 0.1}}} + }, + "hconcat": [{ + "title": "Quantitative X", + "vconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }] + },{ + "title": "Ordinal X", + "vconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }] + }] +} diff --git a/examples/specs/test_invalid_opacity_show.vl.json b/examples/specs/test_invalid_opacity_show.vl.json new file mode 100644 index 0000000000..9720bc5818 --- /dev/null +++ b/examples/specs/test_invalid_opacity_show.vl.json @@ -0,0 +1,99 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": 1, "b": 15, "c": 1}, + {"a": 2, "b": 25, "c": 1}, + {"a": 3, "b": 20, "c": 1}, + {"a": 1, "b": 12, "c": 2}, + {"a": 2, "b": 21, "c": 2}, + {"a": 3, "b": 29, "c": 2}, + {"a": 1, "b": 8, "c": null}, + {"a": 2, "b": 31, "c": null}, + {"a": 3, "b": 49, "c": null} + ] + }, + "config": { + "mark": {"invalid": "show", "tooltip": true} + }, + "hconcat": [{ + "title": "Quantitative X", + "vconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }] + },{ + "title": "Ordinal X", + "vconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"}, + "opacity": {"field": "c", "type": "quantitative"} + } + }] + }] +} diff --git a/examples/specs/test_invalid_show.vl.json b/examples/specs/test_invalid_show.vl.json new file mode 100644 index 0000000000..6acafb9241 --- /dev/null +++ b/examples/specs/test_invalid_show.vl.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Testing invalid", + "data": { + "values": [ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} + ] + }, + "config": { + "mark": {"invalid": "show", "tooltip": true} + }, + "vconcat": [{ + "title": "Quantitative X", + "hconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "quantitative"}, + "y": {"field": "b", "type": "quantitative"} + } + }] + },{ + "title": "Ordinal X", + "hconcat": [{ + "width": 100, + "height": 100, + "mark": "point", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "bar", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }, { + "width": 100, + "height": 100, + "mark": "area", + "encoding": { + "x": {"field": "a", "type": "ordinal"}, + "y": {"field": "b", "type": "quantitative"} + } + }] + }] +} diff --git a/examples/specs/window_impute_null.vl.json b/examples/specs/window_impute_null.vl.json new file mode 100644 index 0000000000..cfe3da858d --- /dev/null +++ b/examples/specs/window_impute_null.vl.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "description": "Using window transform to impute missing values in a line chart by averaging the previous and next values.", + "width": 300, + "data": { + "values": [ + {"a": "Jan 1, 2000", "b": 28}, + {"a": "Jan 2, 2000", "b": 55}, + {"a": "Jan 3, 2000", "b": null}, + {"a": "Jan 4, 2000", "b": 65}, + {"a": "Jan 5, 2000", "b": 43}, + {"a": "Jan 6, 2000", "b": null}, + {"a": "Jan 7, 2000", "b": 55}, + {"a": "Jan 8, 2000", "b": 43} + ] + }, + "transform": [{ + "window": [{ + "op": "lag", + "field": "b", + "as": "prev" + },{ + "op": "lead", + "field": "b", + "as": "next" + }] + }, { + "calculate": "datum.b === null ? (datum.prev + datum.next)/2 : datum.b", + "as": "b" + }], + "mark": {"type": "line", "point": true}, + "encoding": { + "x": {"timeUnit": "yearmonthdate", "field": "a", "type": "temporal", "axis": {"format": "%d %b"}}, + "y": {"field": "b", "type": "quantitative"} + } +} diff --git a/site/Gemfile.lock b/site/Gemfile.lock index 100fc23c8d..8daf23b2d3 100644 --- a/site/Gemfile.lock +++ b/site/Gemfile.lock @@ -33,10 +33,8 @@ GEM ffi (>= 1.15.0) eventmachine (1.2.7) execjs (2.9.1) - faraday (2.9.0) - faraday-net_http (>= 2.0, < 3.2) - faraday-net_http (3.1.0) - net-http + faraday (2.0.0) + ruby2_keywords (>= 0.0.4) ffi (1.16.3) forwardable-extended (2.6.0) gemoji (4.1.0) @@ -220,13 +218,11 @@ GEM jekyll-seo-tag (~> 2.1) minitest (5.22.2) mutex_m (0.2.0) - net-http (0.4.1) - uri - nokogiri (1.16.5-arm64-darwin) + nokogiri (1.15.6-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.5-x86_64-darwin) + nokogiri (1.15.6-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.5-x86_64-linux) + nokogiri (1.15.6-x86_64-linux) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) @@ -241,6 +237,7 @@ GEM rexml (3.2.8) strscan (>= 3.0.9) rouge (3.30.0) + ruby2_keywords (0.0.5) rubyzip (2.3.2) safe_yaml (1.0.5) sass (3.7.4) @@ -264,7 +261,6 @@ GEM unf_ext unf_ext (0.0.9.1) unicode-display_width (1.8.0) - uri (0.13.0) webrick (1.8.1) PLATFORMS @@ -281,4 +277,4 @@ DEPENDENCIES webrick (~> 1.7) BUNDLED WITH - 2.2.32 + 2.4.22 diff --git a/site/_data/examples.json b/site/_data/examples.json index a04bc1af32..99568b67ea 100644 --- a/site/_data/examples.json +++ b/site/_data/examples.json @@ -520,6 +520,10 @@ { "name": "layer_point_line_loess", "title": "Loess Regression" + }, + { + "name": "window_impute_null", + "title": "Using window transform to impute missing values by averaging the previous and next values." } ] }, diff --git a/site/_data/versions.yml b/site/_data/versions.yml new file mode 100644 index 0000000000..4326f76f45 --- /dev/null +++ b/site/_data/versions.yml @@ -0,0 +1,4 @@ +vega: 5.28.0 +vega-lite: 5.18.1 +vega-embed: 6.25.0 +vega-tooltip: 0.34.0 diff --git a/site/_includes/docs_toc.md b/site/_includes/docs_toc.md index c1d1174988..db73d65914 100644 --- a/site/_includes/docs_toc.md +++ b/site/_includes/docs_toc.md @@ -381,3 +381,8 @@ - [Tooltip image]({{site.baseurl}}/docs/tooltip.html#tooltip-image) - [Disable tooltips]({{site.baseurl}}/docs/tooltip.html#disable-tooltips) - [Vega Tooltip plugin]({{site.baseurl}}/docs/tooltip.html#plugin) +- [Invalid Data]({{site.baseurl}}/docs/invalid-data.html) + - [Documentation Overview]({{site.baseurl}}/docs/invalid-data.html#documentation-overview) + - [Mark Invalid Mode]({{site.baseurl}}/docs/invalid-data.html#mark-invalid-mode) + - [Scale Output for Invalid Values]({{site.baseurl}}/docs/invalid-data.html#scale-output-for-invalid-values) + - [Other solutions]({{site.baseurl}}/docs/invalid-data.html#other-solutions) diff --git a/site/_layouts/docs.html b/site/_layouts/docs.html index 5dc0b66848..f6092e8602 100644 --- a/site/_layouts/docs.html +++ b/site/_layouts/docs.html @@ -169,6 +169,8 @@ url: predicate - text: Tooltip url: tooltip + - text: Invalid Data + url: invalid-data base: /docs/ --- diff --git a/site/docs/encoding/scale.md b/site/docs/encoding/scale.md index 86673fb955..8a5c6f9e2c 100644 --- a/site/docs/encoding/scale.md +++ b/site/docs/encoding/scale.md @@ -454,6 +454,10 @@ To provide themes for all scales, the scale config (`config: {scale: {...}}`) ca {% include table.html props="maxBandSize,minBandSize,maxFontSize,minFontSize,maxOpacity,minOpacity,maxSize,minSize,maxStrokeWidth,minStrokeWidth" source="ScaleConfig" %} +#### Scale Output for Invalid Values + +{% include table.html props="invalid" source="ScaleConfig" %} + #### Other {% include table.html props="clamp,round,xReverse,useUnaggregatedDomain,zero" source="ScaleConfig" %} diff --git a/site/docs/invaliddata.md b/site/docs/invaliddata.md new file mode 100644 index 0000000000..378e15faae --- /dev/null +++ b/site/docs/invaliddata.md @@ -0,0 +1,137 @@ +--- +layout: docs +menu: docs +title: Modes for Handling Invalid Data +permalink: /docs/invalid-data.html +--- + +This page discusses modes in Vega-Lite for handling invalid data (`null` and `NaN` in continuous scales). + +The main configurations are [`mark.invalid`](#mark) and [`config.scale.invalid`](#scale). In addition, you can use [other Vega-Lite features including conditional encodings, layering, or window transform to handle invalid and missing data](#other). + +Note: Vega-Lite does _not_ consider `null` and `NaN` in categorical scales and text encodings as invalid data: + +- Categorical scales can treat nulls and NaNs as separate categories +- Similarly, text encodings can directly display nulls and NaNs. + + +## Documentation Overview +{:.no_toc} + +- TOC +{:toc} + + + +## Mark Invalid Mode + +{:#mark} + +You can use `mark.invalid` (or `config.mark.invalid`) to configure how marks and their corresponding scales handle invalid data (`null` and `NaN` in continuous scales). + +{% include table.html props="invalid" source="MarkDef" %} + +### Examples + +To understand how these modes affect common marks, see these examples below, which visualize this dataset: + +```json +[ + {"a": null, "b": 100}, + {"a": -10, "b": null}, + {"a": -5, "b": -25}, + {"a": -1, "b": -20}, + {"a": 0, "b": null}, + {"a": 1, "b": 30}, + {"a": 5, "b": 40}, + {"a": 10, "b": null} +] +``` + +by assigning `"a"` to x-axis (as quantitative and ordinal fields) and `"b"` to y-axis. + +
+ +#### `"filter"` + +The `"filter"` invalid mode _excludes_ all invalid values from the visualization's _marks_ and _scales_. + +For path marks (for line, area, trail), this option will create paths that connect valid points, as if the points with invalid values do not exist. + +
+ +#### `"break-paths"` + +Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `"filter"`. All _scale_ domains will _exclude_ these filtered data points. + +
+ +#### `"break-paths-show-domains"` + +This option is like `"break-paths"`, except that all _scale_ domains will instead _include_ these filtered data points. + +
+ +#### `"show"` + +Include all data points in the marks and scale domains. Each scale will use the output for invalid values defined in `config.scale.invalid` or, if unspecified, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero). + +
+ +#### `"break-paths-show-path-domains"` (Default) + +For historical reasons, Vega-Lite 5 currently uses `"break-paths-show-path-domains"` as the default invalid data mode (to avoid breaking changes). This is equivalent to `"break-path-keep-domains"` for path-based marks (line/area/trail) and `"filter"` for other marks. + +
+ +## Scale Output for Invalid Values + +{:#scale} + +You can use `config.scale.invalid` to defines scale outputs per channel for invalid values. + +{% include table.html props="invalid" source="ScaleConfig" %} + +### Example: Output Color and Size with "Filter" Mode + +A visualization with `"filter"` invalid data mode will not filter (not exclude) color and size encoding if `config.scale.invalid.color` and `config.scale.invalid.size` are specified. + +
+ +Compare this with a similar spec, but without `config.scale.invalid`: + +
+ +### Example: Output Color with "Show" Mode + +As discussed earlier, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero). + +
+ +However, you may use `config.scale.invalid` to override the output for invalid data values: + +
+ +## Other solutions + +{:#other} + +Note that `mark.invalid` and `config.scale.invalid` are options for handling invalid data _without_ changing data or marks. + +However, you may use other Vega-Lite features such as conditional encoding, layering, and window transforms to encode invalid data. + +### Example: Conditional Encoding + +If you do not use color encoding, you may use conditional color encoding to use a specific color (e.g., gray) to encode invalid values. + +
+ +### Example: Layering + +You may also use different marks (such as bars) to encode null data. + +
+ +### Example: Using window transform to impute missing values + +
diff --git a/site/docs/transform/window.md b/site/docs/transform/window.md index c769be0d2d..846f8f4a06 100644 --- a/site/docs/transform/window.md +++ b/site/docs/transform/window.md @@ -117,3 +117,7 @@ Here we use window transform to visualize how the average MPG for vehicles have ### Percent of Total The window transform _can_ be used to compute an aggregate and attach it to all records in order to derive a percent of total, however, a simpler approach is to use the [join aggregate](joinaggregate.html) transform instead. + +### Using window transform to impute missing values + +
diff --git a/site/static/main.css b/site/static/main.css index 7eb4016836..d2f0180d9b 100644 --- a/site/static/main.css +++ b/site/static/main.css @@ -687,6 +687,9 @@ footer .edit-page { display: none; } +.code-only .example-vis { + display: none; +} .example .example-code { flex: 1.618 1 0; margin: 0; diff --git a/src/channel.ts b/src/channel.ts index a359383603..a66d21143e 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -480,7 +480,7 @@ const SCALE_CHANNEL_INDEX = { export const SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX); export type ScaleChannel = (typeof SCALE_CHANNELS)[number]; -export function isScaleChannel(channel: Channel): channel is ScaleChannel { +export function isScaleChannel(channel: ExtendedChannel): channel is ScaleChannel { return !!SCALE_CHANNEL_INDEX[channel]; } diff --git a/src/compile/data/filterinvalid.ts b/src/compile/data/filterinvalid.ts index 2a85a69091..2d20b9e3c0 100644 --- a/src/compile/data/filterinvalid.ts +++ b/src/compile/data/filterinvalid.ts @@ -1,12 +1,12 @@ import {FilterTransform as VgFilterTransform} from 'vega'; import {isScaleChannel} from '../../channel'; import {TypedFieldDef, vgField as fieldRef} from '../../channeldef'; -import {isPathMark} from '../../mark'; -import {hasContinuousDomain} from '../../scale'; import {Dict, hash, keys} from '../../util'; -import {getMarkPropOrConfig} from '../common'; +import {getScaleInvalidDataMode} from '../invalid/ScaleInvalidDataMode'; +import {DataSourcesForHandlingInvalidValues} from '../invalid/datasources'; import {UnitModel} from '../unit'; import {DataFlowNode} from './dataflow'; +import {isCountingAggregateOp} from '../../aggregate'; export class FilterInvalidNode extends DataFlowNode { public clone() { @@ -20,27 +20,40 @@ export class FilterInvalidNode extends DataFlowNode { super(parent); } - public static make(parent: DataFlowNode, model: UnitModel): FilterInvalidNode { - const {config, mark, markDef} = model; + public static make( + parent: DataFlowNode, + model: UnitModel, + dataSourcesForHandlingInvalidValues: DataSourcesForHandlingInvalidValues + ): FilterInvalidNode { + const {config, markDef} = model; - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid !== 'filter') { + const {marks, scales} = dataSourcesForHandlingInvalidValues; + if (marks === 'include-invalid-values' && scales === 'include-invalid-values') { + // If neither marks nor scale domains need data source to filter null values, then don't add the filter. return null; } const filter = model.reduceFieldDef( (aggregator: Dict>, fieldDef, channel) => { const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel); + if (scaleComponent) { const scaleType = scaleComponent.get('type'); + const {aggregate} = fieldDef; + const invalidDataMode = getScaleInvalidDataMode({ + scaleChannel: channel, + markDef, + config, + scaleType, + isCountAggregate: isCountingAggregateOp(aggregate) + }); - // While discrete domain scales can handle invalid values, continuous scales can't. - // Thus, for non-path marks, we have to filter null for scales with continuous domains. - // (For path marks, we will use "defined" property and skip these values instead.) - if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) { + // If the invalid data mode is include or always-valid, we don't need to filter invalid values as the scale can handle invalid values. + if (invalidDataMode !== 'show' && invalidDataMode !== 'always-valid') { aggregator[fieldDef.field] = fieldDef as any; // we know that the fieldDef is a typed field def } } + return aggregator; }, {} as Dict> diff --git a/src/compile/data/index.ts b/src/compile/data/index.ts index 29fefae229..ac7b790cd9 100644 --- a/src/compile/data/index.ts +++ b/src/compile/data/index.ts @@ -27,6 +27,16 @@ export interface DataComponent { */ raw?: OutputNode; + /** + * The output node for scale domain before filter invalid. + */ + preFilterInvalid?: OutputNode; + + /** + * The output node for scale domain after filter invalid. + */ + postFilterInvalid?: OutputNode; + /** * The main output node. */ diff --git a/src/compile/data/parse.ts b/src/compile/data/parse.ts index 6ce7d480d5..9fc9009402 100644 --- a/src/compile/data/parse.ts +++ b/src/compile/data/parse.ts @@ -10,7 +10,9 @@ import { DataSourceType, ParseValue } from '../../data'; +import {getDataSourcesForHandlingInvalidValues, DataSourcesForHandlingInvalidValues} from '../invalid/datasources'; import * as log from '../../log'; +import {isPathMark} from '../../mark'; import { isAggregate, isBin, @@ -33,6 +35,7 @@ import { isWindow } from '../../transform'; import {deepEqual, mergeDeep} from '../../util'; +import {getMarkPropOrConfig} from '../common'; import {isFacetModel, isLayerModel, isUnitModel, Model} from '../model'; import {requiresSelectionId} from '../selection'; import {materializeSelections} from '../selection/parse'; @@ -285,14 +288,26 @@ Formula From Sort Array Stack (in `encoding`) | v - Invalid Filter ++- - - - - - - - - - -+ +| PreFilterInvalid | - - - -> scale domains +|(when scales need it)| ++- - - - - - - - - - -+ + | + v + Invalid Filter (if the main data source needs it) | v +----------+ - | Main | + | Main | - - - -> scale domains +----------+ | v ++- - - - - - - - - - -+ +| PostFilterInvalid | - - - -> scale domains +|(when scales need it)| ++- - - - - - - - - - -+ + | + v +-------+ | Facet |----> "column", "column-layout", and "row" +-------+ @@ -384,13 +399,41 @@ export function parseData(model: Model): DataComponent { head = StackNode.makeFromEncoding(head, model) ?? head; } + let preFilterInvalid: OutputNode | undefined; + let dataSourcesForHandlingInvalidValues: DataSourcesForHandlingInvalidValues | undefined; if (isUnitModel(model)) { - head = FilterInvalidNode.make(head, model) ?? head; + const {markDef, mark, config} = model; + const invalid = getMarkPropOrConfig('invalid', markDef, config); + + const {marks, scales} = (dataSourcesForHandlingInvalidValues = getDataSourcesForHandlingInvalidValues({ + invalid, + isPath: isPathMark(mark) + })); + + if (marks !== scales && scales === 'include-invalid-values') { + // Create a seperate preFilterInvalid dataSource if scales need pre-filter data but marks needs post-filter. + preFilterInvalid = head = makeOutputNode(DataSourceType.PreFilterInvalid, model, head); + } + + if (marks === 'exclude-invalid-values') { + head = FilterInvalidNode.make(head, model, dataSourcesForHandlingInvalidValues) ?? head; + } } - // output node for marks + // output "main" node for marks const main = (head = makeOutputNode(DataSourceType.Main, model, head)); + let postFilterInvalid: OutputNode | undefined; + if (isUnitModel(model) && dataSourcesForHandlingInvalidValues) { + const {marks, scales} = dataSourcesForHandlingInvalidValues; + if (marks === 'include-invalid-values' && scales === 'exclude-invalid-values') { + // Create a seperate postFilterInvalid dataSource if scales need post-filter data but marks needs pre-filter. + head = FilterInvalidNode.make(head, model, dataSourcesForHandlingInvalidValues) ?? head; + + postFilterInvalid = head = makeOutputNode(DataSourceType.PostFilterInvalid, model, head); + } + } + if (isUnitModel(model)) { materializeSelections(model, main); } @@ -415,7 +458,9 @@ export function parseData(model: Model): DataComponent { raw, main, facetRoot, - ancestorParse + ancestorParse, + preFilterInvalid, + postFilterInvalid }; } diff --git a/src/compile/guide.ts b/src/compile/guide.ts index 1ef0ed15f0..bdbe0420e5 100644 --- a/src/compile/guide.ts +++ b/src/compile/guide.ts @@ -2,15 +2,20 @@ import {GuideEncodingEntry} from '../guide'; import {keys} from '../util'; import {VgEncodeChannel} from '../vega.schema'; import {signalOrValueRef} from './common'; -import {wrapCondition} from './mark/encode'; +import {wrapCondition} from './mark/encode/conditional'; import {UnitModel} from './unit'; export function guideEncodeEntry(encoding: GuideEncodingEntry, model: UnitModel) { return keys(encoding).reduce((encode, channel: VgEncodeChannel) => { - const valueDef = encoding[channel]; return { ...encode, - ...wrapCondition(model, valueDef, channel, def => signalOrValueRef(def.value)) + ...wrapCondition({ + model, + channelDef: encoding[channel], + vgChannel: channel, + mainRefFn: def => signalOrValueRef(def.value), + invalidValueRef: undefined // guide encoding won't show invalid values for the scale + }) }; }, {}); } diff --git a/src/compile/invalid/ScaleInvalidDataMode.ts b/src/compile/invalid/ScaleInvalidDataMode.ts new file mode 100644 index 0000000000..2359da300f --- /dev/null +++ b/src/compile/invalid/ScaleInvalidDataMode.ts @@ -0,0 +1,51 @@ +import {SignalRef} from 'vega'; +import {ScaleChannel} from '../../channel'; +import {Config} from '../../config'; +import {MarkInvalidDataMode} from '../../invalid'; +import {MarkDef, isPathMark} from '../../mark'; +import {ScaleType, hasContinuousDomain} from '../../scale'; +import {getMarkPropOrConfig} from '../common'; +import {normalizeInvalidDataMode} from './normalizeInvalidDataMode'; + +export type ScaleInvalidDataMode = + // remove 'break-paths-show-path-domains' from MarkInvalidDataMode + // because it is a macro for '"filter"' or `"break-path-keep-domains` + | Omit + + // Add always-valid because at scale level, categorical scales can handle any values and thus is always valid. + | 'always-valid'; + +export function getScaleInvalidDataMode({ + markDef, + config, + scaleChannel, + scaleType, + isCountAggregate +}: { + markDef: MarkDef; + config: Config; + scaleChannel: C; + scaleType: ScaleType; + isCountAggregate: boolean; +}): ScaleInvalidDataMode { + if (!scaleType || !hasContinuousDomain(scaleType) || isCountAggregate) { + // - Discrete scales can always display null as another category + // - Count cannot output null values + return 'always-valid'; + } + + const invalidMode = normalizeInvalidDataMode(getMarkPropOrConfig('invalid', markDef, config), { + isPath: isPathMark(markDef.type) + }); + + const scaleOutputForInvalid = config.scale?.invalid?.[scaleChannel]; + if (scaleOutputForInvalid !== undefined) { + // Regardless of the current invalid mode, if the channel has a default value, we consider the field valid. + return 'show'; + } + + return invalidMode; +} +export function shouldBreakPath(mode: ScaleInvalidDataMode): boolean { + return mode === 'break-paths-filter-domains' || mode === 'break-paths-show-domains'; +} diff --git a/src/compile/invalid/datasources.ts b/src/compile/invalid/datasources.ts new file mode 100644 index 0000000000..75f1b00e7b --- /dev/null +++ b/src/compile/invalid/datasources.ts @@ -0,0 +1,63 @@ +import {MarkInvalidDataMode} from '../../invalid'; + +import {DataSourceType} from '../../data'; +import {normalizeInvalidDataMode} from './normalizeInvalidDataMode'; + +type PreOrPostFilteringInvalidValues = 'include-invalid-values' | 'exclude-invalid-values'; + +export interface DataSourcesForHandlingInvalidValues { + marks: PreOrPostFilteringInvalidValues; + scales: PreOrPostFilteringInvalidValues; +} +interface GetDataSourcesForHandlingInvalidValuesProps { + invalid: MarkInvalidDataMode | null | undefined; + isPath: boolean; +} + +export function getDataSourcesForHandlingInvalidValues({ + invalid, + isPath +}: GetDataSourcesForHandlingInvalidValuesProps): DataSourcesForHandlingInvalidValues { + const normalizedInvalid = normalizeInvalidDataMode(invalid, {isPath}); + + switch (normalizedInvalid) { + case 'filter': + // Both marks and scales use post-filter data + return { + marks: 'exclude-invalid-values', + scales: 'exclude-invalid-values' + }; + case 'break-paths-show-domains': + return { + // Path-based marks use pre-filter data so we know to skip these invalid points in the path. + // For non-path based marks, we skip by not showing them at all. + marks: isPath ? 'include-invalid-values' : 'exclude-invalid-values', + scales: 'include-invalid-values' + }; + case 'break-paths-filter-domains': + // For path marks, the marks will use unfiltered data (and skip points). But we need a separate data sources to feed the domain. + // For non-path marks, we can use the filtered data for both marks and scales. + return { + marks: isPath ? 'include-invalid-values' : 'exclude-invalid-values', + // Unlike 'break-paths-show-domains', 'break-paths-filter-domains' uses post-filter data to feed scale. + scales: 'exclude-invalid-values' + }; + case 'show': + return { + marks: 'include-invalid-values', + scales: 'include-invalid-values' + }; + } +} + +export function getScaleDataSourceForHandlingInvalidValues( + props: GetDataSourcesForHandlingInvalidValuesProps +): DataSourceType { + const {marks, scales} = getDataSourcesForHandlingInvalidValues(props); + if (marks === scales) { + // If both marks and scales use the same data, there is only the main data source. + return DataSourceType.Main; + } + // If marks and scales use differetnt data, return the pre/post-filter data source accordingly. + return scales === 'include-invalid-values' ? DataSourceType.PreFilterInvalid : DataSourceType.PostFilterInvalid; +} diff --git a/src/compile/invalid/normalizeInvalidDataMode.ts b/src/compile/invalid/normalizeInvalidDataMode.ts new file mode 100644 index 0000000000..13ba247723 --- /dev/null +++ b/src/compile/invalid/normalizeInvalidDataMode.ts @@ -0,0 +1,15 @@ +import {MarkInvalidDataMode} from '../../invalid'; + +type NormalizedMarkInvalidDataMode = Exclude; + +export function normalizeInvalidDataMode( + mode: MarkInvalidDataMode | null | undefined, + {isPath}: {isPath: boolean} +): NormalizedMarkInvalidDataMode { + if (mode === undefined || mode === 'break-paths-show-path-domains') { + return isPath ? 'break-paths-show-domains' : 'filter'; + } else if (mode === null) { + return 'show'; + } + return mode; +} diff --git a/src/compile/mark/encode/aria.ts b/src/compile/mark/encode/aria.ts index dac62f19ec..8fb2c8db1e 100644 --- a/src/compile/mark/encode/aria.ts +++ b/src/compile/mark/encode/aria.ts @@ -45,7 +45,13 @@ export function description(model: UnitModel) { const channelDef = encoding.description; if (channelDef) { - return wrapCondition(model, channelDef, 'description', cDef => textRef(cDef, model.config)); + return wrapCondition({ + model, + channelDef, + vgChannel: 'description', + mainRefFn: cDef => textRef(cDef, model.config), + invalidValueRef: undefined // aria encoding doesn't have continuous scales and thus can't have invalid values + }); } // Use default from mark def or config if defined. diff --git a/src/compile/mark/encode/base.ts b/src/compile/mark/encode/base.ts index b739d101e7..55cff371e4 100644 --- a/src/compile/mark/encode/base.ts +++ b/src/compile/mark/encode/base.ts @@ -1,21 +1,15 @@ -import {array} from 'vega-util'; -import {Channel, ScaleChannel, SCALE_CHANNELS} from '../../../channel'; -import {isPathMark, MarkDef} from '../../../mark'; -import {hasContinuousDomain} from '../../../scale'; -import {Dict, keys} from '../../../util'; -import {VgEncodeEntry, VgValueRef, VG_MARK_CONFIGS} from '../../../vega.schema'; -import {getMarkPropOrConfig, signalOrValueRef} from '../../common'; +import {MarkDef} from '../../../mark'; +import {VG_MARK_CONFIGS, VgEncodeEntry, VgValueRef} from '../../../vega.schema'; +import {signalOrValueRef} from '../../common'; import {UnitModel} from '../../unit'; import {aria} from './aria'; import {color} from './color'; import {nonPosition} from './nonposition'; import {text} from './text'; import {tooltip} from './tooltip'; -import {fieldInvalidPredicate} from './valueref'; import {zindex} from './zindex'; export {color} from './color'; -export {wrapCondition} from './conditional'; export {nonPosition} from './nonposition'; export {pointPosition} from './position-point'; export {pointOrRangePosition, rangePosition} from './position-range'; @@ -31,8 +25,8 @@ export function baseEncodeEntry(model: UnitModel, ignore: Ignore) { const {fill = undefined, stroke = undefined} = ignore.color === 'include' ? color(model) : {}; return { ...markDefProperties(model.markDef, ignore), - ...wrapAllFieldsInvalid(model, 'fill', fill), - ...wrapAllFieldsInvalid(model, 'stroke', stroke), + ...colorRef('fill', fill), + ...colorRef('stroke', stroke), ...nonPosition('opacity', model), ...nonPosition('fillOpacity', model), ...nonPosition('strokeOpacity', model), @@ -45,27 +39,7 @@ export function baseEncodeEntry(model: UnitModel, ignore: Ignore) { }; } -// TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987 -function wrapAllFieldsInvalid(model: UnitModel, channel: Channel, valueRef: VgValueRef | VgValueRef[]): VgEncodeEntry { - const {config, mark, markDef} = model; - - const invalid = getMarkPropOrConfig('invalid', markDef, config); - - if (invalid === 'hide' && valueRef && !isPathMark(mark)) { - // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains. - // For path marks, we will use "defined" property and skip these values instead. - const test = allFieldsInvalidPredicate(model, {invalid: true, channels: SCALE_CHANNELS}); - if (test) { - return { - [channel]: [ - // prepend the invalid case - // TODO: support custom value - {test, value: null}, - ...array(valueRef) - ] - }; - } - } +function colorRef(channel: 'fill' | 'stroke', valueRef: VgValueRef | VgValueRef[]): VgEncodeEntry { return valueRef ? {[channel]: valueRef} : {}; } @@ -77,29 +51,3 @@ function markDefProperties(mark: MarkDef, ignore: Ignore) { return m; }, {}); } - -function allFieldsInvalidPredicate( - model: UnitModel, - {invalid = false, channels}: {invalid?: boolean; channels: ScaleChannel[]} -) { - const filterIndex = channels.reduce((aggregator: Dict, channel) => { - const scaleComponent = model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); - const field = model.vgField(channel, {expr: 'datum'}); - - // While discrete domain scales can handle invalid values, continuous scales can't. - if (field && hasContinuousDomain(scaleType)) { - aggregator[field] = true; - } - } - return aggregator; - }, {}); - - const fields = keys(filterIndex); - if (fields.length > 0) { - const op = invalid ? '||' : '&&'; - return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `); - } - return undefined; -} diff --git a/src/compile/mark/encode/conditional.ts b/src/compile/mark/encode/conditional.ts index 1e4cacb52b..7a9aca8082 100644 --- a/src/compile/mark/encode/conditional.ts +++ b/src/compile/mark/encode/conditional.ts @@ -7,21 +7,37 @@ import {parseSelectionPredicate} from '../../selection/parse'; import {UnitModel} from '../../unit'; /** - * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition - * or a simple mixin if channel def has no condition. + * Return a VgEncodeEntry that includes a Vega production rule for a scale channel's encoding or guide encoding, which includes: + * (1) the conditional rules (if provided as part of channelDef) + * (2) invalidValueRef for handling invalid values (if provided as a parameter of this method) + * (3) main reference for the encoded data. */ -export function wrapCondition( - model: UnitModel, - channelDef: CD, - vgChannel: string, - refFn: (cDef: CD) => VgValueRef -): VgEncodeEntry { +export function wrapCondition({ + model, + channelDef, + vgChannel, + invalidValueRef, + mainRefFn +}: { + model: UnitModel; + channelDef: CD; + vgChannel: string; + + /** + * invalidValue for a scale channel if the invalidDataMode is include for the channel. + * For scale channel with other invalidDataMode or non-scale channel, this value should be undefined. + */ + invalidValueRef: VgValueRef | undefined; + mainRefFn: (cDef: CD) => VgValueRef; +}): VgEncodeEntry { const condition = isConditionalDef(channelDef) && channelDef.condition; - const valueRef = refFn(channelDef); + + let valueRefs: VgValueRef[] = []; + if (condition) { const conditions = array(condition); - const vgConditions = conditions.map(c => { - const conditionValueRef = refFn(c); + valueRefs = conditions.map(c => { + const conditionValueRef = mainRefFn(c); if (isConditionalParameter(c)) { const {param, empty} = c; const test = parseSelectionPredicate(model, {param, empty}); @@ -31,10 +47,21 @@ export function wrapCondition 1) { + return {[vgChannel]: valueRefs}; + } else if (valueRefs.length === 1) { + return {[vgChannel]: valueRefs[0]}; + } + return {}; } diff --git a/src/compile/mark/encode/defined.ts b/src/compile/mark/encode/defined.ts index a73fcd4f99..9cf67766f8 100644 --- a/src/compile/mark/encode/defined.ts +++ b/src/compile/mark/encode/defined.ts @@ -1,49 +1,48 @@ -import {POSITION_SCALE_CHANNELS} from '../../../channel'; -import {ScaleChannel} from '../../../channel'; +import {isCountingAggregateOp} from '../../../aggregate'; +import {isScaleChannel} from '../../../channel'; import {Value} from '../../../channeldef'; -import {hasContinuousDomain} from '../../../scale'; -import {Dict, keys} from '../../../util'; +import {fieldValidPredicate} from '../../../predicate'; import {VgEncodeEntry} from '../../../vega.schema'; -import {getMarkPropOrConfig, signalOrValueRef} from '../../common'; +import {signalOrValueRef} from '../../common'; +import {getScaleInvalidDataMode, shouldBreakPath} from '../../invalid/ScaleInvalidDataMode'; import {UnitModel} from '../../unit'; -import {fieldInvalidPredicate} from './valueref'; +/** + * Create Vega's "defined" encoding to break paths in a path mark for invalid values. + */ export function defined(model: UnitModel): VgEncodeEntry { const {config, markDef} = model; - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid) { - const signal = allFieldsInvalidPredicate(model, {channels: POSITION_SCALE_CHANNELS}); + // For each channel (x/y), add fields to break path to a set first. + const fieldsToBreakPath = new Set(); - if (signal) { - return {defined: {signal}}; + model.forEachFieldDef((fieldDef, channel) => { + let scaleType; + if (!isScaleChannel(channel) || !(scaleType = model.getScaleType(channel))) { + // Skip if the channel is not a scale channel or does not have a scale + return; } - } - return {}; -} -function allFieldsInvalidPredicate( - model: UnitModel, - {invalid = false, channels}: {invalid?: boolean; channels: ScaleChannel[]} -) { - const filterIndex = channels.reduce((aggregator: Dict, channel) => { - const scaleComponent = model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); + const isCountAggregate = isCountingAggregateOp(fieldDef.aggregate); + const invalidDataMode = getScaleInvalidDataMode({ + scaleChannel: channel, + markDef, + config, + scaleType, + isCountAggregate + }); + if (shouldBreakPath(invalidDataMode)) { const field = model.vgField(channel, {expr: 'datum', binSuffix: model.stack?.impute ? 'mid' : undefined}); - - // While discrete domain scales can handle invalid values, continuous scales can't. - if (field && hasContinuousDomain(scaleType)) { - aggregator[field] = true; + if (field) { + fieldsToBreakPath.add(field); } } - return aggregator; - }, {}); + }); - const fields = keys(filterIndex); - if (fields.length > 0) { - const op = invalid ? '||' : '&&'; - return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `); + // If the set is not empty, return a defined signal. + if (fieldsToBreakPath.size > 0) { + const signal = [...fieldsToBreakPath].map(field => fieldValidPredicate(field, true)).join(' && '); + return {defined: {signal}}; } return undefined; } diff --git a/src/compile/mark/encode/index.ts b/src/compile/mark/encode/index.ts index 966ffbbc3e..7f36b4dfbf 100644 --- a/src/compile/mark/encode/index.ts +++ b/src/compile/mark/encode/index.ts @@ -1,7 +1,6 @@ export {aria} from './aria'; export {baseEncodeEntry} from './base'; export {color} from './color'; -export {wrapCondition} from './conditional'; export {defined, valueIfDefined} from './defined'; export {nonPosition} from './nonposition'; export {pointPosition} from './position-point'; diff --git a/src/compile/mark/encode/invalid.ts b/src/compile/mark/encode/invalid.ts new file mode 100644 index 0000000000..e5678801a2 --- /dev/null +++ b/src/compile/mark/encode/invalid.ts @@ -0,0 +1,62 @@ +import {isCountingAggregateOp} from '../../../aggregate'; +import {NonPositionScaleChannel, PolarPositionScaleChannel, PositionScaleChannel} from '../../../channel'; +import {getFieldDef, vgField} from '../../../channeldef'; +import {ScaleInvalidDataShowAs, isScaleInvalidDataIncludeAsValue} from '../../../invalid'; +import {fieldValidPredicate} from '../../../predicate'; +import {VgValueRef, isSignalRef} from '../../../vega.schema'; +import {getScaleInvalidDataMode} from '../../invalid/ScaleInvalidDataMode'; +import {ScaleComponent} from '../../scale/component'; +import {scaledZeroOrMinOrMax} from './scaledZeroOrMinOrMax'; +import {MidPointParams} from './valueref'; + +export function getConditionalValueRefForIncludingInvalidValue< + C extends PositionScaleChannel | PolarPositionScaleChannel | NonPositionScaleChannel +>({ + scaleChannel, + channelDef, + scale, + scaleName, + markDef, + config +}: { + scaleChannel: C; +} & Pick): VgValueRef | undefined { + const scaleType = scale?.get('type'); + + const fieldDef = getFieldDef(channelDef); + const isCountAggregate = isCountingAggregateOp(fieldDef?.aggregate); + + const invalidDataMode = getScaleInvalidDataMode({ + scaleChannel, + markDef, + config, + scaleType, + isCountAggregate + }); + + if (fieldDef && invalidDataMode === 'show') { + const includeAs: ScaleInvalidDataShowAs = config.scale.invalid?.[scaleChannel] ?? 'zero-or-min'; + return { + test: fieldValidPredicate(vgField(fieldDef, {expr: 'datum'}), false), + ...refForInvalidValues(includeAs, scale, scaleName) + }; + } + return undefined; +} + +function refForInvalidValues( + includeAs: ScaleInvalidDataShowAs, + scale: ScaleComponent, + scaleName: string +): VgValueRef { + if (isScaleInvalidDataIncludeAsValue(includeAs)) { + const {value} = includeAs; + return isSignalRef(value) ? {signal: value.signal} : {value}; + } + + return scaledZeroOrMinOrMax({ + scale, + scaleName, + mode: 'zeroOrMin' + }); +} diff --git a/src/compile/mark/encode/nonposition.ts b/src/compile/mark/encode/nonposition.ts index df56da2fb2..3f2380d4d1 100644 --- a/src/compile/mark/encode/nonposition.ts +++ b/src/compile/mark/encode/nonposition.ts @@ -6,6 +6,7 @@ import {getMarkPropOrConfig, signalOrValueRef} from '../../common'; import {UnitModel} from '../../unit'; import {wrapCondition} from './conditional'; import * as ref from './valueref'; +import {getConditionalValueRefForIncludingInvalidValue} from './invalid'; /** * Return encode for non-positional channels with scales. (Text doesn't have scale.) @@ -33,17 +34,34 @@ export function nonPosition( } const channelDef = encoding[channel]; + const commonProps = { + markDef, + config, + scaleName: model.scaleName(channel), + scale: model.getScaleComponent(channel) + }; - return wrapCondition(model, channelDef, vgChannel ?? channel, cDef => { + const invalidValueRef = getConditionalValueRefForIncludingInvalidValue({ + ...commonProps, + scaleChannel: channel, + channelDef + }); + + const mainRefFn = (cDef: typeof channelDef) => { return ref.midPoint({ + ...commonProps, channel, channelDef: cDef, - markDef, - config, - scaleName: model.scaleName(channel), - scale: model.getScaleComponent(channel), stack: null, // No need to provide stack for non-position as it does not affect mid point defaultRef }); + }; + + return wrapCondition({ + model, + channelDef, + vgChannel: vgChannel ?? channel, + invalidValueRef, + mainRefFn }); } diff --git a/src/compile/mark/encode/position-point.ts b/src/compile/mark/encode/position-point.ts index 1df089df32..4ca33f5c9e 100644 --- a/src/compile/mark/encode/position-point.ts +++ b/src/compile/mark/encode/position-point.ts @@ -5,17 +5,19 @@ import { getVgPositionChannel, isXorY, PolarPositionChannel, - PositionChannel + PolarPositionScaleChannel, + PositionChannel, + PositionScaleChannel } from '../../../channel'; import {isFieldDef, isFieldOrDatumDef, TypedFieldDef} from '../../../channeldef'; -import {ScaleType} from '../../../scale'; -import {contains} from '../../../util'; +import {Config} from '../../../config'; import {VgValueRef} from '../../../vega.schema'; import {getMarkPropOrConfig} from '../../common'; import {ScaleComponent} from '../../scale/component'; import {UnitModel} from '../../unit'; import {positionOffset} from './offset'; import * as ref from './valueref'; +import {scaledZeroOrMinOrMax, ScaledZeroOrMinOrMaxProps} from './scaledZeroOrMinOrMax'; /** * Return encode for point (non-band) position channels. @@ -142,43 +144,15 @@ export function pointPositionDefaultRef({ switch (defaultPos) { case 'zeroOrMin': + return zeroOrMinOrMaxPosition({scaleName, scale, mode: 'zeroOrMin', mainChannel, config}); case 'zeroOrMax': - if (scaleName) { - const scaleType = scale.get('type'); - if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) { - // Log scales cannot have zero. - // Zero in time scale is arbitrary, and does not affect ratio. - // (Time is an interval level of measurement, not ratio). - // See https://en.wikipedia.org/wiki/Level_of_measurement for more info. - } else { - if (scale.domainDefinitelyIncludesZero()) { - return { - scale: scaleName, - value: 0 - }; - } - } - } - - if (defaultPos === 'zeroOrMin') { - return mainChannel === 'y' ? {field: {group: 'height'}} : {value: 0}; - } else { - // zeroOrMax - switch (mainChannel) { - case 'radius': - // max of radius is min(width, height) / 2 - return { - signal: `min(${model.width.signal},${model.height.signal})/2` - }; - case 'theta': - return {signal: '2*PI'}; - case 'x': - return {field: {group: 'width'}}; - case 'y': - return {value: 0}; - } - } - break; + return zeroOrMinOrMaxPosition({ + scaleName, + scale, + mode: {zeroOrMax: {widthSignal: model.width.signal, heightSignal: model.height.signal}}, + mainChannel, + config + }); case 'mid': { const sizeRef = model[getSizeChannel(channel)]; return {...sizeRef, mult: 0.5}; @@ -188,3 +162,38 @@ export function pointPositionDefaultRef({ return undefined; }; } + +function zeroOrMinOrMaxPosition({ + mainChannel, + config, + ...otherProps +}: ScaledZeroOrMinOrMaxProps & { + mainChannel: PositionScaleChannel | PolarPositionScaleChannel; + config: Config; +}): VgValueRef { + const scaledValueRef = scaledZeroOrMinOrMax(otherProps); + const {mode} = otherProps; + + if (scaledValueRef) { + return scaledValueRef; + } + + switch (mainChannel) { + case 'radius': { + if (mode === 'zeroOrMin') { + return {value: 0}; // min value + } + const {widthSignal, heightSignal} = mode.zeroOrMax; + // max of radius is min(width, height) / 2 + return { + signal: `min(${widthSignal},${heightSignal})/2` + }; + } + case 'theta': + return mode === 'zeroOrMin' ? {value: 0} : {signal: '2*PI'}; + case 'x': + return mode === 'zeroOrMin' ? {value: 0} : {field: {group: 'width'}}; + case 'y': + return mode === 'zeroOrMin' ? {field: {group: 'height'}} : {value: 0}; + } +} diff --git a/src/compile/mark/encode/scaledZeroOrMinOrMax.ts b/src/compile/mark/encode/scaledZeroOrMinOrMax.ts new file mode 100644 index 0000000000..06c6bc5388 --- /dev/null +++ b/src/compile/mark/encode/scaledZeroOrMinOrMax.ts @@ -0,0 +1,34 @@ +import {VgValueRef} from '../../../vega.schema'; +import {ScaleComponent} from '../../scale/component'; + +export interface ScaledZeroOrMinOrMaxProps { + scaleName: string; + scale: ScaleComponent; + mode: 'zeroOrMin' | {zeroOrMax: {widthSignal: string; heightSignal: string}}; +} + +export function scaledZeroOrMinOrMax({scaleName, scale, mode}: ScaledZeroOrMinOrMaxProps): VgValueRef | undefined { + const domain = `domain('${scaleName}')`; + + if (!scale || !scaleName) { + return undefined; + } + const min = `${domain}[0]`; + const max = `peek(${domain})`; // peek = the last item of the array + + // If there is a scale (and hence its name) + const domainHasZero = scale.domainHasZero(); + // zeroOrMin or zeroOrMax mode + if (domainHasZero === 'definitely') { + return { + scale: scaleName, + value: 0 + }; + } else if (domainHasZero === 'maybe') { + const nonZeroValue = mode === 'zeroOrMin' ? min : max; + return {signal: `scale('${scaleName}', inrange(0, ${domain}) ? 0 : ${nonZeroValue})`}; + } else { + // domainHasZero === 'definitely-not' + return {signal: `scale('${scaleName}', ${mode === 'zeroOrMin' ? min : max})`}; + } +} diff --git a/src/compile/mark/encode/text.ts b/src/compile/mark/encode/text.ts index 845837290e..9b1bfc2241 100644 --- a/src/compile/mark/encode/text.ts +++ b/src/compile/mark/encode/text.ts @@ -9,7 +9,13 @@ import {wrapCondition} from './conditional'; export function text(model: UnitModel, channel: 'text' | 'href' | 'url' | 'description' = 'text') { const channelDef = model.encoding[channel]; - return wrapCondition(model, channelDef, channel, cDef => textRef(cDef, model.config)); + return wrapCondition({ + model, + channelDef, + vgChannel: channel, + mainRefFn: cDef => textRef(cDef, model.config), + invalidValueRef: undefined // text encoding doesn't have continuous scales and thus can't have invalid values + }); } export function textRef( diff --git a/src/compile/mark/encode/tooltip.ts b/src/compile/mark/encode/tooltip.ts index 53b5ae8f42..48f70ce3af 100644 --- a/src/compile/mark/encode/tooltip.ts +++ b/src/compile/mark/encode/tooltip.ts @@ -30,7 +30,7 @@ export function tooltip(model: UnitModel, opt: {reactiveGeom?: boolean} = {}) { return {tooltip: tooltipRefForEncoding({tooltip: channelDef}, stack, config, opt)}; } else { const datum = opt.reactiveGeom ? 'datum.datum' : 'datum'; - return wrapCondition(model, channelDef, 'tooltip', cDef => { + const mainRefFn = (cDef: Encoding['tooltip']) => { // use valueRef based on channelDef first const tooltipRefFromChannelDef = textRef(cDef, config, datum); if (tooltipRefFromChannelDef) { @@ -62,6 +62,14 @@ export function tooltip(model: UnitModel, opt: {reactiveGeom?: boolean} = {}) { } return undefined; + }; + + return wrapCondition({ + model, + channelDef, + vgChannel: 'tooltip', + mainRefFn, + invalidValueRef: undefined // tooltip encoding doesn't have continuous scales and thus can't have invalid values }); } } diff --git a/src/compile/mark/encode/valueref.ts b/src/compile/mark/encode/valueref.ts index 02f36523b3..52854dac48 100644 --- a/src/compile/mark/encode/valueref.ts +++ b/src/compile/mark/encode/valueref.ts @@ -2,28 +2,25 @@ * Utility files for producing Vega ValueRef for marks */ import type {SignalRef} from 'vega'; -import {isFunction, isString} from 'vega-util'; -import {isCountingAggregateOp} from '../../../aggregate'; +import {isFunction} from 'vega-util'; import {isBinned, isBinning} from '../../../bin'; -import {Channel, getMainRangeChannel, PolarPositionChannel, PositionChannel, X, X2, Y2} from '../../../channel'; +import {Channel, PolarPositionChannel, PositionChannel, X, X2, Y2, getMainRangeChannel} from '../../../channel'; import { - binRequiresRange, ChannelDef, DatumDef, - FieldDef, FieldDefBase, - FieldName, FieldRefOption, + SecondaryChannelDef, + SecondaryFieldDef, + TypedFieldDef, + Value, + binRequiresRange, getBandPosition, isDatumDef, isFieldDef, isFieldOrDatumDef, isTypedFieldDef, isValueDef, - SecondaryChannelDef, - SecondaryFieldDef, - TypedFieldDef, - Value, vgField } from '../../../channeldef'; import {Config} from '../../../config'; @@ -31,79 +28,34 @@ import {dateTimeToExpr, isDateTime} from '../../../datetime'; import {isExprRef} from '../../../expr'; import * as log from '../../../log'; import {Mark, MarkDef} from '../../../mark'; -import {fieldValidPredicate} from '../../../predicate'; -import {hasDiscreteDomain, isContinuousToContinuous} from '../../../scale'; +import {hasDiscreteDomain} from '../../../scale'; import {StackProperties} from '../../../stack'; import {TEMPORAL} from '../../../type'; import {contains, stringify} from '../../../util'; -import {isSignalRef, VgValueRef} from '../../../vega.schema'; -import {getMarkPropOrConfig, signalOrValueRef} from '../../common'; +import {VgValueRef, isSignalRef} from '../../../vega.schema'; +import {signalOrValueRef} from '../../common'; import {ScaleComponent} from '../../scale/component'; +import {getConditionalValueRefForIncludingInvalidValue} from './invalid'; export function midPointRefWithPositionInvalidTest( params: MidPointParams & { channel: PositionChannel | PolarPositionChannel; } -) { - const {channel, channelDef, markDef, scale, config} = params; - const ref = midPoint(params); +): VgValueRef | VgValueRef[] { + const {channel, channelDef, markDef, scale, scaleName, config} = params; + const scaleChannel = getMainRangeChannel(channel); + const mainRef = midPoint(params); - // Wrap to check if the positional value is invalid, if so, plot the point on the min value - if ( - // Only this for field def without counting aggregate (as count wouldn't be null) - isFieldDef(channelDef) && - !isCountingAggregateOp(channelDef.aggregate) && - // and only for continuous scale - scale && - isContinuousToContinuous(scale.get('type')) - ) { - return wrapPositionInvalidTest({ - fieldDef: channelDef, - channel, - markDef, - ref, - config - }); - } - return ref; -} - -export function wrapPositionInvalidTest({ - fieldDef, - channel, - markDef, - ref, - config -}: { - fieldDef: FieldDef; - channel: PositionChannel | PolarPositionChannel; - markDef: MarkDef; - ref: VgValueRef; - config: Config; -}): VgValueRef | VgValueRef[] { - const invalid = getMarkPropOrConfig('invalid', markDef, config); - if (invalid === null) { - // if there is no invalid filter, do the invalid test - return [fieldInvalidTestValueRef(fieldDef, channel), ref]; - } - return ref; -} - -export function fieldInvalidTestValueRef(fieldDef: FieldDef, channel: PositionChannel | PolarPositionChannel) { - const test = fieldInvalidPredicate(fieldDef, true); - - const mainChannel = getMainRangeChannel(channel) as PositionChannel | PolarPositionChannel; // we can cast here as the output can't be other things. - const zeroValueRef = - mainChannel === 'y' - ? {field: {group: 'height'}} - : // x / angle / radius can all use 0 - {value: 0}; - - return {test, ...zeroValueRef}; -} + const valueRefForIncludingInvalid = getConditionalValueRefForIncludingInvalidValue({ + scaleChannel, + channelDef, + scale, + scaleName, + markDef, + config + }); -export function fieldInvalidPredicate(field: FieldName | FieldDef, invalid = true) { - return fieldValidPredicate(isString(field) ? field : vgField(field, {expr: 'datum'}), !invalid); + return valueRefForIncludingInvalid !== undefined ? [valueRefForIncludingInvalid, mainRef] : mainRef; } export function datumDefToExpr(datumDef: DatumDef) { diff --git a/src/compile/mark/encode/zindex.ts b/src/compile/mark/encode/zindex.ts index d0df9e606e..d36f6b93b1 100644 --- a/src/compile/mark/encode/zindex.ts +++ b/src/compile/mark/encode/zindex.ts @@ -9,7 +9,13 @@ export function zindex(model: UnitModel) { const order = encoding.order; if (!isPathMark(mark) && isValueDef(order)) { - return wrapCondition(model, order, 'zindex', cd => signalOrValueRef(cd.value)); + return wrapCondition({ + model, + channelDef: order, + vgChannel: 'zindex', + mainRefFn: cd => signalOrValueRef(cd.value), + invalidValueRef: undefined // zindex encoding doesn't have continuous scales and thus can't have invalid values + }); } return {}; } diff --git a/src/compile/model.ts b/src/compile/model.ts index 4ecdf6f3fe..6dc99627d7 100644 --- a/src/compile/model.ts +++ b/src/compile/model.ts @@ -25,7 +25,7 @@ import {forEach, reduce} from '../encoding'; import {ExprRef, replaceExprRef} from '../expr'; import * as log from '../log'; import {Resolve} from '../resolve'; -import {hasDiscreteDomain} from '../scale'; +import {ScaleType, hasDiscreteDomain} from '../scale'; import {isFacetSpec} from '../spec'; import { extractCompositionLayout, @@ -635,6 +635,11 @@ export abstract class Model { return this.parent ? this.parent.getScaleComponent(channel) : undefined; } + public getScaleType(channel: ScaleChannel): ScaleType { + const scaleComponent = this.getScaleComponent(channel); + return scaleComponent ? scaleComponent.get('type') : undefined; + } + /** * Traverse a model's hierarchy to get a particular selection component. */ diff --git a/src/compile/scale/component.ts b/src/compile/scale/component.ts index ba0e305c0c..47493b1c92 100644 --- a/src/compile/scale/component.ts +++ b/src/compile/scale/component.ts @@ -3,7 +3,7 @@ import {isArray, isNumber} from 'vega-util'; import {ScaleChannel} from '../../channel'; import {Scale, ScaleType} from '../../scale'; import {ParameterExtent} from '../../selection'; -import {some} from '../../util'; +import {contains} from '../../util'; import {VgNonUnionDomain, VgScale} from '../../vega.schema'; import {Explicit, Split} from '../split'; @@ -31,16 +31,56 @@ export class ScaleComponent extends Split { } /** - * Whether the scale definitely includes zero in the domain + * Whether the scale definitely includes or not include zero in the domain */ - public domainDefinitelyIncludesZero() { - if (this.get('zero') !== false) { - return true; + public domainHasZero(): 'definitely' | 'definitely-not' | 'maybe' { + const scaleType = this.get('type'); + if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) { + // Log scales cannot have zero. + // Zero in time scale is arbitrary, and does not affect ratio. + // (Time is an interval level of measurement, not ratio). + // See https://en.wikipedia.org/wiki/Level_of_measurement for more info. + return 'definitely-not'; } - return some( - this.get('domains'), - d => isArray(d) && d.length === 2 && isNumber(d[0]) && d[0] <= 0 && isNumber(d[1]) && d[1] >= 0 - ); + + const scaleZero = this.get('zero'); + if ( + scaleZero === true || + // If zero is undefined, linear/sqrt/pow scales have zero by default. + (scaleZero === undefined && contains([ScaleType.LINEAR, ScaleType.SQRT, ScaleType.POW], scaleType)) + ) { + return 'definitely'; + } + + const domains = this.get('domains'); + + if (domains.length > 0) { + let hasExplicitDomainWithZero = false; + let hasExplicitDomainWithoutZero = false; + let hasDomainBasedOnField = false; + for (const d of domains) { + if (isArray(d)) { + const first = d[0]; + const last = d[d.length - 1]; + if (isNumber(first) && isNumber(last)) { + if (first <= 0 && last >= 0) { + hasExplicitDomainWithZero = true; + continue; + } else { + hasExplicitDomainWithoutZero = true; + continue; + } + } + } + hasDomainBasedOnField = true; + } + if (hasExplicitDomainWithZero) { + return 'definitely'; + } else if (hasExplicitDomainWithoutZero && !hasDomainBasedOnField) { + return 'definitely-not'; + } + } + return 'maybe'; } } diff --git a/src/compile/scale/domain.ts b/src/compile/scale/domain.ts index b98669a66f..4a23487bf1 100644 --- a/src/compile/scale/domain.ts +++ b/src/compile/scale/domain.ts @@ -55,8 +55,10 @@ import {SignalRefWrapper} from '../signal'; import {Explicit, makeExplicit, makeImplicit, mergeValuesWithExplicit} from '../split'; import {UnitModel} from '../unit'; import {ScaleComponent, ScaleComponentIndex} from './component'; -import {isRectBasedMark} from '../../mark'; +import {isPathMark, isRectBasedMark} from '../../mark'; import {OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX} from '../data/timeunit'; +import {getScaleDataSourceForHandlingInvalidValues} from '../invalid/datasources'; +import {getMarkConfig} from '../common'; export function parseScaleDomain(model: Model) { if (isUnitModel(model)) { @@ -249,6 +251,11 @@ function parseSingleChannelDomain( const {type} = fieldOrDatumDef; const timeUnit = fieldOrDatumDef['timeUnit']; + const dataSourceTypeForScaleDomain = getScaleDataSourceForHandlingInvalidValues({ + invalid: getMarkConfig('invalid', markDef, config), + isPath: isPathMark(mark) + }); + if (isDomainUnionWith(domain)) { const defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel); @@ -266,7 +273,7 @@ function parseSingleChannelDomain( return makeImplicit([[0, 1]]); } - const data = model.requestDataName(DataSourceType.Main); + const data = model.requestDataName(dataSourceTypeForScaleDomain); return makeImplicit([ { data, @@ -289,15 +296,14 @@ function parseSingleChannelDomain( const fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef if (domain === 'unaggregated') { - const data = model.requestDataName(DataSourceType.Main); const {field} = fieldOrDatumDef; return makeImplicit([ { - data, + data: model.requestDataName(dataSourceTypeForScaleDomain), field: vgField({field, aggregate: 'min'}) }, { - data, + data: model.requestDataName(dataSourceTypeForScaleDomain), field: vgField({field, aggregate: 'max'}) } ]); @@ -315,7 +321,7 @@ function parseSingleChannelDomain( // If sort by aggregation of a specified sort field, we need to use RAW table, // so we can aggregate values for the scale independently from the main aggregation. data: util.isBoolean(sort) - ? model.requestDataName(DataSourceType.Main) + ? model.requestDataName(dataSourceTypeForScaleDomain) : model.requestDataName(DataSourceType.Raw), // Use range if we added it and the scale does not support computing a range as a signal. field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? {binSuffix: 'range'} : {}), @@ -343,7 +349,7 @@ function parseSingleChannelDomain( } else { return makeImplicit([ { - data: model.requestDataName(DataSourceType.Main), + data: model.requestDataName(dataSourceTypeForScaleDomain), field: model.vgField(channel, {}) } ]); @@ -353,7 +359,7 @@ function parseSingleChannelDomain( const fieldDef2 = encoding[getSecondaryRangeChannel(channel)]; if (hasBandEnd(fieldDef, fieldDef2, markDef, config)) { - const data = model.requestDataName(DataSourceType.Main); + const data = model.requestDataName(dataSourceTypeForScaleDomain); const bandPosition = getBandPosition({fieldDef, fieldDef2, markDef, config}); const isRectWithOffset = isRectBasedMark(mark) && bandPosition !== 0.5 && isXorY(channel); @@ -375,7 +381,7 @@ function parseSingleChannelDomain( // If sort by aggregation of a specified sort field, we need to use RAW table, // so we can aggregate values for the scale independently from the main aggregation. data: util.isBoolean(sort) - ? model.requestDataName(DataSourceType.Main) + ? model.requestDataName(dataSourceTypeForScaleDomain) : model.requestDataName(DataSourceType.Raw), field: model.vgField(channel), sort @@ -384,7 +390,7 @@ function parseSingleChannelDomain( } else { return makeImplicit([ { - data: model.requestDataName(DataSourceType.Main), + data: model.requestDataName(dataSourceTypeForScaleDomain), field: model.vgField(channel) } ]); diff --git a/src/compositemark/boxplot.ts b/src/compositemark/boxplot.ts index d6e37c9efd..b11df271d8 100644 --- a/src/compositemark/boxplot.ts +++ b/src/compositemark/boxplot.ts @@ -4,7 +4,8 @@ import {getMarkPropOrConfig} from '../compile/common'; import {Config} from '../config'; import {Encoding, extractTransformsFromEncoding, normalizeEncoding} from '../encoding'; import * as log from '../log'; -import {isMarkDef, MarkDef, MarkInvalidMixins} from '../mark'; +import {isMarkDef, MarkDef} from '../mark'; +import {MarkInvalidMixins} from '../invalid'; import {NormalizerParams} from '../normalize'; import {GenericUnitSpec, NormalizedLayerSpec, NormalizedUnitSpec} from '../spec'; import {AggregatedFieldDef, CalculateTransform, JoinAggregateTransform, Transform} from '../transform'; diff --git a/src/config.ts b/src/config.ts index e18ae6e766..4956261e2c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -601,7 +601,12 @@ export function initConfig(specifiedConfig: Config = {}): Config { } if (mergedConfig.scale) { - outputConfig.scale = replaceExprRef(mergedConfig.scale); + const {invalid, ...otherScaleConfig} = mergedConfig.scale; + const newScaleInvalid = replaceExprRef(invalid, {level: 1}); + outputConfig.scale = { + ...replaceExprRef(otherScaleConfig), + ...(keys(newScaleInvalid).length > 0 ? {invalid: newScaleInvalid} : {}) + }; } if (mergedConfig.style) { diff --git a/src/data.ts b/src/data.ts index c8fff6fd56..0c18396a07 100644 --- a/src/data.ts +++ b/src/data.ts @@ -152,10 +152,16 @@ export function isGraticuleGenerator(data: Partial | Partial): dat export enum DataSourceType { Raw, + /** Main data source for marks */ Main, Row, Column, - Lookup + Lookup, + /** Pre-filter-invalid data source for scale domains */ + PreFilterInvalid, + + /** Post-filter-invalid data source for scale domains */ + PostFilterInvalid } export type Generator = SequenceGenerator | SphereGenerator | GraticuleGenerator; diff --git a/src/expr.ts b/src/expr.ts index 06bb922386..c7f217a9a5 100644 --- a/src/expr.ts +++ b/src/expr.ts @@ -13,11 +13,11 @@ export function isExprRef(o: any): o is ExprRef { return !!o?.expr; } -export function replaceExprRef>(index: T) { +export function replaceExprRef>(index: T, {level}: {level: number} = {level: 0}) { const props = keys(index || {}); const newIndex: Dict = {}; for (const prop of props) { - newIndex[prop] = signalRefOrValue(index[prop]); + newIndex[prop] = level === 0 ? signalRefOrValue(index[prop]) : replaceExprRef(index[prop], {level: level - 1}); } return newIndex as MappedExclude; } diff --git a/src/invalid.ts b/src/invalid.ts new file mode 100644 index 0000000000..006d400d11 --- /dev/null +++ b/src/invalid.ts @@ -0,0 +1,77 @@ +import {SignalRef} from 'vega'; +import {ScaleChannel} from './channel'; +import {Mark, MarkDef} from './mark'; +import {isObject} from 'vega-util'; + +/** + * Mixins for Vega-Lite Spec's Mark Definiton (to add mark.invalid) + */ +export interface MarkInvalidMixins { + /** + * Invalid data mode, which defines how the marks and corresponding scales should represent invalid values (`null` and `NaN` in continuous scales *without* defined output for invalid values). + * + * - `"filter"` — *Exclude* all invalid values from the visualization's *marks* and *scales*. + * For path marks (for line, area, trail), this option will create paths that connect valid points, as if the data rows with invalid values do not exist. + * + * - `"break-paths-filter-domains"` — + * Break path marks (for line, area, trail) at invalid values. For non-path marks, this is equivalent to `"filter"`. + * All *scale* domains will *exclude* these filtered data points. + * + * - `"break-paths-show-domains"` — + * Break paths (for line, area, trail) at invalid values. Hide invalid values for non-path marks. + * All *scale* domains will *include* these filtered data points (for both path and non-path marks). + * + * - `"show"` or `null` — + * Show all data points in the marks and scale domains. Each scale will use the output for invalid values defined in `config.scale.invalid` + * or, if unspecified, by default invalid values will produce the same visual values as zero (if the scale includes zero) or the minimum value (if the scale does not include zero). + * + * - `"break-paths-show-path-domains"` (default) — + * This is equivalent to `"break-paths-show-domains"` for path-based marks (line/area/trail) + * and `"filter"` for non-path marks. + * + * __Note__: If any channel's scale has an output for invalid values defined in `config.scale.invalid`, + * all values for the scales will be considered "valid" since they can produce a reasonable output for the scales. + * Thus, fields for such channels will not be filtered and will not cause path breaks. + */ + invalid?: MarkInvalidDataMode | null; +} + +export type MarkInvalidDataMode = + | 'filter' + | 'break-paths-filter-domains' + | 'break-paths-show-domains' + | 'break-paths-show-path-domains' + | 'show'; + +/** + * Mixins for Vega-Lite Spec's config.scale + */ +export interface ScaleInvalidDataConfigMixins { + /** + * An object that defines scale outputs per channel for invalid values (nulls and NaNs on a continuous scale). + * - The keys in this object are the scale channels. + * - The values is either `"zero-or-min"` (use zero if the scale includes zero or min value otherwise) or a value definition `{value: ...}`. + * + * _Example:_ Setting this `config.scale.invalid` property to `{color: {value: '#aaa'}}` + * will make the visualization color all invalid values with '#aaa'. + * + * See [https://vega.github.io/vega-lite/docs/invalid-data.html](Invalid Data Docs) for more details. + */ + invalid?: ScaleInvalidDataConfig; +} + +export type ScaleInvalidDataConfig = { + [c in ScaleChannel]?: ScaleInvalidDataShowAs; +}; + +export type ScaleInvalidDataShowAs = ScaleInvalidDataShowAsValue | 'zero-or-min'; + +export type ScaleInvalidDataShowAsValue = { + value: MarkDef[C]; +}; + +export function isScaleInvalidDataIncludeAsValue( + invalidDataMode: ScaleInvalidDataShowAs +): invalidDataMode is ScaleInvalidDataShowAsValue { + return isObject(invalidDataMode) && 'value' in invalidDataMode; +} diff --git a/src/mark.ts b/src/mark.ts index a779ff0421..16d3d385c1 100644 --- a/src/mark.ts +++ b/src/mark.ts @@ -3,6 +3,7 @@ import {CompositeMark, CompositeMarkDef} from './compositemark'; import {ExprRef} from './expr'; import {Flag, keys} from './util'; import {MapExcludeValueRefAndReplaceSignalWith} from './vega.schema'; +import {MarkInvalidMixins} from './invalid'; /** * All types of primitive marks. @@ -45,7 +46,11 @@ export function isMark(m: string): m is Mark { return m in Mark; } -export function isPathMark(m: Mark | CompositeMark): m is 'line' | 'area' | 'trail' { +export const PATH_MARKS = ['line', 'area', 'trail'] as const; + +export type PathMark = (typeof PATH_MARKS)[number]; + +export function isPathMark(m: Mark | CompositeMark): m is PathMark { return ['line', 'area', 'trail'].includes(m); } @@ -72,18 +77,6 @@ export interface TooltipContent { content: 'encoding' | 'data'; } -/** @hidden */ -export type Hide = 'hide'; - -export interface MarkInvalidMixins { - /** - * Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`). - * - If set to `"filter"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks). - * - If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes. - */ - invalid?: 'filter' | Hide | null; -} - export interface VLOnlyMarkConfig extends ColorMixins, MarkInvalidMixins { /** * Whether the mark's color should be used as fill color instead of stroke color. @@ -345,7 +338,7 @@ export const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX: { export const defaultMarkConfig: MarkConfig = { color: '#4c78a8', - invalid: 'filter', + invalid: 'break-paths-show-path-domains', timeUnitBandSize: 1 }; diff --git a/src/scale.ts b/src/scale.ts index b0569b392d..38033dcc0a 100644 --- a/src/scale.ts +++ b/src/scale.ts @@ -8,12 +8,13 @@ import { TimeInterval, TimeIntervalStep } from 'vega'; -import {isString} from 'vega-util'; import type {ColorScheme} from 'vega-typings'; +import {isString} from 'vega-util'; import * as CHANNEL from './channel'; import {Channel, isColorChannel} from './channel'; import {DateTime} from './datetime'; import {ExprRef} from './expr'; +import {ScaleInvalidDataConfigMixins} from './invalid'; import * as log from './log'; import {ParameterExtent} from './selection'; import {NOMINAL, ORDINAL, QUANTITATIVE, TEMPORAL, Type} from './type'; @@ -180,7 +181,7 @@ export function isContinuousToDiscrete(type: ScaleType): type is 'quantile' | 'q return CONTINUOUS_TO_DISCRETE_SCALES.has(type); } -export interface ScaleConfig { +export interface ScaleConfig extends ScaleInvalidDataConfigMixins { /** * If true, rounds numeric output values to integers. * This can be helpful for snapping to the pixel grid. @@ -324,7 +325,7 @@ export interface ScaleConfig { minBandSize?: number; /** - * The default max value for mapping quantitative fields to text's size/fontSize. + * The default max value for mapping quantitative fields to text's size/fontSize scale. * * __Default value:__ `40` * @@ -333,7 +334,7 @@ export interface ScaleConfig { maxFontSize?: number; /** - * The default min value for mapping quantitative fields to tick's size/fontSize scale. + * The default min value for mapping quantitative fields to text's size/fontSize scale. * * __Default value:__ `8` * diff --git a/test/compile/data/filterinvalid.test.ts b/test/compile/data/filterinvalid.test.ts index 3eaddce808..fe1b272a7d 100644 --- a/test/compile/data/filterinvalid.test.ts +++ b/test/compile/data/filterinvalid.test.ts @@ -1,11 +1,16 @@ import {FilterInvalidNode} from '../../../src/compile/data/filterinvalid'; +import {getDataSourcesForHandlingInvalidValues} from '../../../src/compile/invalid/datasources'; import {UnitModel} from '../../../src/compile/unit'; import {NormalizedUnitSpec, TopLevel} from '../../../src/spec'; import {mergeDeep} from '../../../src/util'; import {parseUnitModelWithScale} from '../../util'; function parse(model: UnitModel) { - return FilterInvalidNode.make(null, model); + const dataSourcesForHandlingInvalidValues = getDataSourcesForHandlingInvalidValues({ + invalid: 'filter', + isPath: false + }); + return FilterInvalidNode.make(null, model, dataSourcesForHandlingInvalidValues); } describe('compile/data/filterinvalid', () => { @@ -42,11 +47,11 @@ describe('compile/data/filterinvalid', () => { }); }); - it('should add no null filter if when invalid is null', () => { + it('should add no null filter if when invalid is show', () => { const model = parseUnitModelWithScale( mergeDeep>(spec, { config: { - mark: {invalid: null} + mark: {invalid: 'show'} } }) ); diff --git a/test/compile/invalid/ChannelInvalidDataMode.test.ts b/test/compile/invalid/ChannelInvalidDataMode.test.ts new file mode 100644 index 0000000000..8ae9fb0169 --- /dev/null +++ b/test/compile/invalid/ChannelInvalidDataMode.test.ts @@ -0,0 +1,201 @@ +import {NONPOSITION_SCALE_CHANNELS, POSITION_SCALE_CHANNELS, SCALE_CHANNELS} from '../../../src/channel'; +import {getScaleInvalidDataMode} from '../../../src/compile/invalid/ScaleInvalidDataMode'; +import {defaultConfig} from '../../../src/config'; +import {MarkInvalidDataMode} from '../../../src/invalid'; +import {PATH_MARKS, PRIMITIVE_MARKS} from '../../../src/mark'; + +describe('compile / invalid / ChannelInvalidDataMode / getChannelInvalidDataMode()', () => { + const ALL_MARK_INVALID_MODE: MarkInvalidDataMode[] = [ + 'filter', + 'break-paths-filter-domains', + 'break-paths-show-domains', + 'show', + 'break-paths-show-path-domains' + ]; + + describe.each([...PRIMITIVE_MARKS])('For all marks (%s)', mark => { + it.each(ALL_MARK_INVALID_MODE)('should return always valid for count', invalid => { + expect( + getScaleInvalidDataMode({ + markDef: {type: mark, invalid}, + scaleChannel: 'color', + scaleType: 'linear', + isCountAggregate: true, + config: { + ...defaultConfig, + scale: { + ...defaultConfig.scale, + invalid: {color: {value: 'red'}} + } + } + }) + ).toBe('always-valid'); + }); + + it.each(ALL_MARK_INVALID_MODE)('should return always valid for count', invalid => { + expect( + getScaleInvalidDataMode({ + markDef: {type: mark, invalid}, + scaleChannel: 'color', + scaleType: 'band', + isCountAggregate: true, + config: { + ...defaultConfig, + scale: { + ...defaultConfig.scale, + invalid: {color: {value: 'red'}} + } + } + }) + ).toBe('always-valid'); + }); + + it.each(ALL_MARK_INVALID_MODE)( + 'should return "include" for all invalid mode (%s) if invalid output color is specified', + invalid => { + expect( + getScaleInvalidDataMode({ + markDef: {type: mark, invalid}, + scaleChannel: 'color', + scaleType: 'linear', + isCountAggregate: false, + config: { + ...defaultConfig, + scale: { + ...defaultConfig.scale, + invalid: {color: {value: 'red'}} + } + } + }) + ).toBe('show'); + } + ); + + it.each(ALL_MARK_INVALID_MODE)( + 'should return "include" for all invalid mode (%s) if invalid output size is specified', + invalid => { + expect( + getScaleInvalidDataMode({ + markDef: {type: mark, invalid}, + scaleChannel: 'size', + scaleType: 'linear', + isCountAggregate: false, + config: { + ...defaultConfig, + scale: { + ...defaultConfig.scale, + invalid: {size: {value: 4}} + } + } + }) + ).toBe('show'); + } + ); + + describe.each(POSITION_SCALE_CHANNELS)('for all position scale channel (%s)', channel => { + it('should return include by default for include mode if scale invalid config is not specified', () => { + expect( + getScaleInvalidDataMode({ + markDef: {type: mark, invalid: 'show'}, + scaleChannel: channel, + scaleType: 'linear', + isCountAggregate: false, + config: { + ...defaultConfig, + scale: { + ...defaultConfig.scale, + invalid: {} + } + } + }) + ).toBe('show'); + }); + }); + + describe.each(NONPOSITION_SCALE_CHANNELS)('for all non-position scale channel (%s)', channel => { + it('should return show by default for show mode if scale invalid config is not specified', () => { + expect( + getScaleInvalidDataMode({ + markDef: {type: mark, invalid: 'show'}, + scaleChannel: channel, + scaleType: 'linear', + isCountAggregate: false, + config: { + ...defaultConfig, + scale: { + ...defaultConfig.scale, + invalid: {} + } + } + }) + ).toBe('show'); + }); + }); + + describe.each(SCALE_CHANNELS)('for all scale channel (%s)', channel => { + const OTHER_MODES: MarkInvalidDataMode[] = ['break-paths-filter-domains', 'break-paths-show-domains', 'filter']; + + it.each(OTHER_MODES)('should return the mode (%s)', mode => { + expect( + getScaleInvalidDataMode({ + markDef: {type: mark, invalid: mode}, + scaleChannel: channel, + scaleType: 'linear', + isCountAggregate: false, + config: { + ...defaultConfig, + scale: { + ...defaultConfig.scale, + invalid: {} + } + } + }) + ).toEqual(mode); + }); + }); + }); + + describe.each(PATH_MARKS)('For all path marks (%s)', mark => { + describe.each(SCALE_CHANNELS)('for all scale channel (%s)', channel => { + it('should return the mode (%s)', () => { + expect( + getScaleInvalidDataMode({ + markDef: {type: mark, invalid: 'break-paths-show-path-domains'}, + scaleChannel: channel, + scaleType: 'linear', + isCountAggregate: false, + config: { + ...defaultConfig, + scale: { + ...defaultConfig.scale, + invalid: {} + } + } + }) + ).toBe('break-paths-show-domains'); + }); + }); + }); + + describe.each(PATH_MARKS)('For all path marks (%s)', mark => { + describe.each(SCALE_CHANNELS)('for all scale channel (%s)', channel => { + it('should return the mode (%s)', () => { + expect( + getScaleInvalidDataMode({ + markDef: {type: mark, invalid: 'break-paths-show-path-domains'}, + scaleChannel: channel, + scaleType: 'linear', + isCountAggregate: false, + config: { + ...defaultConfig, + scale: { + ...defaultConfig.scale, + invalid: {} + } + } + }) + ).toBe('break-paths-show-domains'); + }); + }); + }); +}); diff --git a/test/compile/mark/area.test.ts b/test/compile/mark/area.test.ts index e1baae809f..d499536732 100644 --- a/test/compile/mark/area.test.ts +++ b/test/compile/mark/area.test.ts @@ -29,8 +29,8 @@ describe('Mark: Area', () => { }); const props = area.encodeEntry(model); - it('should end on axis', () => { - expect(props.y2).toEqual({field: {group: 'height'}}); + it("should end on axis's min", () => { + expect(props.y2).toEqual({signal: "scale('y', domain('y')[0])"}); }); it('should has no height', () => { @@ -70,8 +70,8 @@ describe('Mark: Area', () => { }); const props = area.encodeEntry(model); - it('should end on axis', () => { - expect(props.y2).toEqual({field: {group: 'height'}}); + it("should end on axis's min or zero", () => { + expect(props.y2).toEqual({signal: `scale('y', inrange(0, domain('y')) ? 0 : domain('y')[0])`}); }); it('should has no height', () => { @@ -177,8 +177,8 @@ describe('Mark: Area', () => { const props = area.encodeEntry(model); - it('should end on axis', () => { - expect(props.x2).toEqual({value: 0}); + it("should end on axis's min", () => { + expect(props.x2).toEqual({signal: `scale('x', domain('x')[0])`}); }); it('should have no width', () => { @@ -198,8 +198,8 @@ describe('Mark: Area', () => { const props = area.encodeEntry(model); - it('should end on axis', () => { - expect(props.x2).toEqual({value: 0}); + it("should end on axis's min or zero", () => { + expect(props.x2).toEqual({signal: "scale('x', inrange(0, domain('x')) ? 0 : domain('x')[0])"}); }); it('should have no width', () => { diff --git a/test/compile/mark/bar.test.ts b/test/compile/mark/bar.test.ts index 70939a6949..e08b1864ec 100644 --- a/test/compile/mark/bar.test.ts +++ b/test/compile/mark/bar.test.ts @@ -119,11 +119,11 @@ describe('Mark: Bar', () => { const props = bar.encodeEntry(model); expect(props.y).toEqual({scale: 'y', field: 'mean_Acceleration'}); - expect(props.y2).toEqual({field: {group: 'height'}}); + expect(props.y2).toEqual({signal: `scale('y', domain('y')[0])`}); expect(props.height).toBeUndefined(); }); - it('should draw vertical bar, with y from "group: height" to field value when zero=false for y-scale', () => { + it('should draw vertical bar, with y from zeroOrMin to field value when zero=false for y-scale', () => { const y: PositionFieldDef = { type: 'quantitative', field: 'Acceleration', @@ -141,11 +141,33 @@ describe('Mark: Bar', () => { const props = bar.encodeEntry(model); expect(props.y).toEqual({scale: 'y', field: 'mean_Acceleration'}); - expect(props.y2).toEqual({field: {group: 'height'}}); + expect(props.y2).toEqual({signal: `scale('y', inrange(0, domain('y')) ? 0 : domain('y')[0])`}); expect(props.height).toBeUndefined(); }); - it('should draw vertical bar, with y from "group: height" to field value when y-scale type is log', () => { + it('should draw vertical bar, with y from min to field value when explicit domain does not include zero for y-scale', () => { + const y: PositionFieldDef = { + type: 'quantitative', + field: 'Acceleration', + aggregate: 'mean', + scale: {domain: [1, 5]} + }; + const model = parseUnitModelWithScaleAndLayoutSize({ + data: {url: 'data/cars.json'}, + mark: 'bar', + encoding: { + x: {field: 'Origin', type: 'nominal'}, + y + } + }); + const props = bar.encodeEntry(model); + + expect(props.y).toEqual({scale: 'y', field: 'mean_Acceleration'}); + expect(props.y2).toEqual({signal: `scale('y', domain('y')[0])`}); + expect(props.height).toBeUndefined(); + }); + + it("should draw vertical bar, with y from axis's min to field value when y-scale type is log", () => { const model = parseUnitModelWithScaleAndLayoutSize({ data: {url: 'data/cars.json'}, mark: 'bar', @@ -157,7 +179,7 @@ describe('Mark: Bar', () => { const props = bar.encodeEntry(model); expect(props.y).toEqual({scale: 'y', field: 'mean_Acceleration'}); - expect(props.y2).toEqual({field: {group: 'height'}}); + expect(props.y2).toEqual({signal: `scale('y', domain('y')[0])`}); expect(props.height).toBeUndefined(); }); @@ -625,8 +647,8 @@ describe('Mark: Bar', () => { }); const props = bar.encodeEntry(model); - it('should end on axis and has no height', () => { - expect(props.y2).toEqual({field: {group: 'height'}}); + it("should end on axis's min and has no height", () => { + expect(props.y2).toEqual({signal: "scale('y', domain('y')[0])"}); expect(props.height).toBeUndefined(); }); }); @@ -643,8 +665,8 @@ describe('Mark: Bar', () => { const props = bar.encodeEntry(model); - it('should end on axis and has no width', () => { - expect(props.x2).toEqual({value: 0}); + it("should end on axis's min and has no width", () => { + expect(props.x2).toEqual({signal: `scale('x', domain('x')[0])`}); expect(props.width).toBeUndefined(); }); }); @@ -704,8 +726,8 @@ describe('Mark: Bar', () => { }); const props = bar.encodeEntry(model); - it('should end on axis nad have no height', () => { - expect(props.y2).toEqual({field: {group: 'height'}}); + it("should end on axis's or zero", () => { + expect(props.y2).toEqual({signal: `scale('y', inrange(0, domain('y')) ? 0 : domain('y')[0])`}); expect(props.height).toBeUndefined(); }); }); @@ -721,8 +743,8 @@ describe('Mark: Bar', () => { }); const props = bar.encodeEntry(model); - it('should end on axis and have no width', () => { - expect(props.x2).toEqual({value: 0}); + it("should end on axis's or zero and have no width", () => { + expect(props.x2).toEqual({signal: `scale('x', inrange(0, domain('x')) ? 0 : domain('x')[0])`}); expect(props.width).toBeUndefined(); }); }); diff --git a/test/compile/mark/encode/valueref.test.ts b/test/compile/mark/encode/valueref.test.ts index e662f3e7c8..53bb613a71 100644 --- a/test/compile/mark/encode/valueref.test.ts +++ b/test/compile/mark/encode/valueref.test.ts @@ -1,5 +1,5 @@ import {SecondaryFieldDef, TypedFieldDef} from '../../../../src/channeldef'; -import {midPoint, wrapPositionInvalidTest} from '../../../../src/compile/mark/encode/valueref'; +import {midPoint} from '../../../../src/compile/mark/encode/valueref'; import {defaultConfig} from '../../../../src/config'; describe('compile/mark/encode/valueref', () => { @@ -73,18 +73,4 @@ describe('compile/mark/encode/valueref', () => { expect(ref).toEqual({signal: 'scale("x", 0.5 * datum["bin_start"] + 0.5 * datum["bin_end"])'}); }); }); - - describe('wrapPositionInvalidTest()', () => { - it('does not wrap ref with test if markDef.invalid is filter', () => { - expect( - wrapPositionInvalidTest({ - ref: {value: 1}, - markDef: {type: 'bar', invalid: 'filter'}, - fieldDef: null, - channel: null, - config: defaultConfig - }) - ).toEqual({value: 1}); - }); - }); }); diff --git a/test/compile/mark/point.test.ts b/test/compile/mark/point.test.ts index ba91472b95..f6065fa271 100644 --- a/test/compile/mark/point.test.ts +++ b/test/compile/mark/point.test.ts @@ -238,7 +238,7 @@ describe('Mark: Point', () => { it('should test for invalid values on y', () => { expect(props.y).toEqual([ - {field: {group: 'height'}, test: '!isValid(datum["yield"]) || !isFinite(+datum["yield"])'}, + {scale: 'y', value: 0, test: '!isValid(datum["yield"]) || !isFinite(+datum["yield"])'}, {scale: Y, field: 'yield'} ]); }); @@ -289,6 +289,26 @@ describe('Mark: Point', () => { expect(props.stroke).toEqual({scale: COLOR, field: 'yield'}); }); }); + describe('with x, y, color with invalid color specified', () => { + const model = parseUnitModelWithScaleAndLayoutSize( + pointXY( + { + color: {field: 'yield', type: 'quantitative'} + }, + { + scale: {invalid: {color: {value: 'red'}}} + } + ) + ); + const props = point.encodeEntry(model); + + it('should have scale for color', () => { + expect(props.stroke).toEqual([ + {test: '!isValid(datum["yield"]) || !isFinite(+datum["yield"])', value: 'red'}, + {scale: COLOR, field: 'yield'} + ]); + }); + }); describe('with x, y, and condition-only color', () => { const model = parseUnitModelWithScaleAndLayoutSize({ diff --git a/test/compile/mark/text.test.ts b/test/compile/mark/text.test.ts index 338b103183..2da1adf086 100644 --- a/test/compile/mark/text.test.ts +++ b/test/compile/mark/text.test.ts @@ -215,7 +215,7 @@ describe('Mark: Text', () => { }, data: {url: 'data/cars.json'}, config: { - mark: {invalid: 'hide'} + mark: {invalid: 'break-paths-show-domains'} } }; const model = parseModelWithScale(spec); @@ -242,16 +242,10 @@ describe('Mark: Text', () => { }); it('should map color to fill', () => { - expect(props.fill).toEqual([ - { - test: '!isValid(datum["mean_Acceleration"]) || !isFinite(+datum["mean_Acceleration"])', - value: null - }, - { - scale: 'color', - field: 'mean_Acceleration' - } - ]); + expect(props.fill).toEqual({ + scale: 'color', + field: 'mean_Acceleration' + }); }); it('should map size to fontSize', () => { diff --git a/test/compile/selection/layers.test.ts b/test/compile/selection/layers.test.ts index 050b085935..c1d072e143 100644 --- a/test/compile/selection/layers.test.ts +++ b/test/compile/selection/layers.test.ts @@ -43,7 +43,7 @@ describe('Layered Selections', () => { } } ], - config: {mark: {tooltip: null, invalid: 'hide'}} + config: {mark: {tooltip: null, invalid: 'break-paths-show-domains'}} }); layers.parse(); @@ -85,16 +85,10 @@ describe('Layered Selections', () => { signal: '"Horsepower: " + (format(datum["Horsepower"], "")) + "; Miles_per_Gallon: " + (format(datum["Miles_per_Gallon"], "")) + "; Origin: " + (isValid(datum["Origin"]) ? datum["Origin"] : ""+datum["Origin"])' }, - fill: [ - { - test: '!isValid(datum["Horsepower"]) || !isFinite(+datum["Horsepower"]) || !isValid(datum["Miles_per_Gallon"]) || !isFinite(+datum["Miles_per_Gallon"])', - value: null - }, - { - scale: 'color', - field: 'Origin' - } - ], + fill: { + scale: 'color', + field: 'Origin' + }, shape: { value: 'circle' }, @@ -133,16 +127,10 @@ describe('Layered Selections', () => { signal: '"Horsepower: " + (format(datum["Horsepower"], "")) + "; Miles_per_Gallon: " + (format(datum["Miles_per_Gallon"], "")) + "; Origin: " + (isValid(datum["Origin"]) ? datum["Origin"] : ""+datum["Origin"])' }, - fill: [ - { - test: '!isValid(datum["Horsepower"]) || !isFinite(+datum["Horsepower"]) || !isValid(datum["Miles_per_Gallon"]) || !isFinite(+datum["Miles_per_Gallon"])', - value: null - }, - { - scale: 'color', - field: 'Origin' - } - ], + fill: { + scale: 'color', + field: 'Origin' + }, shape: { value: 'square' }, @@ -176,25 +164,13 @@ describe('Layered Selections', () => { signal: '"Horsepower: " + (format(datum["Horsepower"], "")) + "; Miles_per_Gallon: " + (format(datum["Miles_per_Gallon"], "")) + "; Origin: " + (isValid(datum["Origin"]) ? datum["Origin"] : ""+datum["Origin"])' }, - fill: [ - { - test: '!isValid(datum["Horsepower"]) || !isFinite(+datum["Horsepower"]) || !isValid(datum["Miles_per_Gallon"]) || !isFinite(+datum["Miles_per_Gallon"])', - value: null - }, - { - value: 'transparent' - } - ], - stroke: [ - { - test: '!isValid(datum["Horsepower"]) || !isFinite(+datum["Horsepower"]) || !isValid(datum["Miles_per_Gallon"]) || !isFinite(+datum["Miles_per_Gallon"])', - value: null - }, - { - scale: 'color', - field: 'Origin' - } - ], + fill: { + value: 'transparent' + }, + stroke: { + scale: 'color', + field: 'Origin' + }, x: { scale: 'x', field: 'Horsepower' diff --git a/test/compile/selection/parse.test.ts b/test/compile/selection/parse.test.ts index 1b0ac8fa42..8486e07632 100644 --- a/test/compile/selection/parse.test.ts +++ b/test/compile/selection/parse.test.ts @@ -371,32 +371,30 @@ describe('Selection', () => { lookupModel.parseData(); optimizeDataflow(lookupModel.component.data, lookupModel); - expect(assembleRootData(lookupModel.component.data, {})).toEqual( - expect.arrayContaining([ + const data = assembleRootData(lookupModel.component.data, {}); + expect(data[2]).toEqual({ + name: 'data_1', + source: 'data_0', + transform: [ { - name: 'data_1', - source: 'data_0', - transform: [ - { - type: 'filter', - expr: '!length(data("index_store")) || vlSelectionTest("index_store", datum)' - } - ] - }, + type: 'filter', + expr: '!length(data("index_store")) || vlSelectionTest("index_store", datum)' + } + ] + }); + + expect(data[3]).toEqual({ + name: 'data_2', + source: 'source_0', + transform: [ { - name: 'data_2', - source: 'source_0', - transform: [ - { - type: 'lookup', - from: 'data_1', - key: 'symbol', - fields: ['symbol'], - as: ['index'] - } - ] + type: 'lookup', + from: 'data_1', + key: 'symbol', + fields: ['symbol'], + as: ['index'] } - ]) - ); + ] + }); }); }); diff --git a/test/compile/selection/timeunit.test.ts b/test/compile/selection/timeunit.test.ts index 60c96f51f2..5ab2dee4c8 100644 --- a/test/compile/selection/timeunit.test.ts +++ b/test/compile/selection/timeunit.test.ts @@ -110,7 +110,7 @@ describe('Selection time unit', () => { y: {field: 'price', type: 'quantitative'} } }, - {mark: {invalid: 'hide'}} + {mark: {invalid: 'break-paths-show-domains'}} ); const data0 = getData(model).filter(d => d.name === 'data_0')[0].transform; const data1 = getData(model).filter(d => d.name === 'data_1')[0].transform;