Accepted answer

pieChart is local to the closure, not a global object. Instead of var pieChart = ..., assign the chart to the global window object using window.pieChart = ....

This is the kind of thing that is covered in a basic Javascript book. I'd recommend picking one up. The first thing to know when starting to learn Javascript libraries like dc.js and Crossfilter is the language itself.


I was facing the same issue before. After a while I realize the Chart variables are defined inside the D3 callback. So if you define your chart variables before D3.tsv or D3.csv it will work like below:

<script type="text/ecmascript" async="async">
    var pieChart; //Define all your chart Variables here
    d3.csv("Data/MyData.csv", function (errormsg, Data) {

Related Query