score:0
Accepted answer
i found an answer to this option and posted it in the linked jsfiddle. i had to add a plugin that would display all labels. that one then dynamically decided whether to show this tooltip or not.
chart.pluginservice.register
beforerender: (chart) ->
if chart.config.options.showalltooltips
# create an array of tooltips
# we can't use the chart tooltip because there is only one tooltip per chart
chart.plugintooltips = []
chart.config.data.datasets.foreach (dataset, i) ->
min = _.min(dataset.data, (d)-> d)
max = _.max(dataset.data, (d)-> d)
minshown = false
maxshown = false
chart.getdatasetmeta(i).data.foreach (sector, j) ->
ismax = dataset.data[j] == max
ismin = dataset.data[j] == min
# only show the min and the max once. we can have duplicates min/maxes
if ismax && !maxshown || ismin && !minshown
minshown = true if ismin
maxshown = true if ismax
tooltip = new (chart.tooltip)({
_chart: chart.chart
_chartinstance: chart
_data: chart.data
_options: chart.options.tooltips
_active: [ sector ]
}, chart)
chart.plugintooltips.push(tooltip)
return
return
# turn off normal tooltips
chart.options.tooltips.enabled = false
return
afterdraw: (chart, easing) ->
if chart.config.options.showalltooltips
# we don't want the permanent tooltips to animate, so don't do anything till the animation runs atleast once
if !chart.alltooltipsonce
if easing != 1
return
chart.alltooltipsonce = true
# turn on tooltips
chart.options.tooltips.enabled = true
chart.helpers.each chart.plugintooltips, (tooltip) ->
tooltip.initialize()
tooltip.update()
# we don't actually need this since we are not animating tooltips
tooltip.pivot()
tooltip.transition(easing).draw()
return
chart.options.tooltips.enabled = false
return
Source: stackoverflow.com
Related Query
- ChartJs - Labelling minimum and maximum value of the Y Axis
- ChartJS display tooltip at maximum/minimum value
- ChartJS Line Graph - Multiple Lines, Show one Value on Tooltip
- Calculate value in tooltip in ChartJS
- ChartJS - Finding the minimum and maximum labels that are inside a pan (When zooming)
- Minimum value for x Axis doesn't work for horizontal bar chart | ChartJS
- How to draw lines between minimum and maximum value to average value in chartJS?
- ChartJS - Moving vertical line is display on top of tooltip
- Always show last tooltip on all datasets, leave the rest to display on hover? ChartJS
- ChartJS 3.7.1 tooltip callback, get label value for the next index
- how to display last x float number value in chartjs
- chart.js value is two but only one display tooltip
- Display maximum value of an axis
- Why i only get one value after executing "for loop" to display "datasets.data" in ChartJS
- Chartjs - display radarchart lines from center to corner value
- How do I display a different chartjs tooltip title?
- How to display the more then one value inside tooltip in bar chart.js?
- How to have onclick/hover display associated value in ChartJS
- Display Chartjs tooltip values outside the canvas - multi line chart
- ChartJS - Display a single line data in tooltip
- JavaScript Chart.js - Custom data formatting to display on tooltip
- 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
- Truncating canvas labels in ChartJS while keeping the full label value in the tooltips
- How to modify chartjs tooltip so i can add customized strings in tooltips
- Chartjs v2 - format tooltip for multiple data sets (bar and line)
- Display line chart with connected dots using chartJS
- chartjs tooltip is cut off when out of canvas
- Show bar with zero value in ChartJs v2
More Query from same tag
- Updating Chartjs to 2.5 with custom code
- How to remove transparency from images downloaded in Chart.js
- Chart.js 3.5.1 Attribute question about zeroLineColor
- Exponential decrease
- Problems displaying yLabels in charts.js
- chart.js mix chart (bar + line): get lines to start at x = 0
- Chart.js not able to re-set data
- Chart.js: Can't get a coordinate for value for x axis unless x axis has the exact same value
- vue-chartjs with chartkick vertical bar chart
- Chart.js doughnut chart comes bigger and bigger
- Cannot read property 'getElementAtEvent' of undefined, Typescript
- How to sort XY line chart tooltip items based on value and add thousands separators?
- ChartJS 2.7.0 updating and exporting as png
- Chart.js Globally Formatted Number Labels
- ChartJS 3.0 - Number format
- Chart.js not showing all labels on pie chart
- How can I remove extra whitespace from the bottom of a line chart in chart.js?
- How can I get my Chart.JS to center within a div?
- How to display date as label on x-axis in chart.js
- ChartJS rotate 90' but keep text straight
- trying to get minIndex and maxIndex from x-axis-0
- chartjs: need color bars near yAxis scale
- ChartJS autoskip:False not working on line chart
- Chart js 2.8 - How to make bars grow at the same speed?
- How to set max/min on x axis to display time range in Chart.js?
- Chart.js dynamic updates with data from database
- How to remove colored label square
- Chart.js How to set line height only to the points?
- Chart.js load new data
- Change background transparency of Chart.js chart