0

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

user2637015
  • 723
  • 2
  • 12
  • 27

1 Answers1

0
chart.stacked.dispatch.on('areaClick.updateExamples', function(e) {
        setTimeout(function() {
          mainExample.update();
          exampleOne.update();
          //exampleThree.update();
        }, 100);
      })

solve problem using this event listener

mainExample, exampleOne is chart list what you need iterlock

user2637015
  • 723
  • 2
  • 12
  • 27