score:6
Just add "click"
to your tooltipEvents
list when specifying the options for the chart
...
tooltipEvents: ["mousemove", "touchstart", "touchmove", "click"],
});
In the fiddle below, I've removed all other events from the list except for click
to give you an idea of how it will be like on a mobile
Fiddle - http://jsfiddle.net/8uobybv3/
score:0
For ChartJS version 2.8.0, you will need to add both the click
and mouseout
events to make the tooltip behave the desired way.
The click
event would make the tooltip to appear when point is clicked and the mouseout
event would hide the tooltip when the mouse pointer is moved outside of the chart canvas area which is the desired behavior.
Note: Without adding the mouseout
event the tooltip would not hide even when the mouse is moved or clicked outside the chart canvas area.
Code:
options: {
events: ["click", "mouseout"],
....
...
score:7
For Chart.js v2, you can specify those events at the root level of chart options.
options: {
events: ['click']
}
Source: stackoverflow.com
Related Query
- ChartJS: Show default tooltip onclick
- Is there any way to show tooltip by default (without hover pie chart) on chartjs
- show label in tooltip but not in x axis for chartjs line chart
- ChartJS Line Graph - Multiple Lines, Show one Value on Tooltip
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- Always show last tooltip on all datasets, leave the rest to display on hover? ChartJS
- ChartJs - Is is possible to show only tooltip in one dataset?
- Chartjs show hidden data on tooltip
- ChartJS Pie Chart How default just show 2 legend datas
- It is possible to always show all tooltip in Chartjs 3.1
- chartJS Horizontal Bar - Hide Stacked Bars But Still Show In Tooltip
- ChartKick - ChartJs - Legend onClick override with default behaviour
- Chartjs Tooltip Line Breaks
- ChartJS New Lines '\n' in X axis Labels or Displaying More Information Around Chart or Tooltip with ChartJS V2
- How to disable a tooltip for a specific dataset in ChartJS
- How to modify chartjs tooltip so i can add customized strings in tooltips
- Chartjs v2 - format tooltip for multiple data sets (bar and line)
- chartjs tooltip is cut off when out of canvas
- Show bar with zero value in ChartJs v2
- chartjs show dot point on hover over line chart
- ChartJS add tooltip to a grouped bar chart
- Chart JS Show HTML in Tooltip
- ChartJS – How to show border on empty pie chart?
- ChartJs custom tooltip position
- chart js tooltip how to control the data that show
- ChartJS show gaps in time data
- how to always show label in chartjs without mouseover?
- Show data dynamically in line chart - ChartJS
- Chartjs - show elements in all datasets on hover using bar chart
- How to show data values or index labels in ChartJs (Latest Version)
More Query from same tag
- How to make bar chart cover multiple labels?
- How Do I Properly Install/Access Javascript Library
- Reduce space between ticks in horizontal bar-chart chartJS
- ChartJS fixed y axis on scroll
- Chart.js 3.3.0 - Draw text on top of chart
- Displaying Charts in C# using ChartJS
- How to display the values inside the pie chart of PrimeNG (chart) using JavaScript or Angular
- How to make animated bar graph with canvas?
- Chartjs Bar Chart Legend
- Is it possible to generate multiple chart in Laravel using chartjs ? If possible please give the solution
- Chart isn't updating with Response data (Chart.js 3.2.1, ng2-charts 3.0.0-beta.9)
- ng2-charts : Newly added rows not getting displayed on phone devices
- Chart.js set global point size not working
- Handle X-axis label position in chart js
- Chart.js hiding lable
- Chart JS not reloading in Partial View
- Chart.js Line graph legend yields error: Uncaught TypeError: Cannot read property '0' of undefined
- ChartJS - Gradient color overlap
- opening json file to create chart in chart.js
- ChartJS multiple sub labels for label
- Error: $injector:modulerr Module Error - chart.js
- JavaScript. Find the sum of a certain parameter in an array to produce a popup if that sum == 0
- How to implement chart.js in Django?
- Unable to hide x axis for horizontal bar chart vue js
- Data updating but chart isn't
- how do I change the textsize in of doughnut in react-chartjs-2?
- how can i use inline plugin inner title for chart js?
- How to display date as label on x-axis in chart.js
- chart.js aspect ratio not square
- How to change the color of the bar in barchart if the data is negative - Angular Charts