Published
Edited
1 fork
Insert cell
Insert cell
selectionsToolbarElement = html`<div ></div>`
Insert cell
chartElement = html`<div style="width:100%;height:400px;"></div>`
Insert cell
Insert cell
{
const selections = await n.selections();
selections.mount(selectionsToolbarElement);
n.render({
element: chartElement,
type: 'comboChart',
// fields: [
// "Date.autoCalendar.Date",
// "=Sum([Number of New Cases])",
// "=Sum([Number of Closed Cases])",
// ],
properties: {
qHyperCubeDef: {
qDimensions: [
{
qDef: {
qFieldDefs: ['Date.autoCalendar.Date'],
qFieldLabels: ['Date']
},
qNullSuppression: true,
},
],
qMeasures: [
{
qDef: {
qDef: 'Sum([Number of New Cases])',
series: { type: "bar", axis: 0 },
qLabel: 'New Cases',
// autoSort: false
},
qSortBy: { qSortByNumeric: -1 },
},
{
qDef: {
qDef: 'Sum([Number of Closed Cases])',
series: { type: "line", axis: 1 },
qLabel: 'Closed Cases',
},
qSortBy: { qSortByNumeric: -1 },
},
],
qInitialDataFetch: [{ qWidth: 3, qHeight: 1000 }],
// qInterColumnSortOrder: [1, 2],
qAlwaysFullyExpanded: true,
qSuppressMissing: true,
qSuppressZero: true,
},
// barGrouping: { grouping: 'grouped'}, // 'stacked'|'grouped'
// orientation: 'vertical',
// nullMode: 'connect',
scrollStartPos: 1,
dimensionAxis: {
axisDisplayMode: 'custom', // 'auto'|'custom'|'max'
dock: 'far', // 'near'|'far'
label: 'auto', // 'auto'|'horizontal'|'tilted'
maxVisibleItems: 4,
show : 'all', // 'all' | 'labels' | 'title' | 'none'
},
showTitles: true,
title: 'Combo-chart',
subtitle: 'Sample supernova combochart',
footnote: 'Sample supernova combochart',
},
});
}
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more