point tooltip for linechart does not work in the new version of nvd3
Opened this issue · 0 comments
kouroshparsa commented
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div id="chart">
<svg style="width:550px;height:550px;"></svg>
</div>
<link rel="stylesheet" href="./css/nv.d3.css" rel="stylesheet" />
<script src="./js/d3.v3.min.js"></script>
<script src="./js/nv.d3.community.js"></script>
<script>
function draw_line_chart(data, ylabel='', labels=null, yrange=null, is_time_scale=false){
/*
data: [{values: [{x: 1, y: 1}, {x:2, y:1}], key: 'curve1'}]
*/
nv.addGraph(function() {
var chart = nv.models.lineChart();
chart.margin({
top: 30,
right: 60,
bottom: 70,
left: 160
});
var datum = data;
chart.xAxis.rotateLabels(-25).tickFormat(function(d) {
if(is_time_scale){
return d3.time.format('%Y-%b')(new Date(parseInt(d)))
}else{
if(Math.floor(d)==d){
return labels[d]
}
return '';
}
});
var y_lbl_format = ',.0f';
chart.yAxis.tickFormat(d3.format(y_lbl_format))
.axisLabel(ylabel);
if(yrange!=null){
chart.forceY(yrange);
}
chart.showLegend(true).useVoronoi(false);
d3.select('#chart svg').datum(datum).transition().duration(500).attr('height', 450).call(chart);
});
}
var data = [{values: [{x: 1, y: 1}, {x:2, y:2}, {x:3, y:4}, {x:4, y:2}], key: 'curve1'}];
var labels = ['a', 'b', 'c', 'd', 'e'];
draw_line_chart(data, ylabel='y', labels=labels);
</script>
</body>
</html>
I have the linechart sample above. With nvd3 version 1.7 when I hover over the points, it shows a tooltip with the relevant info but with the new version ("1.8.4-dev") it does not display the tooltip.
I want to upgrade to the new version in order to use the new features...
NVD3 version used: "1.8.4-dev"
Browser and OS used: Chrome
Expected Behaviour: It should show tooltips when hovering over points
Present Behaviour: It does not show a tooltip and does not display any errors in the console.