I want to show a data though various types of graph.
so i make function to write graph like this
drawLineChart('linechart2');
drawBarChat('barchart1');
function drawLineChart(div) {
nv.addGraph(function() {
var chart = nv.models.lineChart();
var fitScreen = false;
var width = 600;
var height = 300;
var zoom = 1;
chart.useInteractiveGuideline(true);
chart.xAxis
.tickFormat(d3.format(',r'));
chart.lines.dispatch.on("elementClick", function(e) {
alert(e.value+' / '+e.point);
});
chart.yAxis
.axisLabel('Voltage (v)')
.tickFormat(d3.format(',.2f'));
d3.select('#'+div+' svg')
.attr('perserveAspectRatio', 'xMinYMid')
.attr('width', width)
.attr('height', height)
.datum(sinAndCos())
.call(chart);
return chart;
});
}
i didn't make function for bar chart yet but the question is
how to interlock "element click event(hide and show element)" with other chart ?
want to make 4 type charts like http://nvd3.org/ main page example