Skip to content
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

vega-interpreter does not handle datetimes consistently #3632

Open
6 tasks done
kmcgrady opened this issue Dec 17, 2022 · 0 comments · May be fixed by #3913
Open
6 tasks done

vega-interpreter does not handle datetimes consistently #3632

kmcgrady opened this issue Dec 17, 2022 · 0 comments · May be fixed by #3913
Labels
bug For bugs or other software errors

Comments

@kmcgrady
Copy link

kmcgrady commented Dec 17, 2022

Please:

  • Check for duplicate issues. Please file separate requests as separate issues on GitHub.
  • Describe how to reproduce the bug.
  • Use the latest Vega version, if possible. Always indicate which version you are using.
  • If you are using Kibana, first read the instructions for posting Kibana Vega issues.
  • Include error messages or gifs/screenshots of problematic behavior, if applicable.
  • Provide an example specification and accessible data. Try to provide the simplest specification that reproduces the problem. To share a specification, use the Vega-Editor and click "Share" to embed a working link, or provide an example spec in JSON, wrapped by triple backticks like this:

Summary

The issue is not with the JSON, but it's with the use of the expression interpreter. It looks like using a string date is not working with the expression interpreter.

Live Example

See https://codepen.io/kmcgrady/pen/YzjKQXy for an example

image

Observations

The docs seem confusing and suggest to not allow string dates.

However, vega-lite takes the input and just passes it on.

This definitely causes a problem because the interpreter takes it and fails.

So the problem can be one of the following:

  1. Vega Lite does not validate the datetime to be proper numerical values
  2. The interpreter is not open to accepting a string date or numerical values

I think the answer is (2) The interpreter should accept both. I think String dates are common and would match what already works. I can create a PR if there's an example.

Versions

vega-embed@6.21.0
vega@5.22.1
vega-lite@5.6.0
vega-interpreter@1.0.4

JSON Example

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "description": "Google's stock price over time.",
  "data": {"url": "https://cdn.jsdelivr.net/npm/vega-datasets@2.5.3/data/stocks.csv"},
  "transform": [{"filter": "datum.symbol==='GOOG'"}],
  "mark": "line",
  "encoding": {
    "x": {
      "field": "date",
      "scale": {"domain": ["2004-08-01T00:00:00", "2010-03-01T00:00:00"]},
      "type": "temporal"
    },
    "y": {"field": "price", "type": "quantitative"}
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For bugs or other software errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant