Vega specifications for unit visualizations.
You will need an array of data objects, so that columns types can be inferred.
import { inferTypes } from 'vega';
const data = [
//your data objects
];
const insight = {
"colorBin": "quantize",
"columns": {
"x": "Gender",
"color": "Survived",
"sort": "Survived",
"facet": "Age"
},
"scheme": "set1", //see https://vega.github.io/vega/docs/schemes/#reference
"facetStyle": "wrap",
"size": {
"height": 600,
"width": 800
},
"chart": "barchartV"
};
const columns = getColumnsFromData(inferTypes, data);
const specColumns = getSpecColumns(insight, columns);
const specViewOptions = {
colors: {
defaultCube: "steelblue",
axisLine: "#000",
axisText: "#000"
},
language: {
count: "Count"
},
maxLegends: 20,
tickSize: 10
};
const context = { specColumns, insight, specViewOptions };
const specResult = build(context, data);
if (specResult.errors) {
console.log(specResult.errors);
} else {
console.log(specResult.vegaSpec);
}
- Added background image
- Show z-axis scale
- Fix for last bin of quantitative band scale
Please visit the SandDance website.