NVD3 工具提示内容不起作用 [英] NVD3 TooltipContent Does not work

查看:47
本文介绍了NVD3 工具提示内容不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的项目使用 NVD3 库,并编写了以下代码.

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";
            });

预期的输出应该是在鼠标悬停时显示 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.

推荐答案

从 1.8.1 版开始,现在可以使用带有交互式指南的自定义内容 (https://github.com/novus/nvd3/tree/v1.8.1-alpha).

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';
});

这篇关于NVD3 工具提示内容不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆