How to use the vega.truthy function in vega

To help you get started, we’ve selected a few vega examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github streamlit / streamlit / frontend / src / components / elements / VegaLiteChart / VegaLiteChart.tsx View on Github external
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.`
      )
    }
  }
github streamlit / streamlit / frontend / src / components / elements / VegaLiteChart / VegaLiteChart.tsx View on Github external
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 (