Invalid scale reference causes domain pollution (for multi-field data ref domain)
See original GitHub issueIn the following spec, the fill spec for the right axis causes an undefined value to appear in the color scale’s domain. Verified in the REPL by viewing the rendered legend and also by logging VEGA_DEBUG.view._runtime.scales.color.value.domain() (returns ["A", "B", "val", undefined]).
Removing the right axis fill spec fixes the problem. The fill spec in question is invalid, as the axis encoding must map to a single color; the same spec used e.g. within a mark encoding does not trigger this issue.
Not a problem for me now that I understand I have an incorrect usage I need to fix, but it took me a while to figure out why my domain was rendering an undefined value…
{
"$schema": "https://vega.github.io/schema/vega/v3.0.json",
"width": 400,
"height": 300,
"data": [
{
"name": "dataset",
"values": [
{"bin": "A", "val": 10},
{"bin": "B", "val": 20},
{"bin": "A", "val": 30},
{"bin": "B", "val": 40}
]
}
],
"scales": [
{
"name": "y",
"type": "linear",
"domain": {
"data": "dataset",
"field": "y_out"
},
"zero": true,
"range": "height"
},
{
"name": "color",
"type": "ordinal",
"domain": {
"fields": [
{"data": "dataset", "field": "bin"},
["val"]
]
},
"range": ["#DDB27C", "#11939a", "#11939a"]
}
],
"axes": [
{
"orient": "left",
"scale": "y",
"title": "left side",
"encode": {
"title": {
"update": {
"fill": {
"signal": "scale('color', 'val')"
}
}
}
}
},
{
"orient": "right",
"scale": "y",
"title": "right side",
"encode": {
"title": {
"update": {
"fill": {
"scale": "color",
"field": "bin"
}
}
}
}
}
],
"legends": [
{
"fill": "color"
}
]
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Untitled
Legacy of the void units terran, Produtos para cabelos, ... Rural china pollution, Ducati monster 821 mpg, Przystanek woodstock 2013 data?
Read more >efficient robust domain-decomposition: Topics by Science.gov
Parallel Domain Decomposition Formulation and Software for Large-Scale Sparse ... Quantitative comparisons are also made against reference data.
Read more >CWE Version 4.9 - Common Weakness Enumeration - MITRE
CWE-86: Improper Neutralization of Invalid Characters in Identifiers in ... CWE-942: Permissive Cross-domain Policy with Untrusted Domains.
Read more >(PDF) Multifield Theories in Mechanics of Solids - ResearchGate
The chapter focuses on the multifield description of continua that is a flexible framework to study physical situations in which the analysis of ......
Read more >frequent-classes - CodaLab Worksheets
... lang 6476 card 6475 format 6465 data 6458 viewport 6458 14 6448 animated ... 1491 rs 1486 domain 1484 skiptranslate 1484 overview...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Ha, I win by one second 😉
Right now, one can define an ordinal scale with a range (e.g., category10) and no corresponding domain definition. The domain is then populated as values are passed through the scale function. As we have supported this since Vega 1, I’d be hesitant to break this feature. On the other hand, if a domain is explicitly defined within the spec, it seems reasonable to me to disable automatic domain extension when new values are encountered.