esbullington / react-d3

Modular React charts made with d3.js
https://reactiva.github.io/react-d3-website/
MIT License
1.75k stars 179 forks source link

LineChart IE 11 error > Error: Object doesn't support property or method 'assign' #309

Closed mjasnikovs closed 8 years ago

mjasnikovs commented 8 years ago

Error: Object doesn't support property or method 'assign' Compiled with webpack

IE shows error here

  _createClass(ChartSvg, [{
    key: 'render',
    value: function render() {
      var _props = this.props;
      var height = _props.height;
      var width = _props.width;
      var margins = _props.margins;
      var svgClassName = _props.svgClassName;
      var id = _props.id;
      var children = _props.children;

      var t = 'translate(' + margins.left + ', ' + margins.top + ')';

      return _react2['default'].createElement(
        'svg',
        {
          height: height,
          width: width,
          className: svgClassName,
          id: id,
          ref: 'svgContainer'
        },
        _react2['default'].createElement(
          'g',
          {
            transform: t
          },
          children
        )
      );
    }
  }], [{
    key: 'defaultProps',
    value: Object.assign(_commonProps2['default'], {
      svgClassName: 'react-d3-core__container_svg',
      onZoom: function onZoom() {},
      scaleExtent: [1, 10]
    }),
    enumerable: true
  }, {
    key: 'propTypes',
    value: {
      id: _react.PropTypes.string,
      width: _react.PropTypes.number.isRequired,
      height: _react.PropTypes.number.isRequired,
      margins: _react.PropTypes.object.isRequired,
      svgClassName: _react.PropTypes.string.isRequired
    },
    enumerable: true
  }]);

Creating data

        var chartSeries = [
                            {
                                field: 'value',
                                name: 'Koeficients',
                                color: '#2780E3'
                            },
                            {
                                field: 'target',
                                name: 'Mērķis',
                                color: '#3FB618'
                            }
                        ],
                        x = (d) => { return d.index },
                        y = (d) => { return d.value }

        let data = []
        for (let i = 0; i < 25; i++) {
            data.push({index: i, target: 80, value: Math.floor((Math.random() * 100) + 1)})
        }

Render

                                <LineChart
                                  width= {1200}
                                  height= {300}
                                  data= {data}
                                  chartSeries= {chartSeries}
                                  x= {x}
                                /> 
yang-wei commented 8 years ago

This shouldn't be our problem though. However error shows that Object.assign method is not support so you might want to add the polyfill (should be configurable with webpack)

johnsoftek commented 8 years ago

@mjasnikovs IE11 does indeed support Object.assign - unless it is operating in an old compatibility mode, either explicitly requested or maybe due to use of jquery: http://stackoverflow.com/questions/27712715/issues-with-developer-tools-ie-11-error-object-doesnt-support-property-or