Below piece of code does not work in IE 11, it throws a syntax error in the console
g.selectAll(\".mainBars\")
.append(\"text\")
.attr(\"x\", d =>
IE doesn't support the arrow notation as of now but there is a handy and fast way for transpiling your ES6
codes to ES5.1
for working in IE
. visit the Babel website then paste your codes in the left box and copy the right box code that is transpiled to the earlier version of JavaScript
.
For example, your code is transpiled to:
"use strict";
g.selectAll(".mainBars").append("text").attr("x", function (d) {
return d.part == "primary" ? -40 : 40;
}).attr("y", function (d) {
return +6;
}).text(function (d) {
return d.key;
}).attr("text-anchor", function (d) {
return d.part == "primary" ? "end" : "start";
});