Raggamuffin
Raggamuffin

Reputation: 709

nvd3 - how to disable tooltip in discrete bar chart

I'm using nvd3 1.8.2, d3 3.5.8 and meteor 1.3. I used the example discreteBarChart from the nvd3 docs. But when i try to disable the tooltips just like in the example with chart.tooltips(false) and i get a console error that says 'tooltip is not a function'.

I also tried chart.tooltip.enabled(false), that does not work either.

See:

    // chart object
let chart = nv.models.discreteBarChart()
    .x(function(d) {
        return d.x
    })
    .y(function(d) {
        return d.y
    })
    .staggerLabels(true)
    .showValues(false)
    .showYAxis(false)
    // .tooltips(false)
    .duration(250);

// chart details
nv.addGraph(function() {
    d3.select('#chartWordsAll svg')
      .datum(barChart())
      .call(chart);

    nv.utils.windowResize(chart.update);

    return chart;
});

Any ideas how i can disable the tooltip?

Thanks in advance!

Muff

Upvotes: 0

Views: 1352

Answers (1)

Cláudio Alves
Cláudio Alves

Reputation: 765

Since even chart.tooltip.enabled(false) didn't work as it shows in the documentation, you could try to use angularjs-nvd3-directives and set tooltips=false which seems to work well in this example:

JSFiddle: http://jsfiddle.net/xerwrzwm/

Upvotes: 1

Related Questions