'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _d3Shape = require('d3-shape');

var shape = _interopRequireWildcard(_d3Shape);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var d3 = Object.assign({}, shape);
var array = _propTypes2.default.array,
    func = _propTypes2.default.func,
    string = _propTypes2.default.string;


var PlotArea = function PlotArea(props) {
  var color = props.color,
      data = props.data,
      xScale = props.xScale,
      yScale = props.yScale;

  var area = d3.area().x(function (d) {
    return xScale(d.x);
  }).y0(yScale(yScale.domain()[0])).y1(function (d) {
    return yScale(d.y);
  }).curve(d3.curveCardinal);

  return _react2.default.createElement(
    'g',
    null,
    _react2.default.createElement('path', { className: 'area', fill: color, d: area(data) })
  );
};

PlotArea.propTypes = {
  color: string,
  data: array,
  xScale: func.isRequired,
  yScale: func.isRequired
};

PlotArea.defaultProps = {};

exports.default = PlotArea;
//# sourceMappingURL=PlotArea.js.map