score:10
Accepted answer
plugins
should be placed in its own config section, and not nested under options
.
instead of:
options: {
title: {
display: true,
text: graph.globals.title,
},
legend: {
display: true,
position: 'bottom',
fullwidth: false,
onclick: () => {},
labels: {
generatelabels: (chart) => {
return pieoptions.legendleft(chart);
}
}
},
plugins: [{
beforeinit: function(chart, options) {
console.log('yolo');
}
}]
rotation: 3.9,
}
your code should look like:
options: {
title: {
display: true,
text: graph.globals.title,
},
legend: {
display: true,
position: 'bottom',
fullwidth: false,
onclick: () => {},
labels: {
// generatelabels: (chart) => {
// return pieoptions.legendleft(chart);
// }
}
},
rotation: 3.9,
},
plugins: [{
beforeinit: function(chart, options) {
console.log('yolo');
}
}]
working jsfiddle: https://jsfiddle.net/r1x63b8v/
Source: stackoverflow.com
Related Query
- Inline plugin doesn't work
- How do I put this on Real-Time? I already put (async: True) but it doesnt work
- Charts.js scales yaxes ticks min max doesnt work
- Code doesn't work after updating chart.js versioning
- JavaScript implementation doesnt work (Chart.js)
- Chartjs Overlap click function doesnt work
- how can i use inline plugin inner title for chart js?
- How to run Chart.js samples using source code
- angular-charts.js doesnt work with ionic
- everything i put in the options of the Line charts doesnt work
- Automatic colors assignment in chart.js 2.x doesn't work anymore, used to work in v. 1.x
- angular 5 chart.js datalabels plugin
- How to display inline values in a stacked bar chart with Chart.js?
- How to properly use the chartjs datalabels plugin
- How to access labels array using chart plugin (Chart.pluginService.register) in Chartjs 2.x?
- Datalabels plugin chartjs showing '[object]' instead of value
- How to work out Chartjs using TypeScript with Chartjs.definitelyTyped from github
- How do I get tool tips to work on 2 data set half doughnut chart?
- Chart.js Radar chart legend label font size doesn't work
- math.max() doesn't work in IE
- Chart.js onAnimationComplete doesn't work
- Can't apply options of datalabels chartjs plugin in Vue
- How to add ChartJS code in Html2Pdf to view image
- Options beginAtZero doesn't work in angular-chart.js
- How to import and use a custom Chart.js plugin in Nuxt? (Chartjs-vuejs v2.9.4)
- Chart.js click event to open a custom tooltip does not work sometimes
- ChartsJS Annotations Plugin - Can you create a tooltip to accompany an annotation?
- Update Chart.js plugin
- How to use an Aurelia JSPM plugin with WebPack
- Chartjs with zoom plugin zooms too much with wheel just with single turn
More Query from same tag
- Created an onclick function to remove data from a line chart in ChartsJs, but getting "Cannot read property 'data' of undefined" error
- Printing chartjs tooltips
- Line chart is showing under bar in combochart in chartjs
- Angular PrimeNG Chart Module: Customize hover text
- Chart.JS Vertical Line with Moment.JS Horizontal Axis
- ChartJS - Change legend to toggle buttons
- Chart.js chart not rendering
- Can't change color line with chart.js
- How to access or get value of specific graph on chart plot by click event?
- Chartjs doughnut segment pattern
- Pie chart legend styling using Chart js
- Change Chartjs label color on click without losing hover
- chartjs-plugin-zoom not working on offline environment javascript .js
- ChartJS in React throws 'too may re-renders'
- How can I increase the size of the pie (Chart.JS)?
- How to rotate custom marker in chart.js?
- How to make bar chart animation where all bars grow at the same speed?
- Problem with script src for Chart.js. The CDN for Chart.js funtions fine, so my code is ok. Somehow I'm not linking the file correctly
- Second yAxes values not charting correctly with Chart.js
- How to add new data point and remove leftmost data point dynamically in Chartjs
- Chart.js - remove zeros and step numbers in Y axis
- ChartJS color specific Grid Lines
- Django Multiple chartJs chats in a page
- SPFx ChartJS Web Part
- How to Render Chart Datasets in Vue?
- Multiple charts in one page - Chartjs
- Charts.js Dynamic Ticks
- Changing color of specific ChartJS - AngularChartJS point
- Cant To CHange Chart.js Legend
- Search box to show information in line chart