0👍
I had a similar case. I used the configuration in the first js file, and the code that creates the chart in the second js file. After drawing the chart, I got an error: "controller is null". I solved the problem by deep copying through the "extend" method (but I used JQuery).
default constructor in first file:
const standart_chart = {
type: 'bar',
options: {},
...
}
adding data and create chart in the second file:
var ctx = $('#chart');
var chart = jQuery.extend(true, {}, standart_chart);
chart.data = barChartData;
var chart_obj = new Chart(ctx, chart);
Source:stackexchange.com