Represents a view of the data from which the visualization can be rendered.

This object contains the result of the query made by Spotfire against the DataTable currently used by the Mod Visualization, using the Filtering, Marking, expressions on the Axes and other relevant settings.

interface DataView {
    allRows(abortPredicate?: AbortPredicate): Promise<null | DataViewRow[]>;
    axes(): Promise<DataViewAxis[]>;
    categoricalAxis(name: string): Promise<null | DataViewCategoricalAxis>;
    clearMarking(): void;
    continuousAxis(name: string): Promise<null | DataViewContinuousAxis>;
    getErrors(): Promise<string[]>;
    hasExpired(): Promise<boolean>;
    hierarchy(name: string): Promise<null | DataViewHierarchy>;
    mark(rows: DataViewRow[], operation?: MarkingOperation): void;
    marking(): Promise<null | MarkingInfo>;
    rowCount(): Promise<undefined | number>;
}

Methods

  • Gets all rows from the data view as one asynchronous operation. The allRows function has a built in cache and can be called multiple times with the same dataView and it will return the same list of rows.

    Parameters

    • OptionalabortPredicate: AbortPredicate

      Optional. Predicate to determine whether the operation should be aborted when there is new, non-streaming, data available. If this predicate returns true the promise will be rejected. The default behavior is that reading will be aborted when new non-streaming update is available.

    Returns Promise<null | DataViewRow[]>

    null if reading data was aborted, otherwise a DataViewRow[].

  • Gets metadata of all axes currently present in the DataView. Axes with empty expression are omitted.

    Returns Promise<DataViewAxis[]>

  • Gets metadata for a specific categorical axis in the DataView. Categorical axes are defined in the manifest file as categorical or dual. When this method fails to return a valid axis getting the corresponding call to DataViewRow.categorical will throw an error. Returns null for axes with empty expressions or for dual mode axes that currently are in continuous mode. Throws if the axis does not exist or the axes mode is continuous.

    Parameters

    • name: string

      The axis name.

    Returns Promise<null | DataViewCategoricalAxis>

  • Clears the current marking

    Returns void

  • Gets metadata for a specific continuous axis in the DataView. Continuous axes are defined in the manifest file as continuous or dual. When this method fails to return a valid axis getting the corresponding call to DataViewRow.continuous will throw an error. Returns null for axes with empty expressions or for dual mode axes that currently are in categorical mode. Throws if the axis does not exist or the axes mode is categorical.

    Parameters

    • name: string

      The axis name.

    Returns Promise<null | DataViewContinuousAxis>

  • Gets any errors generated while creating the dataview. Returns empty array if none occurred.

    Returns Promise<string[]>

  • Gets a value indicating whether the dataView has expired. The dataview has expired when there has been changes to the document, for example marking or filtering. When true, there will be a new dataview available on the next read.

    Returns Promise<boolean>

  • Gets a hierarchy for a categorical axis.

    If the axis has an empty expression the hierarchy will contain one single root node. Returns null for dual mode axes that currently are in continuous mode. Throws if the axis does not exist or the axes mode is continuous.

    Parameters

    • name: string

      The name of the axis to get the hierarchy for.

    Returns Promise<null | DataViewHierarchy>

  • Mark a set of rows. The full set will be the union of all mark operations performed within one transaction (see Mod.transaction). All mark operations must have the same marking operation.

    Parameters

    Returns void

  • Gets the marking information, or null if marking is not enabled.

    Returns Promise<null | MarkingInfo>

  • Gets the total number of rows of the DataView without actually getting all the rows. Use this function to determine whether or not the mod will be able to handle the amount of data rows. When there are errors in the mod configuration there will be no rows available and this method will return undefined.

    Returns Promise<undefined | number>