score:4
Accepted answer
instead of modifying your callbacks why not using a condition inside them, testing a global variable?
for example:
tooltips: {
mode: 'index',
intersect: false,
callbacks: {
label: function (tooltipitems, data) {
if (percent)
return addcommas(tooltipitems.xlabel) + "%";
else
return addcommas(tooltipitems.xlabel);
}
}
},
here is a jsfiddle showing this approach: https://jsfiddle.net/beaver71/nk6rz1f3/
Source: stackoverflow.com
Related Query
- ChartJS Update callbacks
- My Chartjs is not updating after setstate full code attached Reactjs Update
- Dynamically update values of a chartjs chart
- Dynamically update the options of a chart in chartjs using Javascript
- Chartjs doesn't update dataset label on tooltips
- Update charts in chartjs and angular
- How to add ChartJS code in Html2Pdf to view image
- ChartJS multiple tooltip callbacks not working
- Chartjs in Reactjs - how can I update data dynamically?
- dynamically update the scale type of chartjs graph
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- Chartjs not working with d3 from csv source
- ChartJS update chart with multiple datasets
- ChartJS v2.6 update breaks custom line-with-area-range (stripe) chart
- Automatically update ChartJS with Knockout data-bind
- ChartJs chart won't update new values
- Why can't I update the aspectRatio within the chartjs chart?
- How to update a chart using VueJS and ChartJS
- Chartjs with streaming plugin: update y-range
- React Chartjs - Update Chart on interval
- Automatic update a ChartJs with SQL
- ChartJS have xAxes labels match data source
- Angular 9 chartJs is not updating view after data update
- chartjs how to update dynamically data from database(Chartjs cant get the data)
- ChartJS Update specific bar's background colour
- Updating Chartjs to 2.5 with custom code
- Update data when pressing submit in chartjs in vuejs
- Angular 6: chartjs value not updating with dynamic value update
- Dynamically update chart in chartJs
- Calling data from outside of Chartjs code
More Query from same tag
- chart.js onAnimationProgress progress percentage
- Pie chart.js - display a no data held message
- How I can add the predict data and the actual data in the same graph with ChartJS?
- In chart.js, Is it possible to hide x-axis label/text of bar chart if accessing from mobile?
- Using Different Colors In a Chart
- Access MVC Model property that is already JSON in javascript
- chart js - bar chart with time scale on Y axis in Hours and Minutes
- Inserting Graphs into DomPDF
- How to increase right spacing in Chart.js 2.6.0?
- Charts.js Pie Chart
- angular-chart.js custom color based on chart label values
- Chartjs-node installation failing
- Different color for line segments in ChartJS
- ChartJS tooltip scrollbar to prevent data overflow?
- Customize Chart js dataset data
- How can I get A radar chart like this by chart.js
- how to dynamicly change the json data in chartjs
- Chart.js scatter axis titles
- How to draw multiple color bar in a bar chart using chart.js
- How to add OnClick Event on labels in Chart.js v2.0?
- Chart.js Line Graph: Start a line in the middle of a graph
- Change the Center color of doughnut chart in Chart.Js
- Show statistics in my diagram (php mysqli)
- Chart.js: Disable Y-Axis, when graph is disabled via Legend
- Having different colors per bar with angular charts chart.js v2
- Chart.js update function (chart,labels,data) will not update the chart
- How to add custom text inside the bar and how to reduce the step size in y axis in chart js( Bar chart )
- Chartjs hide data point labels
- Change color of X and Y axis values in Chart.js
- ChartJS dynamic line chart ghosting back to old data when hovered on