Is there a way to make Internet Explorer understand this.style.setProperty?

I started using the excellent D3.js data visualization library ( http://mbostock.github.com/d3/ ).

The results work fine in Firefox and Chrome, but not in IE. One problem seems to be the heavy use of this.style.setProperty and this.style.removeProperty on D3, which is not recognized by IE.

I wondered if anyone knew of a workaround or laying or some of these? (My JavaScript is pretty bad, BTW).

+4
source share
3 answers

I fought with the same error that you can simply solve using the following template when you want to change the style.

element.style("property", "value"); 

It is imperative that the value always contains a string. Otherwise, you get a strange Character error in IE9, because it can only process strings.

I tested it with D3JS 3.2.8.

+1
source

What about .classed ('class', true / false)? It works fine in IE9:

 function mouseOver(d, i) { var element = d3.select(this); var alreadyHasClass = element.classed('className'); // boolean element.classed('cssClass', !alreadyHasClass); // set/remove class } 

By the way, it adds / removes classes to elements faster than it adds information to the "style".

0
source

I believe the new version 2.1.3 solves this. Take a look.

0
source

All Articles