-2

I am trying to use a d3 visualization that works perfect in chrome, but internet explorer throws a syntax error.

The error appears to be on the line:

d=>color[d.primary]

var bp=viz.bP()
            .data(data)
            .min(12)
            .pad(1)
            .height(h)
            .width(w)
            .barSize(35)
            .fill(d=>color[d.primary]);

It seems like IE doesn't support that syntax. Can anyone suggest how it should be written instead?

corycorycory
  • 1,448
  • 2
  • 23
  • 42

1 Answers1

2

Try doing something like this

var bp=viz.bP()
            .data(data)
            .min(12)
            .pad(1)
            .height(h)
            .width(w)
            .barSize(35)
            .fill(function(d){
                return color[d.primary]
            });

Also, in the future, check out caniuse to figure out what you can use in what browsers

mjkaufer
  • 4,047
  • 5
  • 27
  • 55