Using Polys Marks Type
Source code can be found at the end of this tutorial.
This tutorial introduces you to the Polys Type marks, which uses an implicit polygon data table format. The visualization is a map of zip codes color-coded according to average contribution amount. The data table encodes polygons representing zip code areas.

See the Poly Map with Backend Rendering charting example for a programmatic rendering of this visualization.
The following data property extracts the average contribution amount from the contributions_donotmodify data table, omitting rows that do not have a contribution amount:
When working with polygon data, the "format": "polys" property must be specified.
The scales specification scales x values to the visualization area width and y values to the height. A color scale, polys_fillColor is also specified that linearly scales nine contribution amount ranges to nine colors:
Zip code areas for which average contribution amounts are not specified by the domain are color-coded green.
The marks property specifies visually encoding the data from the polys data table as polygons:
Polygon x and y vertex locations are transformed to the visualization area using the x and y scales.
The x and y polygon vertex locations are implicitly encoded in the data table as described in Polys Type.
Polygon fill color color-codes the average contribution amount, avgContrib, linearly scaled by the polys_fillColor scale:
Finally, the marks property specifies the polygon border width and color, and line join constraints:
Source Code
Working with Polys Tutorial Directory Structure
HTML
Working with Polys Tutorial index.html
JavaScript
Working with Polys Tutorial vegademo.js
Working with Polys Tutorial vegaspec.js
Last updated