score:1
Accepted answer
you can define a tooltip.filter
callback function that returns false
for zero values, true
otherwise.
please take a look at below runnable code snippet and see how it works.
new chart('mychart', {
type: 'bar',
data: {
labels: ['a', 'b', 'c', 'd'],
datasets: [{
label: 'dataset',
data: [0, 2, 0, 3],
}]
},
options: {
responsive: false,
plugins: {
tooltip: {
mode: 'dataset',
filter: tooltipitem => tooltipitem.dataset.data[tooltipitem.dataindex] > 0
}
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/3.6.2/chart.min.js"></script>
<canvas id="mychart"></canvas>
Source: stackoverflow.com
Related Query
- chart.js 3 stacked bar chart - tooltip showing for zero values
- Chart JS attempt to stacked bar chart tooltip for only one dataset
- How to display inline values in a stacked bar chart with Chart.js?
- Showing Percentage and Total In stacked Bar Chart of chart.js
- chart.js: Place tooltip for stacked bar charts on top of bar
- Chart.js: Minimum value for x-axis at horizontal stacked bar chart
- Chart.js stacked bar chart - sorting values in bar by value
- Chartjs stacked bar separate tooltip for all stacked
- Chart.js v3: Tooltip callback doesn't identify clicked dataset of stacked bar chart
- How can I have different values for the chart and the tooltip in chart.js?
- Charts.js - Colors for stacked bar on multi-series line/bar chart are not working
- Bar chart with min height and zero values - ChartJs
- Stacked bar chart with chartjs with included values
- ChartJS not showing data for time series bar chart
- ChartJS add custom tooltip to a stacked bar chart
- Chartjs - Stacked bar chart data order causes invisible other values
- ChartJS - Horizontal Stacked Bar Chart Tooltip being cut off by Bottom of Canvas
- Chartjs - Stacked bar chart blocking other values
- Hiding spaces with zero values in bar chart with chart.js
- How to change the position of the tooltip for the Bar type chart in Chart.Js
- How to fix a stacked logarithmic bar chart values to fit the grid
- Chart JS Tooltip Currency Problem - Stacked Bar Chart
- Vue-chartjs with axios for stacked bar chart
- Display ellipsis for null or empty values in the bar chart using Chart.js
- Unable to change y-axis value dynamically based on data for Stacked bar chart in reactjs
- yAxis control for stacked bar chart
- How to assign values to different lables(legends) of my dataset of stacked bar chart
- Chartjs Bar Chart showing old data when hovering
- Chartjs v2.0: stacked bar chart
- Horizontal stacked bar chart with chart.js
More Query from same tag
- How to enable timescale in chart.js line chart?
- How can i change a numpy.ndarray to point format with curly brackets - Python 3.7
- Chart.js: Set different options to datasets
- ChartJs - annotation line can not drawn
- ChartJS Line Graph - Multiple Lines, Show one Value on Tooltip
- Chart.js ignore options
- How can I make lines fully connected in a multi-line chart even when one dataset is more sparse than another?
- Problems with chart.js using Laravel 7, Cannot find element: #app?
- How can we type a variable which is a method in TypeScript ? (Using Chart.js)
- How to add horizontal scroll to a bar graph in chartjs?
- Make Chart.js canvas responsive inside the resizeable div
- How can I implement Polar area charts with Chart.js and Canvas
- Why is the html page only displaying one of the charts?
- how to add tool tip in yii-chartjs extension
- How to send data to chart js using angular
- Why is my chart not working? What am I missing
- How do I get the current step size of a chartjs chart whose stepSize I have not defined?
- How to get a square grid in Chart.js with responsive scatter chart?
- Charts.js display two combined line charts for last 7 days
- Display multiple data into chart.js
- Do not rotate scale title at xAxis
- Chart.js mouseover tooltips appears when cursor in wrong position
- Chart.js chart doesn't render when using Angular 2
- Responsive Chart.js Canvas barplot height?
- Specifying the legendTemplate in Chart.js when using asp (classic)
- How to render multiple Chart.JS charts on the same page with AJAX data and variables
- Line chart disable interpolation
- Chart.js aspect ratio / forced height
- Making chartjs scrollable on the x-axis
- Chart js, Canvas is null polymer project