v7.3.0
SupportExamplesFree Trial

TimelineChart
Feature

This feature allows drawing line charts on top of the timeline area. Feature consists of two parts: chart and data providers. Chart provider is responsible for rendering the chart, while data provider is responsible for providing data for the chart. Feature itself manages the interaction between them, and tracks lifecycle events of the Gantt chart.

targetElement.innerHTML = '<p>This demo shows the timeline chart feature</p>'; const gantt = new Gantt({ appendTo : targetElement, height : 350, startDate : '2019-07-07', endDate : '2019-07-29', features : { timelineChart : true }, rowHeight : 60, project : new ProjectModel({ startDate : '2019-07-07', duration : 30, events : [ { id : 1, name : 'Project A', duration : 30, expanded : true, children : [ { id : 11, name : 'Child 1', duration : 1, leaf : true, rollup : true, cls : 'child1' }, { id : 12, name : 'Child 2', duration : 3, leaf : true, rollup : true, cls : 'child1' }, { id : 13, name : 'Child 3', duration : 0, rollup : true, leaf : true, cls : 'child1' } ] } ], dependencies : [{ id : 1, lag : 1, fromEvent : 11, toEvent : 12 }, { id : 2, lag : 1, fromEvent : 12, toEvent : 13 }] }) });

Default implementation uses SVGChartProvider for rendering the chart using SVG elements, and GanttDataProvider as a data source. Those can be replaced and customized by setting the chartProviderClass and dataProviderClass configs. Custom implementation should subclass corresponding base classes: TimelineChartProviderBase, TimelineChartDataProviderBase and implement required methods.

For more information on how to create custom chart provider, see this guide.

Feature will track timeline element resize and scroll and notify the chart provider about them. Chart element normally would be repositioned vertically to always stay in the view. And horizontally it will be scrollable along with the timeline.

Feature will also track project model and time axis view model changes to request data for the chart from the data provider and pass it to the chart provider for rendering.

Simple usage example:

// Simple configuration
const gantt = new Gantt({
    features : {
        timelineChart : true
    }
});

Chart and data providers can be configured separately.

const gantt = new Gantt({
    features : {
        timelineChart : {
            chartConfig : {
                tooltipTemplate : function({ dataset, date }) {
                    return `
                        <div>${dataset.label}: ${DateHelper.as('d', parseInt(dataset.value))} days</div>
                        <div>${DateHelper.format(date, this.gantt.displayDateFormat)}</div>
                    `;
                }
            },
            dataProviderConfig : {
                defaultDataset : 'progress'
            }
        }
    }
});

This feature is disabled by default.

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • Configuration for the chart provider.

  • Class providing chart rendering functionality.

  • Configuration for the data provider.

  • Class providing data for the chart.

  • Datasets to be displayed on the chart. Available datasets should be returned by the datasets accessor of the data provider. Changing this property will trigger chart repaint with the new dataset. Set to empty array to not draw anything.

    Has a corresponding runtime selectedDatasets property.

  • Internal listeners, that cannot be removed by the user.

  • The widget which this plugin is to attach to.

    Has a corresponding runtime client property.

  • Set to false to disable localization of this object.

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isAttachToProjectMixin : Booleantrue
    READONLY
    static
    ADVANCED
    AttachToProjectMixin
    Identifies an object as an instance of AttachToProjectMixin class, or subclass thereof.
  • isEvents : Booleantrue
    READONLY
    static
    ADVANCED
    Events
    Identifies an object as an instance of Events class, or subclass thereof.
  • isLocalizable : Booleantrue
    READONLY
    static
    ADVANCED
    Localizable
    Identifies an object as an instance of Localizable class, or subclass thereof.
  • isTimelineChart : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of TimelineChart class, or subclass thereof.
  • properties : Object
    internal
    static
    InstancePlugin

    A class property getter for the default values of internal properties for this class.

  • Returns metadata for datasets available in the data provider.

  • emptyArray : Array
    internal
    READONLY
    InstancePlugin

    An empty array that can be used as a default value.

  • emptyObject : Object
    internal
    READONLY
    InstancePlugin

    An empty object that can be used as a default value.

  • Datasets to be displayed on the chart. Available datasets should be returned by the datasets accessor of the data provider. Changing this property will trigger chart repaint with the new dataset. Set to empty array to not draw anything.

    Has a corresponding selectedDatasets config.

  • isInstancePlugin : Booleantrue
    READONLY
    ADVANCED
    InstancePlugin
    Identifies an object as an instance of InstancePlugin class, or subclass thereof.
  • isTimelineChart : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of TimelineChart class, or subclass thereof.
  • config : Object
    READONLY
    ADVANCED
    InstancePlugin

    Returns a copy of the full configuration which was used to configure this object.

  • This property is set to true before the constructor returns.

  • isDestroying : Boolean
    READONLY
    ADVANCED
    InstancePlugin

    This property is set to true on entry to the destroy method. It remains on the objects after returning from destroy(). If isDestroyed is true, this property will also be true, so there is no need to test for both (for example, comp.isDestroying || comp.isDestroyed).

  • client : Widget
    READONLY
    ADVANCED
    InstancePlugin

    The Widget which was passed into the constructor, which is the Widget we are providing extra services for.

    Has a corresponding client config.

  • Get the global LocaleHelper

  • Get the global LocaleManager

Functions

Functions are methods available for calling on the class
  • onClassMixedIn( )
    internal
    static
    InstancePlugin

    This optional class method is called when a class is mixed in using the mixin() method.

  • initClass( )
    static
    ADVANCED
    InstancePlugin

    Registers this class type with its Factory

  • Internal function used to hook destroy() calls when using thisObj

  • Internal function used restore hooked destroy() calls when using thisObj

  • doDestroy( )
    internal
    Events

    Auto detaches listeners registered from start, if set as detachable

  • once( )
    private
    Events

    Internal function used to run a callback function after an event is triggered

  • Removes all listeners registered to this object by the application.

  • This will merge a feature's (subclass of InstancePlugin) keyMap with it's client's keyMap.

Events

Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

Event handlers

Event handlers are callbacks called as a result of certain actions in this class
id: timelineChart

Source path

Gantt/feature/TimelineChart.js

Demo

examples/s-curve

Contents