score:2
for Angular 7, This works for me, might help you:
options: {
tooltips: {
callbacks: {
label: (tooltipItems, data) => {
return data.datasets[tooltipItems.datasetIndex].data[tooltipItems.index] + ' GB';
}
},
}
score:3
I found that the options API has changed in later versions of Chart.js (v3.7.0 as of writing).
An example of adding temperature units is as follows:
const options = {
plugins: {
tooltip: {
callbacks: {
label: (item) =>
`${item.dataset.label}: ${item.formattedValue} °C`,
},
},
},
}
score:18
You can add units to tooltips using tooltip callbacks configuration.
For example, here is how to add "GB" unit to the tooltip:
const options = {
tooltips: {
callbacks: {
label: (item) => `${item.yLabel} GB`,
},
},
}
Source: stackoverflow.com
Related Query
- Charts JS: How to set units?
- chartjs - how to set the order in which the different charts are displayed
- Chart.js - Draw charts with opposite bars - How to set both the y-axis ends to positive number?
- How we can set our own colors for each label in charts
- Charts Area JS v2: How to set units?
- Pie Charts JS: How to set units?
- How to run Chart.js samples using source code
- how to not repeat code while creating multiple charts in chart js
- How to set max and min value for Y axis
- how to set start value as "0" in chartjs?
- Chart.js - How to set a line chart dataset as disabled on load
- chart js 2 how to set bar width
- How to set ChartJS Y axis title?
- How set color family to pie chart in chart.js
- How to modify bar width in Chartjs 2 bar charts
- ChartJS: How to set fixed Y axis max and min
- How to set axes' step size in Chart.js 2?
- chartjs : how to set custom scale in bar chart
- How to set default colour for bars in Chart.js
- How to drill down charts with ChartJS?
- How to save Chart JS charts as image without black background using blobs and filesaver?
- How to set labels align left in Horizontal Bar using chart.js?
- How to add images as labels to Canvas Charts using chart.js
- ng2-charts: How to set fixed range for y axis
- How to zoom charts in chart.js using angular 7
- Chart.js - How to set animation speed?
- How to set static value in y-axis in chart.js?
- How to set time scale zoom in ChartJS?
- How to set a full length background color for each bar in chartjs bar
- Chart.js How to set line height only to the points?
More Query from same tag
- Combine\Merge Same Label in Pie Chart
- Chart.js dataset controller 'null' when chart drawn
- How to style a pie chart in chart js? I want to change the border color, border width and give them shadow
- How to use Utils from Chartjs on Django
- Exponential decrease
- How can I get my Chart.JS to center within a div?
- How to show percentage (%) using chartjs-plugin-labels ( Pie chart ) in angular 2/8
- how to set a custom tick format in chartjs options from laravel controller?
- Chart JS: Donut/Doughnut Chart: Tooltip to be shown always for all the data. All tooltip is not shown when multiple data are with 0 data
- Chartjs : Remove specific labels
- problem with chart js pie chart dataset data
- 'Chart.js' time chart not displaying properly
- Not all date data shows on x axis line chart
- Creating datapoints on mouseclick Chart.js
- Chart.js legend style
- How to get the database data into ChartJS using codeigniter
- How do remove the bottom scale on a Chart.js bar chart
- how can i reset chartjs object all instances and recreate it from scratch?
- Custom text in tooltip and legend: ChartJs
- Exporting dynamic chartjs to jspdf
- Chart.js Radar Not Displaying Data Values
- display data on chart.s
- Not sure how to rerender chart in the app
- How to store a chart.js chart options in another file in AngularJS
- Chart.js: summing number of items in active/shown datasets on yAxes of pie chart
- How to get x-axis value in chart as string?
- Can't get Chart.js to run in a Vue.js component
- Chartjs with Vue, Bar Chart Border Radius not working
- Chart JS flicker when new data is added to chart (Vue)
- Hover over chart shows multiple datapoints