Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dc js - unable to redraw charts

I've created few graphs using the dc.js. Everything runs very smooth.

But the problem is when I try to add reset button for some reason it's not working.

Below is the anchor tag I'm using to reset the graph.

<a class="reset" href="javascript:Chart1.filterAll();dc.redrawAll();" style="display: none;">reset</a>

Someone help me if i'm missing anything. I couldn't get any documentation of the reset stuff.

like image 847
user3206082 Avatar asked Jan 11 '23 06:01

user3206082


1 Answers

The problem was that you were defining your chart variable inside the local scope of the Javascript code executed at the beginning. This means that it wasn't accessible from the scope of the button Javascript, which generated an error.

To fix, simply remove the var from the definition of the chart variable. Complete example here.

like image 104
Lars Kotthoff Avatar answered Jan 18 '23 17:01

Lars Kotthoff