Javascript 角度Nvd3-刀尖自定义不起作用

Javascript 角度Nvd3-刀尖自定义不起作用,javascript,coffeescript,angular-nvd3,Javascript,Coffeescript,Angular Nvd3,我正在处理一个需要自定义工具提示的图表 我一直在设置一个生成函数 使用chart.Tooltip.contentGenerator 该函数似乎没有被调用,即使在悬停状态下也是如此。我不明白这为什么不起作用 我使用的是nvd3 angular 1.0.5 $scope.chart_options = label_interval : label_interval chart: tooltip: contentG

我正在处理一个需要自定义工具提示的图表 我一直在设置一个生成函数

使用
chart.Tooltip.contentGenerator
该函数似乎没有被调用,即使在悬停状态下也是如此。我不明白这为什么不起作用

我使用的是
nvd3 angular 1.0.5

$scope.chart_options =
        label_interval : label_interval
        chart:
            tooltip:
                contentGenerator:(t)->
                    console.log 'tooltip'
                    return '<div>hello tooltip content </div>'
            type:         'multiBarChart',
            height:       300,
            groupSpacing: 0.05,
            forceX : [$scope.start.toDate(), $scope.end.toDate()],
            duration: 500,
            reduceXTicks : false
            transitionDuration: 1000,
            padData: true,
            duration:1000,
            margin:
                top: 20,
                right: 20,
                bottom: 60,
                left: 50
            ,
            x : (d) ->
                return d.date_time.toDate()
            y : (d) ->
                if !d.gross_impressions
                    return 0;
                return d.gross_impressions
            xAxis:
                #showMaxMin  :false
                tickValues : $scope.tickValues,
                showMaxMin:true
            ,
            yAxis:
                axisLabel: "Y Axis"
                #axisLabelDistance: 20
                #tickFormat: (d)->return $scope.measures[$scope.selected_measure].value_formatter(d)
                tickFormat: (d)->
                    return d
            ,
            useInteractiveGuideline:false,
            showLegend:false,
            showControls:false,
            interactive: true,
            tooltips: true,
$scope.chart\u选项=
标签间隔:标签间隔
图表:
工具提示:
内容生成器:(t)->
console.log“工具提示”
返回“hello工具提示内容”
类型:“多重条形图”,
身高:300,
分组间距:0.05,
forceX:[$scope.start.toDate(),$scope.end.toDate()],
持续时间:500,
reduceXTicks:false
过渡期:1000,
帕达塔:是的,
持续时间:1000,
保证金:
前20名,
右:20,,
底数:60,
左:50
,
x:(d)->
返回d.date\u time.toDate()
y:(d)->
如果!d、 总印象
返回0;
返回d.gross_印象
xAxis:
#showMaxMin:false
tickValues:$scope.tickValues,
showMaxMin:对
,
亚克斯:
axisLabel:“Y轴”
#轴间距:20
#tickFormat:(d)->返回$scope.measures[$scope.selected\u measures].value\u格式化程序(d)
格式:(d)->
返回d
,
useInteractiveGuideline:false,
showLegend:false,
showControls:false,
互动:没错,
工具提示:正确,

使用此工具提示重试:

tooltip: {
                enabled: true,
                contentGenerator: function (key) {
                    return  "<div>hello tooltip content </div>";
                }
            }
工具提示:{
启用:对,
contentGenerator:函数(键){
返回“hello工具提示内容”;
}
}

它的工作原理是:

没有变化,它仍然没有被调用。我看到了一个工具提示,但它只是一个小正方形,在未定义的区域有y值。您能分享更多关于代码的信息吗?正如我看到的,库不理解您的lambda表达式代码。咖啡脚本可能不适合它。您应该先尝试使用javascript,看看它是否有效。