vega-lite
vega-lite copied to clipboard
Infer quantitative and temporal types for encoding fields
I noticed that when using datum
in an encoding field, the type is inferred automatically:
When using a column/field name instead of datum
the default is nominal regardless of the type of values in the data. I am guessing this is because the data values are not necessarily directly present in the VegaLite spec (could be a URL e.g.). I wonder if it would be possible to do a lookup similar to the transform_calculate
+ datum[column_name]
approach demonstrated in https://github.com/vega/vega-lite/issues/7365#issuecomment-1058909767 to inspect at the first value of each field/column in the data, and then infer the type of that value using the same rules as datum
is currently using and apply it as the default type for that encoding field?
Yes, I had this idea before and what we need is infrastructure for tracking data through transforms and to encodings. It would need someone to dig into the compiler a bit deeper but it should be totally doable.