Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
prevData,
prevNumRows,
prevNumCols,
data,
numRows,
numCols
)
) {
if (prevNumRows < numRows) {
this.vegaView.insert(name, getDataArray(data, prevNumRows))
}
} else {
// Clean the dataset and insert from scratch.
const cs = vega
.changeset()
.remove(vega.truthy)
.insert(getDataArray(data))
this.vegaView.change(name, cs)
logMessage(
`Had to clear the ${name} dataset before inserting data through Vega view.`
)
}
}
private updateData(
name: string,
prevData: ImmutableMap | null,
data: ImmutableMap | null
): void {
if (!this.vegaView) {
throw new Error("Chart has not been drawn yet")
}
if (!data || !data.get("data")) {
const viewHasDataWithName = (this
.vegaView as any)._runtime.data.hasOwnProperty(name)
if (viewHasDataWithName) {
this.vegaView.remove(name, vega.truthy)
}
return
}
if (!prevData || !prevData.get("data")) {
this.vegaView.insert(name, getDataArray(data))
return
}
const [prevNumRows, prevNumCols] = tableGetRowsAndCols(
prevData.get("data")
)
const [numRows, numCols] = tableGetRowsAndCols(data.get("data"))
// Check if dataframes have same "shape" but the new one has more rows.
if (