Angular Nvd3 - tool tip customization not working

165 views Asked by At

I am working on a chart that requires a custom tooltip I have been setting up a generation function

Using chart.Tooltip.contentGenerator The function doesn't seem to get called, even on hover . I cant see why this is not working

I am using 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,
1

There are 1 answers

2
Le Dac Sy On

Try again with this tooltip:

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

It works on this: http://plnkr.co/edit/Dx2WJs?p=preview