vega / vega-lite

A concise grammar of interactive graphics, built on Vega.
https://vega.github.io/vega-lite/
BSD 3-Clause "New" or "Revised" License
4.65k stars 606 forks source link

"bin" transform missing required "extent" #1729

Closed rgrzywinski closed 7 years ago

rgrzywinski commented 7 years ago

I'm playing around with vega-3 (vega-lite-2) in Voyager2 and I'm seeing that vega-lite is generating a "bin" transform with a missing "extent". Below is the shorthand and resulting vega JSON:

bar|x:bin(Acceleration,q)|y:count(,q) `{"autosize":"pad","data":[{"name":"source","url":"data/cars.json","format":{"type":"json","parse":{"Acceleration":"number"}},"transform":[{"type":"filter","expr":"datum[\"Acceleration\"] !== null && !isNaN(datum[\"Acceleration\"])"},{"type":"bin","field":"Acceleration","as":["bin_Acceleration_start","bin_Acceleration_end"],"maxbins":10}]},{"name":"summary","source":"source","transform":[{"type":"aggregate","groupby":["bin_Acceleration_start","bin_Acceleration_end","bin_Acceleration_range"],"fields":[""],"ops":["count"]}]},{"name":"layout","values":[{}],"transform":[{"type":"formula","as":"width","expr":"200"},{"type":"formula","as":"height","expr":"200"}]}],"marks":[{"name":"main","type":"group","from":{"data":"layout"},"encode":{"update":{"width":{"field":"width"},"height":{"field":"height"}}},"marks":[{"name":"marks","type":"rect","from":{"data":"summary"},"encode":{"update":{"x2":{"scale":"x","field":"bin_Acceleration_start","offset":1},"x":{"scale":"x","field":"bin_Acceleration_end"},"y":{"scale":"y","field":"count"},"y2":{"scale":"y","value":0},"fill":{"value":"#4682b4"}}}}],"scales":[{"name":"x","type":"linear","round":true,"nice":true,"zero":false,"domain":{"data":"summary","field":["bin_Acceleration_start","bin_Acceleration_end"]},"range":[0,200]},{"name":"y","type":"linear","round":true,"nice":true,"zero":true,"domain":{"data":"summary","field":"count"},"range":[200,0]}],"axes":[{"scale":"x","grid":false,"orient":"bottom","title":"BIN(Acceleration)","zindex":1,"encode":{"labels":{"update":{"angle":{"value":270},"align":{"value":"center"},"baseline":{"value":"bottom"}}}}},{"scale":"y","format":"s","grid":true,"orient":"left","title":"COUNT","zindex":0}]}]}`

kanitw commented 7 years ago

Voyager 2 currently uses Vega-Lite 1.x. Plus, we have not released any vega-lite 2 alpha version that works with Vega 3 (we're still in the middle of migration to Vega 3). Thus, it's not surprising that you will get some error.

rgrzywinski commented 7 years ago

Yes I know Voyager2 uses Vega-Lite <2 which is why I ported it. The error that I got was related to compatibility between Vega-Lite and Vega. I just thought that that you would want to know about the missing required "extent" on "bin" transforms.

Sorry for the bother.

domoritz commented 7 years ago

We are tracking progress in https://github.com/vega/vega-lite/issues/1597.

kanitw commented 7 years ago

@rgrzywinski I see. Thanks for your good intention, but yeah we're in the middle of it so this is not unexpected :)

rgrzywinski commented 7 years ago

I didn't see it on #1597 which is why I filed this :) I'll put anything that I notice that you guys aren't obviously tracking on #1597 going forward.

Good luck and holler if you need monkey testing!