Configuration

    This concept was introduced in Chart.js 1.0 to keep configuration , and allow for changing options globally across chart types, avoiding the need to specify options for each instance, or the default for a particular chart type.

    The following example would set the interaction mode to ‘nearest’ for all charts where this was not overridden by the chart type defaults or the options passed to the constructor on creation.

    Dataset Configuration

    The following example would set the showLine option to ‘false’ for all line datasets except for those overridden by options passed to the dataset on creation.

    1. // Do not show lines for all datasets by default
    2. Chart.defaults.datasets.line.showLine = false;
    3. // This chart would show a line only for the third dataset
    4. data: {
    5. datasets: [{
    6. data: [0, 0],
    7. }, {
    8. data: [0, 1]
    9. showLine: true // overrides the `line` dataset default
    10. }, {
    11. type: 'scatter', // 'line' dataset default does not affect this dataset since it's a 'scatter'
    12. data: [1, 1]
    13. }]