Provides the details for a figure.

The Deephaven JS API supports automatic lossless downsampling of time-series data, when that data is plotted in one or more line series. Using a scatter plot or a X-axis of some type other than DateTime will prevent this feature from being applied to a series. To enable this feature, invoke Axis.range to specify the length in pixels of the axis on the screen, and the range of values that are visible, and the server will use that width (and range, if any) to reduce the number of points sent to the client.

Downsampling can also be controlled when calling either Figure.subscribe or Series.subscribe - both can be given an optional DownsampleOptions argument. Presently only two valid values exist, dh.plot.DEFAULT and dh.plot.DISABLE, and if no argument is specified, `DEFAULT` is assumed. If there are more than 30,000 rows in a table, downsampling will be encouraged - data will not load without calling `subscribe(DISABLE)` or enabling downsampling via Axis.range. If there are more than 200,000 rows, data will refuse to load without downsampling and `subscribe(DISABLE)` would have no effect.

Downsampled data looks like normal data, except that select items have been removed if they would be redundant in the UI given the current configuration. Individual rows are intact, so that a tooltip or some other UI item is sure to be accurate and consistent, and at least the highest and lowest value for each axis will be retained as well, to ensure that the "important" values are visible.

Four events exist to help with interacting with downsampled data, all fired from the `Figure` instance itself. First, EVENT_DOWNSAMPLENEEDED indicates that more than 30,000 rows would be fetched, and so specifying downsampling is no longer optional - it must either be enabled (calling Axis.range), or disabled. If the figure is configured for downsampling, when a change takes place that requires that the server perform some downsampling work, the EVENT_DOWNSAMPLESTARTED event will first be fired, which can be used to present a brief loading message, indicating to the user why data is not ready yet - when the server side process is complete, EVENT_DOWNSAMPLEFINISHED will be fired. These events will repeat when the range changes, such as when zooming, panning, or resizing the figure. Finally, EVENT_DOWNSAMPLEFAILED indicates that something went wrong when downsampling, or possibly that downsampling cannot be disabled due to the number of rows in the table.

Hierarchy

  • Figure

Implements

Constructors

Properties

title?: string

The title of the figure, or null if no title was set.

EVENT_DISCONNECT: string

This figure has lost its connection to the server. No further events will be fired, and no data will update, until either the connection is reestablished and EVENT_RECONNECT is fired, or EVENT_RECONNECTFAILED fires, indicating that it wasn't possible to reconnect and the figure should be recreated/refetched.

EVENT_DOWNSAMPLEFAILED: string

Downsampling failed for some reason on one or more series. The event.detail object has three properties: the message string describing what went wrong, the size number showing the full size of the table, and the series property, an array of Series instances affected.

EVENT_DOWNSAMPLEFINISHED: string

Downsampling has finished on the given Series instances, and data will arrive shortly. The event.detail value is the array of Series instances.

EVENT_DOWNSAMPLENEEDED: string

There are too many points to be drawn in the table which backs these series, and downsampling should be enabled. As an alternative, downsampling can be explicitly disabled, provided there are less than 200,000 rows in the table. The event.detail object has the same properties as EVENT_DOWNSAMPLEFAILED.

EVENT_DOWNSAMPLESTARTED: string

The API is updating how downsampling works on this Figure, probably in response to a call to Axis.range or subscribe. The event.detail value is an array of Series instances which are affected by this.

EVENT_RECONNECT: string

This figure has reconnected to the server, and all of its tables are ready to deliver data again. Any subscriptions that were active before the disconnect are restored.

EVENT_RECONNECTFAILED: string

This figure failed to reconnect to the server, and is no longer usable. The event.detail value is a FigureFetchError describing what went wrong.

EVENT_SERIES_ADDED: string

A series used within this figure was added as part of a multi-series in a chart. The series instance is the detail for this event.

EVENT_UPDATED: string

The data within this figure was updated. event.detail is FigureUpdateEventData.

Accessors

  • get charts(): Chart[]
  • The charts to draw.

    Returns Chart[]

  • get cols(): number
  • The number of columns in this figure's chart layout.

    Returns number

  • get errors(): string[]
  • Any errors that the server reported while building this figure.

    Returns string[]

  • get rows(): number
  • The number of rows in this figure's chart layout.

    Returns number

  • get titleColor(): string
  • The color to use when drawing the figure's title.

    Returns string

  • get titleFont(): string
  • The font to use when drawing the figure's title.

    Returns string

  • get updateInterval(): number
  • The update interval of this figure, in milliseconds.

    Returns number

Methods

  • Listen for events on this object.

    Type Parameters

    • T

      The type of the data that the event will provide.

    Parameters

    • name: string

      The name of the event to listen for.

    • callback: ((e) => void)

      A function to call when the event occurs.

        • (e): void
        • Parameters

          Returns void

    Returns (() => void)

    Returns a cleanup function.

      • (): void
      • Listen for events on this object.

        Returns void

        Returns a cleanup function.

  • Close the figure, and clean up subscriptions.

    Returns void

  • Checks whether any event listeners are registered for the given event name.

    Parameters

    • name: string

      The event name.

    Returns boolean

    true if there is at least one listener registered for name; false otherwise.

  • Returns a promise that resolves the next time the named event occurs, with the value of the event's detail. If a timeout is specified and occurs before the event takes place, the promise will reject, otherwise waits indefinitely.

    Type Parameters

    • T

      The type of the event detail.

    Parameters

    • eventName: string

      The event name.

    • Optional timeoutInMillis: number

      Optional timeout in milliseconds.

    Returns Promise<Event<T>>

    A promise that resolves with the next matching event.

  • Removes an event listener added to this table.

    Type Parameters

    • T

    Parameters

    • name: string
    • callback: ((e) => void)
        • (e): void
        • Parameters

          Returns void

    Returns boolean

  • Subscribe to the underlying tables to receive updates for all series in this figure.

    Parameters

    • Optional forceDisableDownsample: DownsampleOptions

      the downsampling behavior to use for every series in this figure. Pass dh.plot.DISABLE to load all data without downsampling, or omit the argument to use dh.plot.DEFAULT.

    Returns void

  • Disable updates for all series in this figure.

    Returns void