vega / vega-lite Goto Github PK
View Code? Open in Web Editor NEWA concise grammar of interactive graphics, built on Vega.
Home Page: https://vega.github.io/vega-lite/
License: BSD 3-Clause "New" or "Revised" License
A concise grammar of interactive graphics, built on Vega.
Home Page: https://vega.github.io/vega-lite/
License: BSD 3-Clause "New" or "Revised" License
Just always put numbers outside like I add 28, 55 below (same for all bars — I’m just adding this by hand so I added only the first two.)
label
encoding channel to channel.ts
and the schemamarks.ts
{
fieldname:{min: value, max:value} if Q or {cardinality: value} if O
}
I'm not sure what this entails, though...
This is a modified vega bug.
Step to reproduce
The output will be insanely tall.
Currently row/column faceting generate children cells using cross operator. Implementing nesting operator would produce more efficient layout. (See Tableau’s VizQL and
Wilkinson’s Grammar of Graphics)
{
"marktype": "bar",
"enc": {
"x": {"name": "Cost__Total_$","type": "Q","aggr": "sum"},
"y": {"name": "Effect__Amount_of_damage","type": "O"},
"row": {"name": "Wildlife__Size","type": "O"},
"col": {"name": "When__Phase_of_flight","type": "O"}
},
"cfg": {"dataUrl": "data/birdstrikes.json"}
}
there is no offset property …. we might need to create a group for this.
Control
split function into aggregate functions and non-aggregate functions @kanitw
agg: min
, max
, avg
non-agg: math functions, bin
Drag & Drop to swap encoding
Add better UI for adjusting common defaults?
This could be toggle-able panel appearing beneath the encoding shelves
Add slider to set default opacity
Add slider for default point size
Add x/y axis controls (zero, reverse, log)
Default font, size controls
Prevent Errors
Productivity
Generated Vega spec can show fractional widths (e.g., 1300.0000000000002). These should be integers.
create cli for generating image file from spec
basically just wiring vl2vg
and vega's vg2png
and vg2svg
should work
Single
unit model
row
and column
to use facet
facet.ts
{
"marktype": "bar",
"enc": {
"x": {"name": "Cost__Total_$","type": "Q","aggr": "sum"},
"y": {"name": "Effect__Amount_of_damage","type": "O"},
"row": {"name": "Wildlife__Size","type": "O"},
"col": {"name": "When__Phase_of_flight","type": "O"},
"color": {"name": "When__Time_of_day","type": "O"}
},
"cfg": {"dataUrl": "data/birdstrikes.json"}
}
get the following scale
Meanwhile, if we remove color
{
"marktype": "bar",
"enc": {
"x": {"name": "Cost__Total_$","type": "Q","aggr": "sum"},
"y": {"name": "Effect__Amount_of_damage","type": "O"},
"row": {"name": "Wildlife__Size","type": "O"},
"col": {"name": "When__Phase_of_flight","type": "O"}
},
"cfg": {"dataUrl": "data/birdstrikes.json"}
}
The scale is nicer.
{
"marktype": "bar",
"enc": {
"x": {"name": "Cost__Total_$","type": "Q","aggr": "sum"},
"y": {"name": "Effect__Amount_of_damage","type": "O"},
"row": {"name": "Wildlife__Size","type": "O"},
"col": {"name": "When__Phase_of_flight","type": "O"}
},
"cfg": {"dataUrl": "data/birdstrikes.json"}
}
Another case: (probably a different bug)
{
"marktype": "bar",
"enc": {
"x": {"name": "Cost__Total_$","type": "Q","aggr": "sum"},
"y": {"name": "Effect__Amount_of_damage","type": "O"},
"col": {"name": "When__Phase_of_flight","type": "O"}
},
"cfg": {"dataUrl": "data/birdstrikes.json"}
}
For ordinal: count, argmax
For quanitative: min, max, avg, sum, stdev, bin
For encoding = text, do not rotate x axis label.
But wrap / truncate text instead.
{
"marktype": "text",
"enc": {
"x": {"name": "Major_Genre","type": "O"},
"y": {"name": "Creative_Type","type": "O"},
"text": {"name": "US_Gross","type": "Q","aggr": "avg"}
},
"cfg": {"dataUrl": "data/movies.json","cellHeight": "400","cellWidth": "400"}
}
x
, y
"fields": [{"op": "count","field": "data.-“}]
Inspired from discussion in #59
Otherwise marks are unreadable.
Is there a story for changing the visualization depending on the data? I imagine that it would be great to change for example the color mapping if there are negative values. Or use a log scale if the data has only few large values.
apply sort transform first (and then use “index” to sort axis)??
test.js
— run test case. Throw error / create output html page to show mismatches.gen.js
— generate vega specs based on input in /vega/
and output to /vegalite
or add test case (given an encoding, automatically create files in /vega
and /vegalite
with appropriate namesThis will allow grouping dots, lines, stack, etc. without assigning colors.
This is straightforward in vega, but need to introduce new syntax
{
"marktype": "bar",
"enc": {
"x": {"name": "Effect__Amount_of_damage","type": "O"},
"y": {"name": "Cost__Total_$","type": "Q","aggr": "sum"},
"row": {"name": "Cost__Other","type": "O"},
"col": {"name": "When__Time_of_day","type": "O"},
"color": {"name": "Wildlife__Size","type": "O"}
},
"cfg": {"dataUrl": "data/birdstrikes.json"}
}
.on()
to get position and use .data()
to update that separate data.It would be nice if we could change the vega JSON and see the result in the visualization. I imagine that a suer would use vegalite to get started and then she would refine the visualization.
Currently, using T leads to Unrecognized interval
error when I try point.x-year-T
.
TODO
I'm just trying to confirm the semantics of binning.
To create a histogram, we need to use the same column for x and y (y could also be another quantitative field) and choose to bin x and sum y (in some cases another aggregation might make sense). Also, we need to set the type of the binned field to O to fix the labels. I believe at some point we want to show labels that show the range and not hide groups with no values but we can leave that for later.
Vegalite atomically chooses a good bin size that optimizes for 1) not too many bins 2) nice bin widths (based on the base, usually 10). The only input to this binning function are the min and max.
sqlite> select cast((Cost__Repair-25000)/500000 as int)*500000, sum(Cost__Repair) from birdstrikes_json group by cast((Cost__Repair-25000)/500000 as int);
0|9227604
500000|5519778
1500000|2762200
1500000|1715077
3000000|6390178
3500000|3644483
7000000|7043545
Choosing two ordinals only makes sense if we also add alpha, size, or a color scale to show the count (without a field). As an alternative, we could use the sum, max, ... of the quantitative scale to map to the alpha, size, or color. But it will never make sense to use another field that we haven't used (?).
What I'm trying to understand is what the limitations are and what things we can propagate automatically (or disable in the interface). I'm not yet seeing the generalized rules but will think more about this.
throw error when
Some from linear
, log
, pow
, sqrt
, quantile
, quantize
, and threshold
.
linear
& log
are probably the most important
By default would "auto" choose to stack based on mark (current behavior)
If true, stack regardless of mark type
If false, do not stack for any mark type
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.