Open gs0-pix4d opened 2 years ago
Can you look the Vega code to see what needs to be fixed and send a pull request?
I would be OK to do it, however I have zero knowledge about the code-base, and I'm a very new Vega user (about two weeks, on and off). I wouldn't know where to start digging and how to debug the behavior.
First of all, is it sure that converting to string is the right thing to do? I was wondering if facetting could have a special meaning on fields that are arrays (such as facetting per array element, for example). In other words, what is (or "are" if it's configurable) the expected outcomes for a dataset like that one (not even talking about boxplots)?
[
{"val": 3, "groups": ["A", "B"]},
{"val": 5, "groups": ["A"]}
]
I don't think we facet per value. If you wanted that, you could explicitly flatten the field first. Using an array should result in a multi-line label.
Reading your first comment again, I think you mean digging through the converted-to-Vega specification code, rather than the Vega source code itself.
Here is the somewhat minimal Vega code I could get where I only removed stuff (and updating scales → domain → fields → data
to use the source data). At this point, changing anything makes the visualization go wrong in some way, and I could not find a way to change the grammar to fix the problem nicely: casting the array toString of course works, but that's not the intended fix and we want to keep the new line in the label when using an array of strings.
Please:
vl2svg
to reproduce the bug.In the following example, the rendering is broken for Study
["A", "B"]
, Project2
, using either facet or row: remove the leading_
from the row specification to try switching between the two (and disable thefacet
accordingly)Adding the following transform fixes the problem:
"transform": [{"calculate": "join(datum.study)", "as": "study"}],
. In other words, when the field is not an array but a string, everything is alright.My tests are run using
vl2svg
cli tool.Broken rendering:
Cast to string:
A more complex example (using real world data, please excuse the crushed boxes of the plot) looks like that:
You can see that Case 12 seems to work well, and Case 11 has proper data in front of PREFIX-variant4, while all the others are stuck to the top of the plot area.