Open jwoLondon opened 5 years ago
Thank you for filing the issues! Let's split them into separate issues so that we can decide for each whether they need to be fixed here or in Vega.
Thanks @jwoLondon!
Dates are a known source of cross-browser issues. In particular, if no format is provided, Vega defaults to Date.parse
, which varies across vendors. Your conclusion about providing and adhering to known date formats is good advice. Beyond that, I don't think there are any bugs to fix here. A longer-term feature request might be to abandon Date.parse
and build out our own standardized sets of date formats to apply as defaults... though that might prove painful.
We will need to investigate why we're seeing different "imputations" of the undefined y value. Looks like a Vega-level issue, and a potential bug to fix!
The gradient stops are assumed to be provided in ascending order, though I wouldn't be surprised if this is not sufficiently documented. At the Vega level we can consider adding a sort step prior to Canvas/SVG gradient generation. Feel free to file an enhancement issue.
Thanks again!
Following this twitter thread, there appear to be a number of differences in the way a spec is interpreted between browsers and between renderers. Whether all of these are 'bugs' or 'features' is debatable, but for the record I've isolated the problems:
1. Parsing Dates.
If a string data source representing years is specified as temporal, it can be correctly interpreted as such by Chrome and Safari without the need for an explicit format specification. If the year data field contains a non-integer, Chrome correctly encodes the position (e.g. interpreting 0.5 years as 6 months), but Safari encodes it as zero.
If an explicit format is provided, non-integer years are ignored by both Chrome and Safari.
Perhaps this just needs a warning in the documentation against using non-integer values for dates even if they apparently work in some browsers (and more generally, the advice to always specify an explicit parsing format for date-time strings).
2. Missing Data with Line and Area Marks
The following spec that contains 'ragged' data with a missing y-value is displayed as we might expect in Chrome, with an x-domain scale set to the full range of x values [1,4], but the mark shown only for complete x,y pairs [1,3]:
But in Safari, the missing y value is interpreted as the maximum y-domain value:
A partial non-data transformation workaround is to constrain the domain and set mark clipping to true, but this can cause problems in layered composite views that may need to share the full [1,4] domain.
3. Stops Offset Order in Gradient Spec
If order of offsets in a VL4 gradient
stops
specification has the higher value first, the gradient is not rendered correctly when the renderer is SVG. There is no problem if rendered as Canvas.While the workaround is simply to ensure that the order of offsets in the
stops
array is from low to high (i.e. with thered
line before theblue
line in example above), this is unintuitive behaviour and not obvious to spot if testing with a Canvas renderer.