Class: GanttChartDataFeed

GanttChartDataFeed

This class handles the data-related calculations for the GanttChart plugin.

Methods

applyData(data, startDateColumn, endDateColumn, additionalData, asyncUpdates)

Parse data accordingly to it's type (HOT instance / data object).

Parameters:
Name Type Description
data Object

The source Handsontable instance or a data object.

startDateColumn Number

Index of the column containing the start dates.

endDateColumn Number

Index of the column containing the end dates.

additionalData Object

Object containing column and label information about additional data passed to the Gantt Plugin.

asyncUpdates Boolean

If set to true, the source instance updates will be applied asynchronously.

asyncCall(func)

Run the provided function asynchronously.

Parameters:
Name Type Description
func function

bindWithHotInstance(instance, startDateColumn, endDateColumn, additionalData, asyncUpdates)

Make another Handsontable instance be a live feed for the gantt chart.

Parameters:
Name Type Description
instance Object

The source Handsontable instance.

startDateColumn Number

Index of the column containing the start dates.

endDateColumn Number

Index of the column containing the end dates.

additionalData Object

Object containing column and label information about additional data passed to the
Gantt Plugin. See the example for more details.

asyncUpdates Boolean

If set to true, the source instance updates will be applied asynchronously.

Example
hot.getPlugin('ganttChart').bindWithHotInstance(sourceInstance, 4, 5, {
 vendor: 0, // data labeled 'vendor' is stored in the first sourceInstance column.
 format: 1, // data labeled 'format' is stored in the second sourceInstance column.
 market: 2 // data labeled 'market' is stored in the third sourceInstance column.
});

getDataFromSource(row){Array}

Get data from the source Handsontable instance.

Parameters:
Name Type Description
row Number optional

Source Handsontable instance row.

Returns: {Array}

loadData(data)

Load chart data to the Handsontable instance.

Parameters:
Name Type Description
data Array

Array of objects containing the range data.

Example
[
 {
   additionalData: {vendor: 'Vendor One', format: 'Posters', market: 'New York, NY'},
   startDate: '1/5/2015',
   endDate: '1/20/2015'
 },
 {
   additionalData: {vendor: 'Vendor Two', format: 'Malls', market: 'Los Angeles, CA'},
   startDate: '1/11/2015',
   endDate: '1/29/2015'
 }
]

splitRangeIfNeeded(bar){Array}

Split the provided range into maximum-year-long chunks.

Parameters:
Name Type Description
bar Object

The range bar object.

Returns: {Array} An array of slip chunks (or a single-element array, if no splicing occured)

updateFromSource(row)

Update the Gantt Chart-enabled Handsontable instance with the data from the source Handsontable instance.

Parameters:
Name Type Description
row Number optional

Index of the row which needs updating.