Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NVD3 TooltipContent Does not work

I am using NVD3 library for my project and i have written following code.

var chart = nv.models.lineChart()
            .useInteractiveGuideline(true)
            .margin({top: 50, right: 50, bottom: 50, left: 50})
            .tooltipContent(function (key, y, e, graph) {
                console.log("helo");
                return "hello";
            });

Expected output should be to show hello on mouse over. But i dont get that, instead i get the default tooltip.

Please let me know the mistake i am doing.

like image 468
Jayendra Gothi Avatar asked Oct 19 '14 16:10

Jayendra Gothi


1 Answers

It's now possible to have custom content with interactive guidelines as of version 1.8.1 (https://github.com/novus/nvd3/tree/v1.8.1-alpha).

chart.interactiveLayer.tooltip.contentGenerator(function(data) {
    return 'this is my custom content';
});
like image 138
Pim Avatar answered Jan 03 '23 17:01

Pim