score: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: stackoverflow.com
Related Query
- Chart.js dataset controller 'null' when chart drawn
- ChartJS: Highlight dataset in a stacked bar chart when hovering over the legend?
- Chartjs 2.x - Dataset color changing when redrawing chart
- How can I make lines fully connected in a multi-line chart even when one dataset is more sparse than another?
- Chart.js - How to set a line chart dataset as disabled on load
- Chartjs Bar Chart showing old data when hovering
- Moving vertical line when hovering over the chart using chart.js
- How to display Line Chart dataset point labels with Chart.js?
- Add DataSet Bar Chart - Chart.JS
- How to add an offset to a dataset in Chart js
- Changing cursor to pointer on Chart.js bar chart when hover (mousemove) event is disabled?
- How to disable Chart JS tooltip when there is no value?
- ng2-charts customize data and whole html content of tooltip displayed when hovering on bar chart
- Uncaught TypeError: Chart is not a constructor when using Chart.js
- chart.js - link to other page when click on specific section in chart
- Drawing line chart in chart.js placing dots only when value changes
- Chart.js line chart tooltip shows wrong label when line doesn't start at first label
- Maintain Y axis scale in graph with scroll in the X axis when the dataset grows bigger. Aspect-ratio problem
- Chartsjs multi-axis, make the scale appear/disappear when the dataset is activated/deactivated
- How to dynamically set ChartJs line chart width based on dataset size?
- vue.js vue-chartjs chart not updating when chartData replaced, updated etc
- Chart JS dataset disabled by default
- Can I use a gradient in Chart.js without accessing the chart context when the chart is created?
- Chart.js - bind data in dataset to specific chart labels
- Removing chart on click event produces 'removeHoverStyle' of null error
- Tooltip flickering when hovered on chart
- chartJs: I want to show both of the dataset legends when i hover to one of the points?
- Chart.js chart does not display when inside an ngIf.
- canvas fill text vanishes when hovering over chartjs pie chart
- Stacked line chart not displaying correctly when Xaxis is time
More Query from same tag
- how to Fill array with 0 if data is not present?
- How to feed hour and minute data into chartJS
- How can I get a point to be drown over the line?
- Charts.js Formatting Y Axis with both Currency and Thousands Separator
- React-chartjs options doesn't take effect
- How to implement dynamic data on chartjs?
- chart.js bar chart color change based on value
- ChartJS TypeError: document.getElementById(...).getContext is not a function
- Integrate chart.js with single javascript file
- ChartJS - TypeError: Cannot read property '_model' of null - Angular
- Define backgroundColor from data in chartJS
- How to get chart from data points (arrays) with inconsistent time intervals and chart.js?
- how to remove odd number from yaxes in chartjs using angular?
- What is the correct format for time data in chartjs?
- In chart.js bar chart, how do I label each bar within a category?
- Chart.js Uncaught TypeError: Cannot read properties of undefined (reading 'options')
- chartjs - don't show all x-axis data points, but show all in tooltips
- Chart.js stacked and grouped horizontalBar chart
- Looping through json array properties
- How update reload chart.js
- How to add ChartJS code in Html2Pdf to view image
- Chart.js combine two pieces of data into one bar
- How can I display different values on xAxes than on tooltip Chart.js V3
- Fully destroy charts on ngDestroy method from Angular 4
- ChartJS and Ajax calls
- Chart.js in AngularJS tabset does not render
- angular 7 how to draw dynamic number of charts
- Chart.js displays bar as overflown even below the x-axis
- Hide all scale labels in chartjs
- Chart.JS Alternate background color for xAxis