score:1
Accepted answer
you can just override the getelementatevent
method of the chart object
var originalgetelementatevent = mychart.getelementatevent;
mychart.getelementatevent = function () {
return originalgetelementatevent.apply(this, arguments).filter(function (e) {
return e._datasetindex == 0;
});
}
where mychart
is your chart object.
fiddle - http://jsfiddle.net/x4shhvbk/
score:0
it seems that this funcionality is not added to chart.js.
i post my solution in this issue: https://github.com/chartjs/chart.js/issues/1889
score:1
i make use of the custom tooltip configuration to achieve this:
this.mychart = new chart(this.ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: "line 1",
type: 'line',
data: data3
},
{
label: "bar 1",
type: 'bar',
data: data1,
backgroundcolor: "#3eafd5"
},
{
label: "bar 2",
type: 'bar',
data: data2,
backgroundcolor: "#d24b47"
}
]
},
options: {
responsive: true,
tooltips: {
custom: function(tooltipmodel) {
if (tooltipmodel.body && tooltipmodel.body[0].lines && tooltipmodel.body[0].lines[0].indexof("bar") > -1) {
tooltipmodel.opacity = 0;
}
}
}
}
}
Source: stackoverflow.com
Related Query
- Chart JS attempt to stacked bar chart tooltip for only one dataset
- Chart.js v2.0: Tooltip only for one dataset
- ChartsJS make number in middle for only one chart
- Charts JS: Doughnut chart and hiding tooltip for specific data index within each dataset
- Chart js - render images on only one dataset
- Disable tooltip for Line chart for one line
- How to disable a tooltip for a specific dataset in ChartJS
- show label in tooltip but not in x axis for chartjs line chart
- How to display value of only one datapoint in line chart
- Chart.js tooltip hover customization for mixed chart
- Add a text as tooltip for each point on a line chart
- Chartjs.org Chart only displaying in one page
- Chart.js v3: Tooltip callback doesn't identify clicked dataset of stacked bar chart
- Changing Dataset for a chart in angular 10
- Empty circle - only point strok in line chart for ChartJS
- How can I have different values for the chart and the tooltip in chart.js?
- Chart.js: show tooltip color square only for certain row
- ng2Charts/chart.js changing chart type for one is impacting many charts
- ChartJs - Is is possible to show only tooltip in one dataset?
- Disable chartJS tool tip on one dataset only
- Chart.js two y axes line chart tooltip value incorrect for 2nd y axis
- Custom tooltip callback on one dataset (chartjs v 2.5)
- ChartJs(Java) Can I remove only specific gridLines for a Linear Chart withouth removing the labels on xAxis?
- How to show tooltip only when data available in chart js?
- chart.js value is two but only one display tooltip
- Chartjs chart with only one axis
- Bar chart (chart.js) with only 2 points does not show one of the bars
- chart.js 3 stacked bar chart - tooltip showing for zero values
- Smaller scale for volume dataset in Chart JS
- Ng2-charts set color for one specific value in dataset
More Query from same tag
- Possible to hide Chart.js grid lines that extend beyond chart?
- How to create a chart-js pie chart with PHP data variables?
- Chart.js t.ticks.map is not a function
- Price history with chart js
- increasing php variable in javascript loop
- React render function preventing creating new canvas element on each time invoked - Charts.js
- Chart.js 2.1.2 Bar Chart Animation Issue
- Chartjs - legends take up too much space on mobile devices
- responsive = false not working
- Chart doesn't render in angular 2 app
- Chart JS: Set Spacing Between Ticks on Y-Axis
- Bar chart not starting at 0
- tring to get data into chart.js from Javascript or PHP
- Can't change the time of the xAxes in the Chart.js
- Chart.js: Fixed horizontal location of vertical axis
- Chart.js 2.0 Formatting Y Axis with Currency and Thousands Separator
- Chart.js generate chart with foreach mvc
- How do I selecting a date range (like onClick but drag/select)
- ChartJS - Horizontal Stacked Bar Chart Tooltip being cut off by Bottom of Canvas
- Manipulating data point in chart.js external tooltip
- Accesing external Javascript (Chart.js) with Thymeleaf
- borderdash options in chart js changes my legend
- Want to show small part of js Bar Chart when value is zero
- Vertical line at the end of a dataset
- chart.js 2.7.1 - polar area chart has too much padding
- Display text in center of doughnut
- Moving vertical line when hovering over the chart using chart.js
- Chart js with problems when using too many series
- How to remove the coloured rectangle(dataset label) in chartJS
- How do I fetch data from 2 tables and display into 1 chartjs