score:0
for those also sent here by google, i had to shim the file to export the correct variable:
requirejs.config({
baseurl: 'scripts',
paths: {
...
'chartjs': 'vendor/chart'
},
shim: {
'chartjs': {
exports: 'chart'
}
},
});
score:1
if you are using v2.0 of chart.js make sure you get a latest version (it worked for me with 2.0.0-beta2, but not with alpha). also, since chart.js depends on moment.js you'll need to include that as well.
with older versions of chart.js v2.0 (say alpha), you'll have to load chart.js as a legacy script and use the global variable (or noconflict()
).
the dependency on moment.js is not very obvious (related issue - https://github.com/nnnick/chart.js/issues/2110). here's what you get on the console, when you load chart.js as a normal script file.
when chart.js is loaded by require.js, this dependency causes a request for moment.js.
Source: stackoverflow.com
Related Query
- ChartJS automatically scaled chart has undefined min and max
- ChartJS and require: Chart is undefined
- Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis
- chartjs datalabels change font and color of text displaying inside pie chart
- chartjs - top and bottom padding of a chart area
- Category scale on Y-axis and time on x-axis in bubble chart in Chartjs
- Chartjs not rendering chart and no error thrown
- ChartJS Line chart cut off at the top and bottom
- ChartJS line chart drag and zoom
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- chartjs - multi axis line chart - cannot read property 'min' of undefined
- Create Chart using Reactjs Chartjs and axios
- Why would a ChartJS chart end up with width 0 and height 0?
- ChartJs chart in typescript: Object is possibly undefined in useEffect
- Meteor and ChartJS dynamically create a chart
- Grouped Bar Chart from mySQL database using ChartJS and PHP
- Chartjs - Set start and end value into a Bar Chart
- ChartJS and Radar Chart animation
- Chartjs Bar chart shows undefined values
- How to update a chart using VueJS and ChartJS
- Chartjs dynamic chart return both x & y axis undefined
- create Chart using Chartjs and PHP
- ChartJS and JSON result: Cannot set property 'fillColor' of undefined
- Bar chart with min height and zero values - ChartJs
- How to reuse a Chartjs Chart component in with different Data and get past the **Canvas is already in use** error?
- how to increase space between legend and chart in chartjs (ng2charts ) using angular
- VueJs and ChartJs - Chart is responsive in width, but not height?
- ChartJS : Hook before values are given to doughnut (absolute value in chart and real values in the tooltips)
- Can't Draw Horizontal Line on Graph Using ChartJS Annotation Plugin and Primevue Chart
- How to make a chart with chartjs and Angular?
More Query from same tag
- Adding labels and colours to Chart.JS from arrays
- Chart.js custom tooltip events
- How to remove labels from ng2-chart(chart.js)
- Displaying mixed types of legends (bar and lines) with Chartjs
- chartjs add dots to bars in grouped bar chart
- chart js - Apply different color for each x-axes label
- Dynamically update values of a chartjs2.0 chart
- How to pass data in Laravel with Chart.js
- Disable display of x and y values on ChartJS
- Chartjs Data via json request not populating
- ChartJS keeps adding one day to X axis. I cannot find a reason. Any suggestion?
- Using number/text input field to set the data values in ChartJs stops the chart from being displayed
- How to set width of bar dynamically in chart.js?
- JavaScript Chart.JS - issue keeping charts in two rows, instead everything in stacked into one column
- Angular CharJS option tooltip label did not work
- How to change the Y-axis values from numbers to strings in Chart.js?
- ChartJS unable to register global plugin
- How to add color to text using pluginService for Chart.js?
- ChartJS click on bar and change it's background color
- chart.js : Not all points use defined colors
- chart.js not getting rendered inside ng-template in angular
- Inserting data from controller to an array in javascript
- How could be the best way of implementing a 3D fft chart?
- How to make Chart JS responsive?
- Chart.js Version 3: how to set the different color for tick lines and gridlines
- Is it possible to set the background color of a sector in a radar chart in Chart.js?
- Annotation events not update the chart
- Chart.js line chart is not displaying
- Chart.js nuget Package with angularJS
- Chart.js - Unable to see tooltips on hover while using moment