Monduiz
Monduiz

Reputation: 721

d3.select not updating chart in web page

I want to pupdate data in a d3 chart with a click on an html object #id.

I coded it in jsfiddle and it works perfectly. However, when using it in a web page, it doesnt work. Its basically just a simple leaflet map and the chart is generated in a popup with an html <span id=#id> element to trigger the update.

I have no idea why it just doesn't work. I can get the update to work once by using jquery like $("#id").click(function() {

instead of d3.select("#id").on("click", function() { which is my preference.

Has anyone encountered this issue?

The working jsfiddle: https://jsfiddle.net/Monduiz/kaqv37gu/

Upvotes: 0

Views: 57

Answers (1)

Srikanta
Srikanta

Reputation: 1147

I faced a similar issue when the .onClick() was not being fired for a dropdown button. I moved the function into $(document).ready() and then it was recognised and triggered upon user action. Not sure about the reason though.

Upvotes: 1

Related Questions