-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to: deal with explicitly setting null values in data? #7
Comments
I guess we have several choices here in addition to direct JSON encoding.
data =
dataFromColumns []
<< dataColumn "x" (nums [ 1, 2, 3 ])
<< dataColumn "y" (nums [ 10, 30, 0 / 0 ]) While this works, it feels ugly to me and not sure how Haskell would handle that. Also litvis doesn't handle expressions that generate invalid numbers like this. So I agree we probably need something else.
nullNum : Float
nullNum =
0 / 0 Again I don't like this solution much, but it is at least an option with the current implementation.
data =
dataFromColumns []
<< dataColumn "x" (nums [ 1, 2, 3 ])
<< dataColumn "y" (maybeNums [ Just 10, Just 30, Nothing ]) This would be the most idiomatic Elm (and presumably easily translatable into Haskell), but is rather verbose. The question is whether the benefits of this make it worthwhile given we can always replicate with direct JSON encoding. |
In Haskell For For It may well be an issue that's not worth addressing at this time. I don't have any feel for how people are using the API when they are creating the data: are they just using |
Here's another example that I don't think we can encode with the current DataValue/dataRow setup: https://vega.github.io/vega-lite/examples/facet_bullet.html - namely rows like
I ended up using dataFromJson to encode this. While you could extend DataValue with a constructor that takes DataValues, I'm not sure that's a sensible change. So this does suggest that it's not worth changing the current setup, and just point users to |
I've added a This also now allows |
This is from #6, and is perhaps less-important than the others from that ticket, since I think you can work around this by providing data directly in JSON
*) Line Chart with Markers and Invalid Values
I experimentally added a NullValue constructor to DataValue, but I am not 100% happy with this choice, to be able to represent the following data:
...
The text was updated successfully, but these errors were encountered: