Class ChartGroup

A chart group often corresponds to a set of linked charts. For example, when using crossfilter, it is typically charts linked to same crossfilter instance. It specifies the set of charts which should be updated when a filter changes on one of the charts. The BaseMixin methods renderGroup and redrawGroup call renderAll and redrawAll on the chart group.

dc charts created without specifying a chartGroup are registered with the default ChartGroup. It is recommended that all dc charts are created with an explicit chartGroup.

This has been introduced in v5 to facilitate automated garage collection of charts. SPAs (Single Page Applications), or any other environments where set of charts need to be unloaded, should use explicit chartGroups.

It is possible to register non dc charts (or any other object) with the chartGroup. Please see IMinimalChart to understand the methods the chartGroup will be invoking.

dc charts do not hard depend on this class. So, it is possible to replace it with any compliant implementation. IChartGroup specifies what rest of the dc expects.

Hierarchy

  • ChartGroup

Implements

Constructors

Properties - Intermediate

Properties - Ninja

Methods - Standard

Methods - Intermediate

Methods - Ninja

Constructors

Intermediate Properties

beforeRedrawAll: (() => Promise<void>)

Type declaration

    • (): Promise<void>
    • This is an async callback. It can be used for quite sophisticated purposes. For example, the RemoteDataAdaptors can request data from a remote service based on current filters and await till results are received.

      See

      beforeRenderAll

      Returns Promise<void>

beforeRenderAll: (() => Promise<void>)

Type declaration

renderlet: (() => void)

Type declaration

    • (): void
    • This callback is invoked after redrawAll and renderAll.

      Example

      chartGroup.renderlet = () => {
      // user code
      }

      Returns void

Ninja Properties

dataProviderBehavior: IDataProviderBehavior

From dc-v5, there is first-class support for data sources other than CrossFilter. The data provider specific behavior is extracted so that an alternate implementation will allow using different back-ends, including remote data sources.

filterStorage: IFilterStorage

It stores filter state of charts.

Standard Methods

  • Reset filters for all the charts. This can be used to implement Reset All in the UI.

    Returns void

  • Redraw all the charts.

    When a filter is modified for any of the charts or there is a change in the underlying data, all linked charts will need be redrawn.

    It will do the following in order:

    For any filter changes, this will be called by dc charts internally. However, if there is a change in data (like rows getting added), this function needs to be called to see the updated data.

    Returns Promise<void>

  • Refocus all the charts that support focusing.

    Returns void

  • Once all charts have been registered, this function should be called. It will do the following in order:

    Typically this will be called only once.

    Returns Promise<void>

Intermediate Methods

  • Check if the chart is registered with this chartGroup.

    Parameters

    Returns boolean

  • List of charts in the group. It returns the internal storage without defensive cloning.

    Returns IMinimalChart[]

  • dc charts will register themselves. Non dc charts will need to call this method.

    Parameters

    Returns void

Ninja Methods

  • Remove all charts from the registry. Should not be called directly - it may leave charts in inconsistent state.

    Returns void

Generated using TypeDoc