Dataset configuration

Dataset-specific options can be applied to control attributes, such as color and width of each line. Adding a borderColor attribute to the dataset will set the color of the line (and legend box), as follows:

let dataObj = {     labels: labels,     datasets: [{         data: values,         borderColor: 'hsla(300,100%,50%,1)'         backgroundColor: 'transparent';     }] }

The following chart shows the effect of setting borderColor and backgroundColor for a dataset. This configuration only affects one dataset. You can also configure properties that affect all datasets. In this example, the legend was also removed using the options configuration (explained in a separate section). You can see the full code in LineArea/line-2.html, as shown in the following ...

Get Learn Chart.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.