ashiguruma / patternomaly

Easily generate patterns for use in data graphics
MIT License
524 stars 37 forks source link

pattern.draw doesn't work in IE11 #17

Closed Kota-M closed 5 years ago

Kota-M commented 6 years ago

I'm using patternomaly with Chart.js. It is able to add patterns on our pie chart, except for IE11. The chart isn't displayed at all, and there is no error message in console. If it excludes the feature of patternomaly, the chart shows.

However, I would like to correspond it for IE. Do you know any solution?

JoeKuhns commented 6 years ago

In the compiled file, after the function getRandomShape()

add the following Object.assign polyfill.

if (typeof Object.assign != 'function') {
  // Must be writable: true, enumerable: false, configurable: true
  Object.defineProperty(Object, 'assign', {
    value: function assign(target) { // .length of function is 2
      'use strict';
      if (target == null) { // TypeError if undefined or null
        throw new TypeError('Cannot convert undefined or null to object');
      }
      var to = Object(target);
      for (var index = 1; index < arguments.length; index++) {
        var nextSource = arguments[index];

        if (nextSource != null) { // Skip over if undefined or null
          for (var nextKey in nextSource) {
            // Avoid bugs when hasOwnProperty is shadowed
            if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
              to[nextKey] = nextSource[nextKey];
            }
          }
        }
      }
      return to;
    },
    writable: true,
    configurable: true
  });
}

Otherwise see the Pull Request by @castorls https://github.com/ashiguruma/patternomaly/pull/14

ashiguruma commented 5 years ago

This should now be fixed as part of #24.