score:1
you can use custom tooltips to do this (basically you use an html element instead of using the canvas to render the tooltip alone). see https://github.com/nnnick/chart.js/blob/v1.0.2/samples/line-customtooltips.html for an example for line charts.
in your case, you can adjust the loop at https://github.com/nnnick/chart.js/blob/v1.0.2/samples/line-customtooltips.html#l68 to exclude / include the datasets as you see fit.
score:1
i make use of the custom tooltip configuration to achieve this(here it hides datasets that doesn't have "income" label):
this.mychart = new chart(this.ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: "income",
data: data3
},
{
label: "tax",
data: data1,
backgroundcolor: "#3eafd5"
},
{
label: "expenses",
data: data2,
backgroundcolor: "#d24b47"
}
]
},
options: {
responsive: true,
tooltips: {
custom: function(tooltipmodel) {
if (tooltipmodel.body && tooltipmodel.body[0].lines && tooltipmodel.body[0].lines[0].indexof("income") == -1) {
tooltipmodel.opacity = 0;
}
}
}
}
}
Source: stackoverflow.com
Related Query
- Disable chartJS tool tip on one dataset only
- ChartJS animate only one dataset
- How to disable a tooltip for a specific dataset in ChartJS
- Chartjs linechart with only one point - how to center
- ChartJs - Is is possible to show only tooltip in one dataset?
- Chart.js v2.0: Tooltip only for one dataset
- Why my ChartJs only Coloring one section?
- Chart js - render images on only one dataset
- Chartjs chart with only one axis
- Why i only get one value after executing "for loop" to display "datasets.data" in ChartJS
- How to remove only one specific dataset label chartJS?
- VueJS + Chartjs - Chart only renders after code change
- Chart JS attempt to stacked bar chart tooltip for only one dataset
- ChartJS with React: Only one value showing on time chart
- Is it possible in chartjs to hide certain dataset legends?
- How to disable chartjs legendclick
- ChartJS Line Graph - Multiple Lines, Show one Value on Tooltip
- How to display value of only one datapoint in line chart
- ChartJs how to get from mulitiple dateset which dataset bar is clicked
- How to change the color of legend in chartjs and be able to add one more legend?
- Chartjs doesn't update dataset label on tooltips
- Draw two plots using chartjs over one another with transparency
- ChartJS - Line chart issue with only 1 point
- How to display only one label in a multi line char?
- Chart.js LineChart how to show only part of dataset and support horizontal scrolling
- Chartjs hovering over one Chart, shows tooltip across all charts
- Chartjs line graph dataset with offset
- Loop Dataset ChartJS Javascript
- ChartJS disable gridlines outside chart area
- ChartJS set default options only to specific Canvas, not globally
More Query from same tag
- Drawing line chart in chart.js with json data
- chart.js not allowing y axis steps with logarithmic scale
- Bar chart is not grouped properly in chartjs
- Chart.js not showing when i try to format dates
- How can i reformat dates
- How can I put queried data (via post) on my jquery chart?
- Vue.js using chart.js options not working
- chartjs - json data for scatter graph, issue with date
- Chart.js wont display normal chart
- updating chartjs pie chart by using .keypress() not working
- Vue.js - this.<value>.<value> is undefined
- Why i lost my chart.js when i do a new render
- Chart.js Plugin Not Recognized as Options Property in Angular
- ChartJS: Adjust Tooltip with sums in body
- Chartjs not displaying timed data
- ChartJS plugin with live label update
- Change font size and font color in Chartjs Angular 5
- charts.js chart size it's diferente than container setted size
- How do I create a stacked horizontal bar chart with Chart.js in React?
- Line chart is showing under bar in combochart in chartjs
- how to filter year from datefield in django
- Chart JS 2 Tick Label Border
- Trying to create chartjs constructor
- Chartjs doughnut chart with gradient color
- Using Chart.js on Laravel 5.3
- Define backgroundColor from data in chartJS
- How to retrieve data from mysql to chart.js
- Chart.js - y axis custom label
- How to create a chart.js scatter chart with data from two lists
- Bind Angular FormGroup to Chartjs data