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

Empty vega plot if spec has invalid param #900

Open
ahuang11 opened this issue Dec 26, 2024 · 0 comments
Open

Empty vega plot if spec has invalid param #900

ahuang11 opened this issue Dec 26, 2024 · 0 comments

Comments

@ahuang11
Copy link
Contributor

ahuang11 commented Dec 26, 2024

The offending line is:


      scale:
        scheme: diverging
min_height: 500
pipeline:
  source:
    tables:
      normalized_totals_passengers_flights: "WITH cleaned_passengers AS (\n    SELECT\n\
        \        \"Year\",\n        \"Month\",\n        TRY_CAST(REPLACE(REPLACE(\"\
        TOTAL\", ',', ''), ' ', '') AS INTEGER) AS total_passengers\n    FROM read_csv('passengers.csv')\n\
        ),\ncleaned_flights AS (\n    SELECT\n        \"Year\",\n        \"Month\"\
        ,\n        TRY_CAST(REPLACE(REPLACE(\"TOTAL\", ',', ''), ' ', '') AS INTEGER)\
        \ AS total_flights\n    FROM read_csv('flights.csv')\n),\njoined_data AS (\n\
        \    SELECT\n        p.\"Year\",\n        COALESCE(p.total_passengers, 0)\
        \ AS total_passengers,\n        COALESCE(f.total_flights, 0) AS total_flights\n\
        \    FROM cleaned_passengers p\n    JOIN cleaned_flights f ON p.\"Year\" =\
        \ f.\"Year\"\n)\nSELECT\n    \"Year\",\n    total_passengers,\n    total_flights,\n\
        \    total_passengers * 1.0 / MAX(total_passengers) OVER () AS normalized_passengers,\n\
        \    total_flights * 1.0 / MAX(total_flights) OVER () AS normalized_flights\n\
        FROM joined_data"
    type: duckdb
    uri: ':memory:'
  sql_transforms:
  - limit: 1000000
    type: sql_limit
  table: normalized_totals_passengers_flights
sizing_mode: stretch_both
spec:
  $schema: https://vega.github.io/schema/vega-lite/v5.json
  data:
    url: data/normalized_totals_passengers_flights.csv
  description: A scatter plot showing the relationship between normalized passengers
    and normalized flights, colored by year using a diverging colormap.
  encoding:
    color:
      field: Year
      scale:
        scheme: diverging
      title: Year
      type: ordinal
    tooltip:
    - field: Year
      type: ordinal
    - field: normalized_passengers
      type: quantitative
    - field: normalized_flights
      type: quantitative
    x:
      field: normalized_passengers
      title: Normalized Passengers
      type: quantitative
    y:
      field: normalized_flights
      title: Normalized Flights
      type: quantitative
  height: container
  mark: point
  title: Relationship Between Normalized Passengers and Normalized Flights by Year
  width: container
type: vegalite
Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant