'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 _d3TimeFormat = require('d3-time-format');

var timeFormat = _interopRequireWildcard(_d3TimeFormat);

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({}, timeFormat);

var Dots = function Dots(props) {
  var circles = props.data.map(function (d, i) {
    var xDataKey = d.x;
    if (props.xDataType === 'date') {
      xDataKey = d3.timeFormat('%b %e')(d.x);
    }
    return _react2.default.createElement('circle', {
      className: 'dot',
      r: '5',
      cx: props.xScale(d.x),
      cy: props.yScale(d.y),
      fill: '#F3F4F2',
      stroke: '#3f5175',
      strokeWidth: '5px',
      key: i,
      onMouseOver: props.showToolTip,
      onMouseOut: props.hideToolTip,
      'data-key': xDataKey,
      'data-value': d.y
    });
  });

  return _react2.default.createElement(
    'g',
    null,
    ' ',
    circles,
    ' '
  );
};

Dots.propTypes = {
  showToolTip: _propTypes2.default.func,
  hideToolTip: _propTypes2.default.func,
  data: _propTypes2.default.array,
  xScale: _propTypes2.default.func,
  yScale: _propTypes2.default.func,
  xDataType: _propTypes2.default.string
};

Dots.defaultProps = {
  xDataType: 'number'
};

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