c3 icon indicating copy to clipboard operation
c3 copied to clipboard

zoom.type = "drag" and tooltips not working together

Open vmihailenco opened this issue 7 years ago • 6 comments

To reproduce go to the https://c3js.org/samples/interaction_zoom.html and change:

    zoom: {
        enabled: true,
        type: "drag"
    }

After that note that tooltips are no longer displayed when hovering over data points.

vmihailenco avatar Oct 08 '18 09:10 vmihailenco

Is there an opportunity to fix it in the near future?

Joanna-Szczesna avatar Jan 13 '19 20:01 Joanna-Szczesna

The bug still exists, any work around for it?

tahatariq avatar Feb 24 '19 00:02 tahatariq

the problem is due to the structure of the created svg, zoom drag creates a group with class c3-drag-zoom after the group containing the regions, grids, chart, etc the rectangle in the group catches all events so that the tooltip event never fires.

I have no idea how to change that behaviour. As a workaround, I use a modifier key on mouse over on the svg to change the order of the nodes so that I can toggle between zoom or tooltip (that could be done with a button or anything really)

code sample: c3.generate -> oninit

oninit: function () { this.svg.on('mouseover', function () {graphFocused = this}) }

after graph creation:

d3.select("body").on('keydown', function (e) {
   if (d3.event.keyCode === 16) { // toggle on Shift down
      if(graphFocused) { // TODO add check to ensure focused graph is the right graph
         let list_of_children = d3.select(graphFocused).node().childNodes;
         list_of_children[2].parentNode.insertBefore(list_of_children[2], list_of_children[1]);
         d3.select(d3.select(graphFocused).node().parentNode).selectAll(".c3-tooltip-container").style("display", "none"); // hides tooltip div, TODO hide tooltip line in svg if exists
         }
      }
  })

panda-blue avatar Jun 28 '19 08:06 panda-blue

Same problem.

Losing tooltip bug.
The option zoom:{enabled:true,type:'drag'} is in conflict with tooltip:{show:true}.

Simple test: at the zoom-drag illustrated by this sample, you can add tooltip option in it.


  • C3 version: 0.7.1
  • D3 version: 5.9.7
  • Browser: Firefox v64.0
  • OS: Windows v10

ppKrauss avatar Jul 10 '19 17:07 ppKrauss

Any workaround for this issue, on zoom loosing tooltip and drag pointer persists and not allowing any other interactivity

Nagasai-Aytha avatar May 02 '20 07:05 Nagasai-Aytha

Any update?

mpushki avatar May 20 '21 12:05 mpushki