Chartjs-Line chart using Chart.js

0👍

The following lines are the culprit:

data: plandata.map(o => ({ x: Number(o.label), y: Number(o.pl_hrs)}))

and

data: actualdata.map(o => ({x: Number(o.label), y: Number(o.act_hrs)}))

The map callback should only return the hour figures, like this:

// Planned
data: plandata.map(o => Number(o.pl_hrs))

// Actual
data: actualdata.map(o => Number(o.act_hrs))

The data property only needs an array of figures you want to plot on the graph. Here is a jsfiddle

Note: you should normalize your data on all data sources based on the labels you use on labels config of the chart. What I mean is, the order of the figures in your data array should correspond to the label order.

Leave a comment