InteractiveTable = VegaLite({
data: {values: simpleCereals},
hconcat: [{
mark:
{
type: "circle",
opacity: 0.5,
stroke: "black",
strokeWidth: 1
},
encoding: {
y: {field: "rating",type: "quantitative" },
x: { field: "sugar", type: "quantitative"},
color: {condition: {selection: "plotbrush", field: "Type", type: "nominal"}, value: "grey"},
size: {
field: "shelf",
type: "ordinal"
}
},
selection: {"plotbrush": {type: "interval",resolve: "global"}},
},
{
mark:
{
type: "point",
opacity: 0.4,
stroke: "black",
strokeWidth: 1.5,
size: 40,
filled: true,
"tooltip": [
{"field": "Brand","type": "nominal"},
{"field": "calories","type": "quantitative"}
],
},
encoding: {
y: {field: "rating", type: "quantitative" },
x: {field: "calories", type: "quantitative", scale: {"domain": [40,200]}},
color: {field: "Type", type: "nominal"},
strokeWidth: {condition: {selection: "plotbrush", value: 2}, value: 1},
fillOpacity: {condition: {selection: "plotbrush", value: 0.7}, value: 0.5},
size: {
field: "shelf",
type: "ordinal"
},
size: {field: "sugar",type: "quantitative", legend: { title: "Sugars", clipHeight: 40},
scale: {range: [40, 400]} },
},
selection: {"plotbrush": {type: "interval",resolve: "global"}},
}
]
})