Vega-lite: Weird output included in the bin transform

Created on 18 Jan 2017  路  6Comments  路  Source: vega/vega-lite

Given this spec,

{
  "description": "A scatterplot showing horsepower and miles per gallons.",
  "data": {"url": "data/cars.json"},
  "mark": "point",
  "encoding": {
    "x": {"field": "Horsepower", "type": "quantitative"},
    "y": {"field": "Miles_per_Gallon", "type": "quantitative"},
    "color": {"bin": "true", "field": "Acceleration", "type": "quantitative"}
  },
  "config": {"numberFormat": "d"}
}

The output bin transform contains this weird output

{
          "0": "t",
          "1": "r",
          "2": "u",
          "3": "e",
          "type": "bin",
          "field": "Acceleration",
          "as": ["bin_Acceleration_start","bin_Acceleration_end"],
          "extent": {"signal": "Acceleration_extent"},
          "maxbins": 10
        }
Bug

Most helpful comment

{
  "0": "L",
  "1": "o",
  "2": "l",
  "3": "."
}

All 6 comments

This is probably contributing to the validation fail.

Lol.

{
  "0": "L",
  "1": "o",
  "2": "l",
  "3": "."
}

The spec is incorrect. bin has to be true, not "true".

{
  "description": "A scatterplot showing horsepower and miles per gallons.",
  "data": {"url": "data/cars.json"},
  "mark": "point",
  "encoding": {
    "x": {"field": "Horsepower", "type": "quantitative"},
    "y": {"field": "Miles_per_Gallon", "type": "quantitative"},
    "color": {"bin": true, "field": "Acceleration", "type": "quantitative"}
  },
  "config": {"numberFormat": "d"}
}

Oh god ><"

@jheer

{
  "description": "A scatterplot showing horsepower and miles per gallons.",
  "data": {"url": "data/cars.json"},
  "mark": "point",
  "encoding": {
    "x": {"field": "Horsepower", "type": "quantitative"},
    "y": {"field": "Miles_per_Gallon", "type": "quantitative"},
    "color": {"bin": "Lol.", "field": "Acceleration", "type": "quantitative"}
  },
  "config": {"numberFormat": "d"}
}

in fact generates

        {
          "0": "L",
          "1": "o",
          "2": "l",
          "3": ".",
          "type": "bin",
          "field": "Acceleration",
          "as": ["bin_Acceleration_start","bin_Acceleration_end"],
          "extent": {"signal": "Acceleration_extent"},
          "maxbins": 10
        },

The reason for this behavior is this line in the code typeof bin === 'boolean' ? {} : bin. But our schema does not allow strings and won't accept the spec above. Just add "$schema": "https://vega.github.io/schema/vega-lite/v2.json", and you see that vscode complains.

screen shot 2017-01-17 at 21 34 43

Was this page helpful?
0 / 5 - 0 ratings

Related issues

infai-feineis picture infai-feineis  路  3Comments

domoritz picture domoritz  路  4Comments

kanitw picture kanitw  路  3Comments

kanitw picture kanitw  路  4Comments

mcnuttandrew picture mcnuttandrew  路  3Comments