Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; // Copyright (c) 2016 - 2017 Uber Technologies, Inc.
  7. //
  8. // Permission is hereby granted, free of charge, to any person obtaining a copy
  9. // of this software and associated documentation files (the "Software"), to deal
  10. // in the Software without restriction, including without limitation the rights
  11. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. // copies of the Software, and to permit persons to whom the Software is
  13. // furnished to do so, subject to the following conditions:
  14. //
  15. // The above copyright notice and this permission notice shall be included in
  16. // all copies or substantial portions of the Software.
  17. //
  18. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. // THE SOFTWARE.
  25. var _react = require('react');
  26. var _react2 = _interopRequireDefault(_react);
  27. var _propTypes = require('prop-types');
  28. var _propTypes2 = _interopRequireDefault(_propTypes);
  29. var _deepEqual = require('deep-equal');
  30. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  31. var _scalesUtils = require('../utils/scales-utils');
  32. var _seriesUtils = require('../utils/series-utils');
  33. var _chartUtils = require('../utils/chart-utils');
  34. var _animation = require('../animation');
  35. var _theme = require('../theme');
  36. var _canvasWrapper = require('./series/canvas-wrapper');
  37. var _canvasWrapper2 = _interopRequireDefault(_canvasWrapper);
  38. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  39. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  40. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  41. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  42. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  43. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  44. var ATTRIBUTES = ['x', 'y', 'radius', 'angle', 'color', 'fill', 'stroke', 'opacity', 'size'];
  45. /**
  46. * Remove parents from tree formatted data. deep-equal doesnt play nice with data
  47. * that has circular structures, so we make every node single directional by pruning the parents.
  48. * @param {Array} data - the data object to have circular deps resolved in
  49. * @returns {Array} the sanitized data
  50. */
  51. function cleanseData(data) {
  52. return data.map(function (series) {
  53. if (!Array.isArray(series)) {
  54. return series;
  55. }
  56. return series.map(function (row) {
  57. return _extends({}, row, { parent: null });
  58. });
  59. });
  60. }
  61. /**
  62. * Wrapper on the deep-equal method for checking equality of next props vs current props
  63. * @param {Object} scaleMixins - Scale object.
  64. * @param {Object} nextScaleMixins - Scale object.
  65. * @param {Boolean} hasTreeStructure - Whether or not to cleanse the data of possible cyclic structures
  66. * @returns {Boolean} whether or not the two mixins objects are equal
  67. */
  68. function checkIfMixinsAreEqual(nextScaleMixins, scaleMixins, hasTreeStructure) {
  69. var newMixins = _extends({}, nextScaleMixins, {
  70. _allData: hasTreeStructure ? cleanseData(nextScaleMixins._allData) : nextScaleMixins._allData
  71. });
  72. var oldMixins = _extends({}, scaleMixins, {
  73. _allData: hasTreeStructure ? cleanseData(scaleMixins._allData) : scaleMixins._allData
  74. });
  75. // it's hard to say if this function is reasonable?
  76. return (0, _deepEqual2.default)(newMixins, oldMixins);
  77. }
  78. var XYPlot = function (_React$Component) {
  79. _inherits(XYPlot, _React$Component);
  80. _createClass(XYPlot, null, [{
  81. key: 'defaultProps',
  82. get: function get() {
  83. return {
  84. className: ''
  85. };
  86. }
  87. }, {
  88. key: 'propTypes',
  89. get: function get() {
  90. return {
  91. animation: _animation.AnimationPropType,
  92. className: _propTypes2.default.string,
  93. dontCheckIfEmpty: _propTypes2.default.bool,
  94. height: _propTypes2.default.number.isRequired,
  95. margin: _chartUtils.MarginPropType,
  96. onClick: _propTypes2.default.func,
  97. onDoubleClick: _propTypes2.default.func,
  98. onMouseDown: _propTypes2.default.func,
  99. onMouseUp: _propTypes2.default.func,
  100. onMouseEnter: _propTypes2.default.func,
  101. onMouseLeave: _propTypes2.default.func,
  102. onMouseMove: _propTypes2.default.func,
  103. onTouchStart: _propTypes2.default.func,
  104. onTouchMove: _propTypes2.default.func,
  105. onTouchEnd: _propTypes2.default.func,
  106. onTouchCancel: _propTypes2.default.func,
  107. onWheel: _propTypes2.default.func,
  108. stackBy: _propTypes2.default.oneOf(ATTRIBUTES),
  109. style: _propTypes2.default.object,
  110. width: _propTypes2.default.number.isRequired
  111. };
  112. }
  113. }]);
  114. function XYPlot(props) {
  115. _classCallCheck(this, XYPlot);
  116. var _this = _possibleConstructorReturn(this, (XYPlot.__proto__ || Object.getPrototypeOf(XYPlot)).call(this, props));
  117. _initialiseProps.call(_this);
  118. var stackBy = props.stackBy;
  119. var children = (0, _seriesUtils.getSeriesChildren)(props.children);
  120. var data = (0, _seriesUtils.getStackedData)(children, stackBy);
  121. _this.state = {
  122. scaleMixins: _this._getScaleMixins(data, props),
  123. data: data
  124. };
  125. return _this;
  126. }
  127. _createClass(XYPlot, [{
  128. key: 'componentWillReceiveProps',
  129. value: function componentWillReceiveProps(nextProps) {
  130. var children = (0, _seriesUtils.getSeriesChildren)(nextProps.children);
  131. var nextData = (0, _seriesUtils.getStackedData)(children, nextProps.stackBy);
  132. var scaleMixins = this.state.scaleMixins;
  133. var nextScaleMixins = this._getScaleMixins(nextData, nextProps);
  134. if (!checkIfMixinsAreEqual(nextScaleMixins, scaleMixins, nextProps.hasTreeStructure)) {
  135. this.setState({
  136. scaleMixins: nextScaleMixins,
  137. data: nextData
  138. });
  139. }
  140. }
  141. /**
  142. * Trigger click related callbacks if they are available.
  143. * @param {React.SyntheticEvent} event Click event.
  144. * @private
  145. */
  146. /**
  147. * Trigger doule-click related callbacks if they are available.
  148. * @param {React.SyntheticEvent} event Double-click event.
  149. * @private
  150. */
  151. }, {
  152. key: '_getClonedChildComponents',
  153. /**
  154. * Prepare the child components (including series) for rendering.
  155. * @returns {Array} Array of child components.
  156. * @private
  157. */
  158. value: function _getClonedChildComponents() {
  159. var _this2 = this;
  160. var props = this.props;
  161. var animation = this.props.animation;
  162. var _state = this.state,
  163. scaleMixins = _state.scaleMixins,
  164. data = _state.data;
  165. var dimensions = (0, _chartUtils.getInnerDimensions)(this.props, _chartUtils.DEFAULT_MARGINS);
  166. var children = _react2.default.Children.toArray(this.props.children);
  167. var seriesProps = (0, _seriesUtils.getSeriesPropsFromChildren)(children);
  168. var XYPlotValues = (0, _scalesUtils.getXYPlotValues)(props, children);
  169. return children.map(function (child, index) {
  170. var dataProps = null;
  171. if (seriesProps[index]) {
  172. // Get the index of the series in the list of props and retrieve
  173. // the data property from it.
  174. var seriesIndex = seriesProps[index].seriesIndex;
  175. dataProps = { data: data[seriesIndex] };
  176. }
  177. return _react2.default.cloneElement(child, _extends({}, dimensions, {
  178. animation: animation
  179. }, dataProps && child.type.prototype && child.type.prototype.render ? {
  180. ref: function ref(_ref) {
  181. return _this2['series' + seriesProps[index].seriesIndex] = _ref;
  182. }
  183. } : {}, seriesProps[index], scaleMixins, child.props, XYPlotValues[index], dataProps));
  184. });
  185. }
  186. /**
  187. * Get the list of scale-related settings that should be applied by default.
  188. * @param {Object} props Object of props.
  189. * @returns {Object} Defaults.
  190. * @private
  191. */
  192. }, {
  193. key: '_getDefaultScaleProps',
  194. value: function _getDefaultScaleProps(props) {
  195. var _getInnerDimensions = (0, _chartUtils.getInnerDimensions)(props, _chartUtils.DEFAULT_MARGINS),
  196. innerWidth = _getInnerDimensions.innerWidth,
  197. innerHeight = _getInnerDimensions.innerHeight;
  198. var colorRanges = ['color', 'fill', 'stroke'].reduce(function (acc, attr) {
  199. var range = props[attr + 'Type'] === 'category' ? _theme.EXTENDED_DISCRETE_COLOR_RANGE : _theme.CONTINUOUS_COLOR_RANGE;
  200. return _extends({}, acc, _defineProperty({}, attr + 'Range', range));
  201. }, {});
  202. return _extends({
  203. xRange: [0, innerWidth],
  204. yRange: [innerHeight, 0]
  205. }, colorRanges, {
  206. opacityType: _theme.OPACITY_TYPE,
  207. sizeRange: _theme.SIZE_RANGE
  208. });
  209. }
  210. /**
  211. * Get the map of scales from the props, apply defaults to them and then pass
  212. * them further.
  213. * @param {Object} data Array of all data.
  214. * @param {Object} props Props of the component.
  215. * @returns {Object} Map of scale-related props.
  216. * @private
  217. */
  218. }, {
  219. key: '_getScaleMixins',
  220. value: function _getScaleMixins(data, props) {
  221. var _ref2;
  222. var filteredData = data.filter(function (d) {
  223. return d;
  224. });
  225. var allData = (_ref2 = []).concat.apply(_ref2, _toConsumableArray(filteredData));
  226. var defaultScaleProps = this._getDefaultScaleProps(props);
  227. var optionalScaleProps = (0, _scalesUtils.getOptionalScaleProps)(props);
  228. var userScaleProps = (0, _scalesUtils.extractScalePropsFromProps)(props, ATTRIBUTES);
  229. var missingScaleProps = (0, _scalesUtils.getMissingScaleProps)(_extends({}, defaultScaleProps, optionalScaleProps, userScaleProps), allData, ATTRIBUTES);
  230. var children = (0, _seriesUtils.getSeriesChildren)(props.children);
  231. var zeroBaseProps = {};
  232. var adjustBy = new Set();
  233. var adjustWhat = new Set();
  234. children.forEach(function (child, index) {
  235. if (!child || !data[index]) {
  236. return;
  237. }
  238. ATTRIBUTES.forEach(function (attr) {
  239. var _child$type$getParent = child.type.getParentConfig(attr, child.props),
  240. isDomainAdjustmentNeeded = _child$type$getParent.isDomainAdjustmentNeeded,
  241. zeroBaseValue = _child$type$getParent.zeroBaseValue;
  242. if (isDomainAdjustmentNeeded) {
  243. adjustBy.add(attr);
  244. adjustWhat.add(index);
  245. }
  246. if (zeroBaseValue) {
  247. var specifiedDomain = props[attr + 'Domain'];
  248. zeroBaseProps[attr + 'BaseValue'] = specifiedDomain ? specifiedDomain[0] : 0;
  249. }
  250. });
  251. });
  252. return _extends({}, defaultScaleProps, zeroBaseProps, userScaleProps, missingScaleProps, {
  253. _allData: data,
  254. _adjustBy: Array.from(adjustBy),
  255. _adjustWhat: Array.from(adjustWhat),
  256. _stackBy: props.stackBy
  257. });
  258. }
  259. /**
  260. * Checks if the plot is empty or not.
  261. * Currently checks the data only.
  262. * @returns {boolean} True for empty.
  263. * @private
  264. */
  265. }, {
  266. key: '_isPlotEmpty',
  267. value: function _isPlotEmpty() {
  268. var data = this.state.data;
  269. return !data || !data.length || !data.some(function (series) {
  270. return series && series.some(function (d) {
  271. return d;
  272. });
  273. });
  274. }
  275. /**
  276. * Trigger mouse-down related callbacks if they are available.
  277. * @param {React.SyntheticEvent} event Mouse down event.
  278. * @private
  279. */
  280. /**
  281. * Trigger onMouseEnter handler if it was passed in props.
  282. * @param {React.SyntheticEvent} event Mouse enter event.
  283. * @private
  284. */
  285. /**
  286. * Trigger onMouseLeave handler if it was passed in props.
  287. * @param {React.SyntheticEvent} event Mouse leave event.
  288. * @private
  289. */
  290. /**
  291. * Trigger movement-related callbacks if they are available.
  292. * @param {React.SyntheticEvent} event Mouse move event.
  293. * @private
  294. */
  295. /**
  296. * Trigger mouse-up related callbacks if they are available.
  297. * @param {React.SyntheticEvent} event Mouse up event.
  298. * @private
  299. */
  300. /**
  301. * Trigger onTouchCancel handler if it was passed in props.
  302. * @param {React.SyntheticEvent} event Touch Cancel event.
  303. * @private
  304. */
  305. /**
  306. * Trigger onTouchEnd handler if it was passed in props.
  307. * @param {React.SyntheticEvent} event Touch End event.
  308. * @private
  309. */
  310. /**
  311. * Trigger touch movement-related callbacks if they are available.
  312. * @param {React.SyntheticEvent} event Touch move event.
  313. * @private
  314. */
  315. /**
  316. * Trigger touch-start related callbacks if they are available.
  317. * @param {React.SyntheticEvent} event Touch start event.
  318. * @private
  319. */
  320. /**
  321. * Trigger doule-click related callbacks if they are available.
  322. * @param {React.SyntheticEvent} event Double-click event.
  323. * @private
  324. */
  325. }, {
  326. key: 'renderCanvasComponents',
  327. value: function renderCanvasComponents(components, props) {
  328. var componentsToRender = components.filter(function (c) {
  329. return c && !c.type.requiresSVG && c.type.isCanvas;
  330. });
  331. if (componentsToRender.length === 0) {
  332. return null;
  333. }
  334. var _componentsToRender$ = componentsToRender[0].props,
  335. marginLeft = _componentsToRender$.marginLeft,
  336. marginTop = _componentsToRender$.marginTop,
  337. marginBottom = _componentsToRender$.marginBottom,
  338. marginRight = _componentsToRender$.marginRight,
  339. innerHeight = _componentsToRender$.innerHeight,
  340. innerWidth = _componentsToRender$.innerWidth;
  341. return _react2.default.createElement(
  342. _canvasWrapper2.default,
  343. {
  344. innerHeight: innerHeight,
  345. innerWidth: innerWidth,
  346. marginLeft: marginLeft,
  347. marginTop: marginTop,
  348. marginBottom: marginBottom,
  349. marginRight: marginRight
  350. },
  351. componentsToRender
  352. );
  353. }
  354. }, {
  355. key: 'render',
  356. value: function render() {
  357. var _props = this.props,
  358. className = _props.className,
  359. dontCheckIfEmpty = _props.dontCheckIfEmpty,
  360. style = _props.style,
  361. width = _props.width,
  362. height = _props.height;
  363. if (!dontCheckIfEmpty && this._isPlotEmpty()) {
  364. return _react2.default.createElement('div', {
  365. className: 'rv-xy-plot ' + className,
  366. style: _extends({
  367. width: width + 'px',
  368. height: height + 'px'
  369. }, this.props.style)
  370. });
  371. }
  372. var components = this._getClonedChildComponents();
  373. return _react2.default.createElement(
  374. 'div',
  375. {
  376. style: {
  377. width: width + 'px',
  378. height: height + 'px'
  379. },
  380. className: 'rv-xy-plot ' + className
  381. },
  382. _react2.default.createElement(
  383. 'svg',
  384. {
  385. className: 'rv-xy-plot__inner',
  386. width: width,
  387. height: height,
  388. style: style,
  389. onClick: this._clickHandler,
  390. onDoubleClick: this._doubleClickHandler,
  391. onMouseDown: this._mouseDownHandler,
  392. onMouseUp: this._mouseUpHandler,
  393. onMouseMove: this._mouseMoveHandler,
  394. onMouseLeave: this._mouseLeaveHandler,
  395. onMouseEnter: this._mouseEnterHandler,
  396. onTouchStart: this._mouseDownHandler,
  397. onTouchMove: this._touchMoveHandler,
  398. onTouchEnd: this._touchEndHandler,
  399. onTouchCancel: this._touchCancelHandler,
  400. onWheel: this._wheelHandler
  401. },
  402. components.filter(function (c) {
  403. return c && c.type.requiresSVG;
  404. })
  405. ),
  406. this.renderCanvasComponents(components, this.props),
  407. components.filter(function (c) {
  408. return c && !c.type.requiresSVG && !c.type.isCanvas;
  409. })
  410. );
  411. }
  412. }]);
  413. return XYPlot;
  414. }(_react2.default.Component);
  415. var _initialiseProps = function _initialiseProps() {
  416. var _this3 = this;
  417. this._clickHandler = function (event) {
  418. var onClick = _this3.props.onClick;
  419. if (onClick) {
  420. onClick(event);
  421. }
  422. };
  423. this._doubleClickHandler = function (event) {
  424. var onDoubleClick = _this3.props.onDoubleClick;
  425. if (onDoubleClick) {
  426. onDoubleClick(event);
  427. }
  428. };
  429. this._mouseDownHandler = function (event) {
  430. var _props2 = _this3.props,
  431. onMouseDown = _props2.onMouseDown,
  432. children = _props2.children;
  433. if (onMouseDown) {
  434. onMouseDown(event);
  435. }
  436. var seriesChildren = (0, _seriesUtils.getSeriesChildren)(children);
  437. seriesChildren.forEach(function (child, index) {
  438. var component = _this3['series' + index];
  439. if (component && component.onParentMouseDown) {
  440. component.onParentMouseDown(event);
  441. }
  442. });
  443. };
  444. this._mouseEnterHandler = function (event) {
  445. var _props3 = _this3.props,
  446. onMouseEnter = _props3.onMouseEnter,
  447. children = _props3.children;
  448. if (onMouseEnter) {
  449. onMouseEnter(event);
  450. }
  451. var seriesChildren = (0, _seriesUtils.getSeriesChildren)(children);
  452. seriesChildren.forEach(function (child, index) {
  453. var component = _this3['series' + index];
  454. if (component && component.onParentMouseEnter) {
  455. component.onParentMouseEnter(event);
  456. }
  457. });
  458. };
  459. this._mouseLeaveHandler = function (event) {
  460. var _props4 = _this3.props,
  461. onMouseLeave = _props4.onMouseLeave,
  462. children = _props4.children;
  463. if (onMouseLeave) {
  464. onMouseLeave(event);
  465. }
  466. var seriesChildren = (0, _seriesUtils.getSeriesChildren)(children);
  467. seriesChildren.forEach(function (child, index) {
  468. var component = _this3['series' + index];
  469. if (component && component.onParentMouseLeave) {
  470. component.onParentMouseLeave(event);
  471. }
  472. });
  473. };
  474. this._mouseMoveHandler = function (event) {
  475. var _props5 = _this3.props,
  476. onMouseMove = _props5.onMouseMove,
  477. children = _props5.children;
  478. if (onMouseMove) {
  479. onMouseMove(event);
  480. }
  481. var seriesChildren = (0, _seriesUtils.getSeriesChildren)(children);
  482. seriesChildren.forEach(function (child, index) {
  483. var component = _this3['series' + index];
  484. if (component && component.onParentMouseMove) {
  485. component.onParentMouseMove(event);
  486. }
  487. });
  488. };
  489. this._mouseUpHandler = function (event) {
  490. var _props6 = _this3.props,
  491. onMouseUp = _props6.onMouseUp,
  492. children = _props6.children;
  493. if (onMouseUp) {
  494. onMouseUp(event);
  495. }
  496. var seriesChildren = (0, _seriesUtils.getSeriesChildren)(children);
  497. seriesChildren.forEach(function (child, index) {
  498. var component = _this3['series' + index];
  499. if (component && component.onParentMouseUp) {
  500. component.onParentMouseUp(event);
  501. }
  502. });
  503. };
  504. this._touchCancelHandler = function (event) {
  505. var onTouchCancel = _this3.props.onTouchCancel;
  506. if (onTouchCancel) {
  507. onTouchCancel(event);
  508. }
  509. };
  510. this._touchEndHandler = function (event) {
  511. var onTouchEnd = _this3.props.onTouchEnd;
  512. if (onTouchEnd) {
  513. onTouchEnd(event);
  514. }
  515. };
  516. this._touchMoveHandler = function (event) {
  517. var _props7 = _this3.props,
  518. onTouchMove = _props7.onTouchMove,
  519. children = _props7.children;
  520. if (onTouchMove) {
  521. onTouchMove(event);
  522. }
  523. var seriesChildren = (0, _seriesUtils.getSeriesChildren)(children);
  524. seriesChildren.forEach(function (child, index) {
  525. var component = _this3['series' + index];
  526. if (component && component.onParentTouchMove) {
  527. component.onParentTouchMove(event);
  528. }
  529. });
  530. };
  531. this._touchStartHandler = function (event) {
  532. var _props8 = _this3.props,
  533. onTouchStart = _props8.onTouchStart,
  534. children = _props8.children;
  535. if (onTouchStart) {
  536. onTouchStart(event);
  537. }
  538. var seriesChildren = (0, _seriesUtils.getSeriesChildren)(children);
  539. seriesChildren.forEach(function (child, index) {
  540. var component = _this3['series' + index];
  541. if (component && component.onParentTouchStart) {
  542. component.onParentTouchStart(event);
  543. }
  544. });
  545. };
  546. this._wheelHandler = function (event) {
  547. var onWheel = _this3.props.onWheel;
  548. if (onWheel) {
  549. onWheel(event);
  550. }
  551. };
  552. };
  553. XYPlot.displayName = 'XYPlot';
  554. exports.default = XYPlot;