簡體   English   中英

Angular Nvd3-工具提示自定義不起作用

[英]Angular Nvd3 - tool tip customization not working

我正在處理需要自定義tooltip的圖表,而我一直在設置生成函數

使用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,

使用此工具提示重試:

tooltip: {
                enabled: true,
                contentGenerator: function (key) {
                    return  "<div>hello tooltip content </div>";
                }
            }

它適用於此: http : //plnkr.co/edit/Dx2WJs?p=preview

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM