Configuration
This plugin is configurable through the chart plugins.deferred
option:
Name | Type | Default |
---|---|---|
plugins.deferred |
Object/Boolean |
true |
plugins.deferred.xOffset |
Number/String |
0 |
plugins.deferred.yOffset |
Number/String |
0 |
plugins.deferred.delay |
Number |
0 |
Deferred options
plugins.deferred
The deferred options (see deferred.*
). Also accepts a boolean, in which case if true
, the chart will be deferred using the default options, else if false
, the chart will not be deferred.
plugins.deferred.xOffset
Number of pixels (or percent of the canvas width) from which the chart is considered inside the viewport.
plugins.deferred.yOffset
Number of pixels (or percent of the canvas height) from which the chart is considered inside the viewport.
plugins.deferred.delay
Number of milliseconds to delay the loading after the chart is considered inside the viewport.
Example
var chart = new Chart(ctx, {
type: 'bar',
options: {
plugins: {
deferred: {
xOffset: 150, // defer until 150px of the canvas width are visible
yOffset: '50%', // defer until 50% of the canvas height are visible
delay: 500 // delay of 500 ms after the canvas become visible
}
}
// ...
}
});