Extension:Graph/Vega 2to5 list
Graphs are split into sections. Each section has an array ([]). Those generally start with a small indent, usually just one tab. Sentances on removing a property apply both to the property and it's value. Since Vega's own guide does not reach Vega5 (their guide has been exactly the same for 3 years), this one takes everything from it and expands upon it.
View
[edit]Top level definitions, includes stuff like width, height, etc.
- viewport to css
- remove padding: auto or strict, they are default values
Data
[edit]This is where the data for the datapoints are, which are then turned into bars, lines etc.
- "name" is required. Used to reference to it, if missing make sure those are ok.
- change "modify" to "on"
- json
- remove parse, specify data with "property"
- csv/tsv
- remove parse
- treejson
- removed
Transforms
[edit]- change "output" to "as"
- change "field" under "formula" to "as"
- change "layout_mid" and other "mid" properties to '"signal": "0,5 * (datum.y0 + datum.y1)"'
- instead of "summarize" under "type": "aggregate" do
"type": "aggregate",
"groupby": ["cat1", "cat2"]
- change "max" and "min" under "bin" to '"extent": [min, max]'
- change "filter" to "expr"
- change "on" under "lookup" to "from"
- change "onKey" under "lookup" to "key"
- change "keys" under "lookup" to "fields"
- change "sort" under "scale" to '"sort":"domain"'
- facet: see marks chapter
- change "treeify" to "nest"
- change "groupby" under "treeify" to "keys"
- Rank support was removed
Scale
[edit]Scales change the colors and sizes of the datapoints.
- "name" is required
- move "rangemin" and "rangemax" to "range", like so: '"range": [min, max]'
- change ordinal to ordinal for lookup tables, band for scales, point for scales without padding (point:true)
- change category10 and category20 to '"range": {"scheme": "category20"}'
- "field" with multiple values becomes "fields"
- time scales
- "clamp" was removed
- scale domains
- "data" is required. Specify where the data is coming from.
- "field" is required.
- scale range
- change "shapes" to: "symbol": {"shape": value}
Axes
[edit]Axes add scale markings to an graph; lines on the X and Y axis.
- Change "type to "orient". type:y becomes orient:left, type:x becomes orient:bottom
- "orient" is required
- "scale" is required
- change "titleOffset" to "titleX" and "titleY", relative position to the axis.
- formatType can not be string
- change "ticks" to "tickCount"
- "subdivide" to "tickMinStep"?
- "tickPadding" to "labelPadding"
- "axis" to "domain" or "update". "domain":false to hide the axis, otherwise use "update"
- try to move "tickSizeMajor", "tickSizeMinor" and "tickSizeEnd" to "tickSize", else remove.
- "tickSize" is for all ticks, the others are not.
- "layer" to "zindex" and change to a number. "Front" = 1, "Back" = -1
- change "properties" to "encode"
Legends
[edit]- change "properties" to "encode"
Marks
[edit]Marks take the datapoints and make lines, bars, symbols, etc.
- "type" is required
- Comment "description" out (with \\). Vega does not use it, but it is useful as a comment.
- Change "properties" to "encode"
- Change "template" to "signal"
- "from" can not include data
- change "facet" to
"from": {
"facet": {
"name": value1,
"data": value2,
"groupby": value1
}
},
- Both value1's should be the same. Data needs to specify where the data comes from.
- Remove "ease" and "delay" \\ transition delays
Signals
[edit]Signals change the datapoints based on mouse movements, such as hovering over a bar.
- "name" is required
- change "verbose" to "react"
- change "streams" to "on"
- change "expr" to "update"
- change "init" to "value" or "update". Value if there is only one value, "update" if there is more.
- view.on to view.addEventListener
- view.off to view.removeEventListener
- view.onSignal to view.addSignalListener
- view.offSignal to view.removeSignalListener
Expressions
[edit]- Change inrange to lua, something like "if x < math.max and x > math.min"
- change format to tostring in lua
- timeformat to timeOffset?
- timeOffset(unit, date[, step]), step=timezone
- eventItem to item
- eventgroup to group
- eventx to x
- eventy to y
Removed sections
[edit]- Virtualization was removed
- Predicates - replace with production rules, see https://github.com/nyurik/vega/wiki/Predicates and https://vega.github.io/vega/docs/marks/#production-rules
- Streaming data - move to signals under "on"
Tools
[edit]- Use your browser console
- Use Vega's own editor https://vega.github.io/editor/#/custom/vega
- Vega's 2.0 specification https://github.com/nyurik/vega/wiki