All examples By author By category About

XavierGimenez

vega.js playground

Vega.js example with small multiples, legends amb multiple marks.

By using the mark type group we can facet the data and create small multiples, as this:

"marks": [   
    {
       "name": "rankName2",
       "type": "group",

       "from": {
           "facet": {
               "data": "region_only",
               "name": "rankNames",
               "groupby": "rankName"
           }
       },
       ...
```       

However, as two diferent marks are displayed (rects and lines, based on another field different from the one used by the facet), I didn't found in the specs a way inject some data transformation again to have diferent facets again, one for each type of visual mark. So the mark group is used twice, one to display each type of mark. Far far being ideal.