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

Related Query

More Query from same tag