score:0
Accepted answer
add label with your data to show it in the tooltip
var doughnutdata = [{
value: 30,
color: "#f91942",
label: 'red'
}, {
value: 50,
color: "#0b7bb5",
label: 'yellow'
}, {
value: 120,
color: "#4d5360",
label: 'blue'
}];
this will display tooltip with default template
<%if (label){%><%=label%>: <%}%><%= value %>
which show like
red: 30
you can change the template using tooltiptemplate key, like below
var options: {
tooltiptemplate: "this value is -> <%= value %>"
};
var mydoughnut = new chart(document.getelementbyid("canvas").getcontext("2d")).doughnut(data, options);
this will give you
this value is -> 50
Source: stackoverflow.com
Related Query
- how to setting chart js customization
- How to print a chart rendered by code
- How do I destroy/update Chart Data in this chart.js code example?
- How to run Chart.js samples using source code
- how to not repeat code while creating multiple charts in chart js
- How to add text inside the doughnut chart using Chart.js?
- How to clear a chart from a canvas so that hover events cannot be triggered?
- Chart.js - How to set a line chart dataset as disabled on load
- chart js 2 how to set bar width
- How can labels/legends be added for all chart types in chart.js (chartjs.org)?
- How can I create a horizontal scrolling Chart.js line chart with a locked y axis?
- How can I make two of my lines in Chart JS thicker
- How to prevent first/last bars from being cut off in a chart with time scale
- How set color family to pie chart in chart.js
- Chart.js Bar Chart - how to chart bars from 0
- How to add an on click event to my Line chart using Chart.js
- Chart.js how to show cursor pointer for labels & legends in line chart
- How do you hide the title of a chart tooltip?
- How to put rounded corners on a Chart.js Bar chart
- chartjs : how to set custom scale in bar chart
- How can I make a stepline or stepped chart in chart.js or D3?
- How to save Chart JS charts as image without black background using blobs and filesaver?
- How to Draw Gantt chart using chart js or other libraries
- How to fix chart Legends width-height with overflow scroll in ChartJS
- How to display Line Chart dataset point labels with Chart.js?
- chart js how to fill legend box with colour
- How to add an offset to a dataset in Chart js
- Chart.js setting maximum bar size of bar chart
- How to add second Y-axis for Bar and Line chart in Chart.js?
- How to add text in centre of the doughnut chart using Chart.js?
More Query from same tag
- Chart js logarithmic line chart showing NaN values instead of null
- pass array variable to chart.js options
- PrimeFaces: ChartJs stacked bar chart label removal
- How to add second Y-axis for Bar and Line chart in Chart.js?
- how to get React chartjs to resize back down with window
- Chart.js Picture inside doughnut segment
- Angular + Ng2 Charts: Chart not displaying as Child Component
- Cant change labels in Chart.js 2.0 Beta
- Chart.js Doughnut Chart Rendering Wrong
- ChartJS: Custom legend not showing Labels for Multi-Pie chart
- vue-chartjs load data from parent component
- Custom scatter chart extended from scatter chart becomes line chart
- How to use Utils from Chartjs on Django
- Type check for getElementById only works with optional chaining, not with type check
- TypeError: Cannot assign to read only property ... - Editing react-chartjs-2 datasets with Redux
- chart.js not displayed in angular2 (rc1)
- how can i grab a property from an array of JSON objects to use the values of that property as a labels in my chart?
- Dynamically updating time data in chart.js freezes the chart
- How to use chartjs-plugin-datalabels for specific charts using vue-chart.js
- Show count concatenated to labels using chart.js
- Determining which chart the user has clicked on
- how to Fill array with 0 if data is not present?
- Chart.js - combine data and label into a single object
- How to handle data API from Django Rest Framework in Chart.js
- Increase space between largest bar and top grid line in charts.js
- Extension for chart.js 2.X
- Querying mongoDB for some chart data - my pipeline seems convoluted
- How To Format Scale Numbers in Chart.js v2
- Chartjs inverted bars when negative value
- Using Chart.js, how do I avoid having tooltips overlap?