in packages/api-builder/src/xform/marks/processMark.ts [94:125]
function getBoundData(mark: Mark, frame: SceneFrame): BoundData {
const { table, facet } = mark
// If the table is unset, render as a singleton of the existing bound data-item
const isSingleton = !table && !facet
if (isSingleton) {
return [frame.boundDataItem]
}
if (!table) {
throw new Error('table must be set when facet is set')
}
const sourceTable = frame.data[table]
if (facet) {
const facetSourceTable = facet.table || table
if (!facetSourceTable) {
throw new Error('mark does not have table or faceting table defined')
}
if (!facet.groupBy) {
throw new Error('faceting must groupBy defined')
}
const facetSource = frame.data[facetSourceTable]
const result = createFacetedData(facet, facetSource, sourceTable)
return result
} else {
if (!sourceTable) {
throw new Error(`could not find table ${table}`)
}
return sourceTable
}
}