javascript - custom x axis tooltip for nvd3 scatter chart -


i using nvd3 scatter chart , see tooltip content can customized using following function.

chart.tooltipcontent(function (key, x, y, e, graph) {     return '<p><strong>' + key + '</strong></p>' +            '<p>' + e.value + ' in month ' + x + '</p>';     }); 

when mouse moves on bubble, custom tooltip content , x-value , y-value of point/bubble highlighted/shown. instead of displaying x-axis label, want display custom content. how can this?

thanks,

chart.tooltipcontent deprecated in nvd3 now. use custom content in tooltip, want use

chart.tooltip.contentgenerator(function(obj) {code build tooltip}) 

in order see data have work in function, start adding line:

chart.tooltip.contentgenerator(function (obj) { return json.stringify(obj)}) 

and you'll able hover on data point , see object working with.

look in src/tooltip.js @ default function used contentgenerator starting around line 76 see great example of kind of function build , pass contentgenerator

here relevant section in documentation documentation


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -