Class JsFigure


@JsType(name="Figure", namespace="dh.plot") public class JsFigure extends HasLifecycle
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 dh.plot.DownsampleOptions argument. Presently only two valid values exist, DEFAULT, and 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, 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 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, downsamplefinished will be fired. These events will repeat when the range changes, such as when zooming, panning, or resizing the figure. Finally, downsamplefailed indicates that something when wrong when downsampling, or possibly that downsampling cannot be disabled due to the number of rows in the table. At this time, not marked as a ServerObject, due to internal implementation issues which leave the door open to client-created figures.
  • Field Details

    • EVENT_UPDATED

      @JsProperty(namespace="dh.plot.Figure") public static final String EVENT_UPDATED
      The data within this figure was updated. event.detail is FigureUpdateEventData
      See Also:
    • EVENT_SERIES_ADDED

      @JsProperty(namespace="dh.plot.Figure") public static final String EVENT_SERIES_ADDED
      The data within this figure was updated. event.detail is FigureUpdateEventData
      See Also:
    • EVENT_DISCONNECT

      @JsProperty(namespace="dh.plot.Figure") public static final String EVENT_DISCONNECT
      The data within this figure was updated. event.detail is FigureUpdateEventData
      See Also:
    • EVENT_RECONNECT

      @JsProperty(namespace="dh.plot.Figure") public static final String EVENT_RECONNECT
      The data within this figure was updated. event.detail is FigureUpdateEventData
      See Also:
    • EVENT_RECONNECTFAILED

      @JsProperty(namespace="dh.plot.Figure") public static final String EVENT_RECONNECTFAILED
      The data within this figure was updated. event.detail is FigureUpdateEventData
      See Also:
    • EVENT_DOWNSAMPLESTARTED

      @JsProperty(namespace="dh.plot.Figure") public static final String EVENT_DOWNSAMPLESTARTED
      The data within this figure was updated. event.detail is FigureUpdateEventData
      See Also:
    • EVENT_DOWNSAMPLEFINISHED

      @JsProperty(namespace="dh.plot.Figure") public static final String EVENT_DOWNSAMPLEFINISHED
      The data within this figure was updated. event.detail is FigureUpdateEventData
      See Also:
    • EVENT_DOWNSAMPLEFAILED

      @JsProperty(namespace="dh.plot.Figure") public static final String EVENT_DOWNSAMPLEFAILED
      The data within this figure was updated. event.detail is FigureUpdateEventData
      See Also:
    • EVENT_DOWNSAMPLENEEDED

      @JsProperty(namespace="dh.plot.Figure") public static final String EVENT_DOWNSAMPLENEEDED
      The data within this figure was updated. event.detail is FigureUpdateEventData
      See Also:
  • Constructor Details

  • Method Details

    • refetch

      @JsIgnore public elemental2.promise.Promise<JsFigure> refetch()
      Description copied from class: HasLifecycle
      Indicate that a new session has been created on the server, and this object should re-create its corresponding server-side object if possible. Override this to implement custom behavior, being sure to call reconnect() when finished.
      Overrides:
      refetch in class HasLifecycle
      Returns:
      a promise that will resolve when this object is reconnected
    • reconnect

      @JsIgnore public void reconnect()
      Asks the figure to fire a reconnect event after its tables are ready.
      Overrides:
      reconnect in class HasLifecycle
    • getTitle

      @JsProperty public @JsNullable String getTitle()
      The title of the figure.
      Returns:
      String
    • getTitleFont

      @JsProperty public String getTitleFont()
    • getTitleColor

      @JsProperty public String getTitleColor()
    • getUpdateInterval

      @JsProperty public double getUpdateInterval()
    • getCols

      @JsProperty public int getCols()
    • getRows

      @JsProperty public int getRows()
    • getCharts

      @JsProperty public JsChart[] getCharts()
      The charts to draw.
      Returns:
      dh.plot.Chart
    • getErrors

      @JsProperty public elemental2.core.JsArray<String> getErrors()
    • subscribe

      @JsIgnore public void subscribe()
      Enable updates for all series in this figure.
    • subscribe

      public void subscribe(@JsOptional DownsampleOptions forceDisableDownsample)
    • unsubscribe

      public void unsubscribe()
      Disable updates for all series in this figure.
    • downsampleNeeded

      @JsIgnore public void downsampleNeeded(String message, Set<JsSeries> series, double tableSize)
    • downsampleFailed

      @JsIgnore public void downsampleFailed(String message, Set<JsSeries> series, double tableSize)
    • enqueueSubscriptionCheck

      @JsIgnore public void enqueueSubscriptionCheck()
    • verifyTables

      @JsIgnore public void verifyTables()
      Verifies that the underlying tables have the columns the series are expected. Throws an FigureSourceException if not found
    • close

      public void close()
      Close the figure, and clean up subscriptions.
    • registerTable

      @JsIgnore public int registerTable(JsTable table)
    • updateDownsampleRange

      @JsIgnore public void updateDownsampleRange(AxisDescriptor axis, Integer pixels, Long min, Long max)