Chartjs-Convert drawing math function from ChartJs 2 to 3

0👍

I think you could fix it easy yourself, by removing the quotes, since currently it is not a function, it’s only a string:

 "function": "function(x) { return 2; }",

to

 "function": function(x) { return 2; },

In the dataset

 ...
 "datasets": [{
     "label": "T = const",
     "function": function(x) { return 2; },
     "data": [],
     "fill": false,
     "borderColor": "rgb(75, 192, 192)",
     "tension": 0.1
}]
...

Leave a comment