Skip to content

Commit

Permalink
Updated react-vis to 1.10.2 (#999)
Browse files Browse the repository at this point in the history
* Updated react-vis to 1.10.2

The features we introduced in XYPlot are now merged into react-vis after uber/react-vis#857. The XYPlotExtended class is removed.

The div aroung the XYPlot is also removed since it's not required. All snapshots are updated after this removal.

* Updated CHANGELOG

* Reverting 492d28a to keep the wrapping div around the chart

* Fixed the react-vis version to the stable one.

Check this issue comments to see the status: uber/react-vis#861
  • Loading branch information
markov00 authored Jul 13, 2018
1 parent 72b77cb commit fc54395
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 118 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Make some proprties of `EuiFlyout` optional ([#1003](https://github.com/elastic/eui/pull/1003))
- Add typings for `EuiFlyout`, `EuiFlyoutBody`, `EuiFlyoutHeader`, and `EuiFlyoutFooter` ([#1001](https://github.com/elastic/eui/pull/1001))
- Gave `EuiFlyout` close button a data-test-subj ([#1000](https://github.com/elastic/eui/pull/1000))
- Updated `react-vis` version to `1.10.2`. ([#999](https://github.com/elastic/eui/pull/999))

**Breaking changes**

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"react-datepicker": "v1.4.1",
"react-input-autosize": "^2.2.1",
"react-virtualized": "^9.18.5",
"react-vis": "^1.10.1",
"react-vis": "1.10.2",
"serve": "^6.3.1",
"tabbable": "^1.1.0",
"uuid": "^3.1.0"
Expand Down
107 changes: 2 additions & 105 deletions src/components/xy_chart/xy_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { EuiDefaultAxis } from './axis/default_axis';
import { EuiCrosshairX } from './crosshairs/crosshair_x';
import { EuiCrosshairY } from './crosshairs/crosshair_y';
import { VISUALIZATION_COLORS } from '../../services';
import { getSeriesChildren } from './utils/series_utils';
import { ORIENTATION, SCALE } from './utils/chart_utils';
const { HORIZONTAL, VERTICAL, BOTH } = ORIENTATION;
const { LINEAR, ORDINAL, CATEGORY, TIME, TIME_UTC, LOG, LITERAL } = SCALE;
Expand All @@ -20,108 +19,6 @@ const DEFAULT_MARGINS = {
bottom: 40
};

/**
* The extended version of the react-vis XYPlot with the mouseLeave and mouseUp handlers.
* TODO: send a PR to react-vis for incorporate these two changes directly into XYPlot class.
*/
class XYExtendedPlot extends XYPlot {
/**
* Trigger onMouseLeave handler if it was passed in props.
* @param {Event} event Native event.
* @private
*/
_mouseLeaveHandler(event) {
const { onMouseLeave, children } = this.props;
if (onMouseLeave) {
super.onMouseLeave(event);
}
const seriesChildren = getSeriesChildren(children);
seriesChildren.forEach((child, index) => {
const component = this[`series${index}`];
if (component && component.onParentMouseLeave) {
component.onParentMouseLeave(event);
}
});
}

/**
* Trigger onMouseUp handler if it was passed in props.
* @param {Event} event Native event.
* @private
*/
_mouseUpHandler = (event) => {
const { onMouseUp, children } = this.props;
if (onMouseUp) {
super.onMouseUp(event);
}
const seriesChildren = getSeriesChildren(children);
seriesChildren.forEach((child, index) => {
const component = this[`series${index}`];
if (component && component.onParentMouseUp) {
component.onParentMouseUp(event);
}
});
}

render() {
const {
className,
dontCheckIfEmpty,
style,
width,
height,
} = this.props;

if (!dontCheckIfEmpty && this._isPlotEmpty()) {
return (
<div
className={`rv-xy-plot ${className}`}
style={{
width: `${width}px`,
height: `${height}px`,
...this.props.style
}}
/>
);
}
const components = this._getClonedChildComponents();

return (
<div
style={{
width: `${width}px`,
height: `${height}px`
}}
className={`rv-xy-plot ${className}`}
>
<svg
className="rv-xy-plot__inner"
width={width}
height={height}
style={style}
onClick={this._clickHandler}
onDoubleClick={this._doubleClickHandler}
onMouseDown={this._mouseDownHandler}
onMouseMove={this._mouseMoveHandler}
onMouseLeave={this._mouseLeaveHandler}
onMouseEnter={this._mouseEnterHandler}
onMouseUp={this._mouseUpHandler}
onTouchStart={this._mouseDownHandler}
onTouchMove={this._touchMoveHandler}
onTouchEnd={this._touchEndHandler}
onTouchCancel={this._touchCancelHandler}
onWheel={this._wheelHandler}
>
{components.filter(c => c && c.type.requiresSVG)}
</svg>
{this.renderCanvasComponents(components, this.props)}
{components.filter(c => c && !c.type.requiresSVG && !c.type.isCanvas)}
</div>
);
}
}


/**
* The root component of any XY chart.
* It renders an react-vis XYPlot including default axis and a valid crosshair.
Expand Down Expand Up @@ -231,7 +128,7 @@ class XYChart extends PureComponent {
const seriesNames = this._getSeriesNames(children);
return (
<div {...rest}>
<XYExtendedPlot
<XYPlot
ref={this._xyPlotRef}
dontCheckIfEmpty
width={width}
Expand All @@ -258,7 +155,7 @@ class XYChart extends PureComponent {
orientation={selectionBrushOrientation}
/>
)}
</XYExtendedPlot>
</XYPlot>
</div>
);
}
Expand Down
63 changes: 51 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3628,7 +3628,19 @@ fb-watchman@^2.0.0:
dependencies:
bser "^2.0.0"

fbjs@^0.8.16, fbjs@^0.8.9:
fbjs@^0.8.16:
version "0.8.17"
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd"
dependencies:
core-js "^1.0.0"
isomorphic-fetch "^2.1.1"
loose-envify "^1.0.0"
object-assign "^4.1.0"
promise "^7.1.1"
setimmediate "^1.0.5"
ua-parser-js "^0.7.18"

fbjs@^0.8.9:
version "0.8.16"
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.16.tgz#5e67432f550dc41b572bf55847b8aca64e5337db"
dependencies:
Expand Down Expand Up @@ -4641,10 +4653,16 @@ [email protected]:
version "0.3.6"
resolved "https://registry.yarnpkg.com/i/-/i-0.3.6.tgz#d96c92732076f072711b6b10fd7d4f65ad8ee23d"

[email protected], iconv-lite@^0.4.17, iconv-lite@~0.4.13:
[email protected], iconv-lite@^0.4.17:
version "0.4.19"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b"

iconv-lite@~0.4.13:
version "0.4.23"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63"
dependencies:
safer-buffer ">= 2.1.2 < 3"

icss-replace-symbols@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded"
Expand Down Expand Up @@ -5617,6 +5635,10 @@ js-tokens@^3.0.0, js-tokens@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"

"js-tokens@^3.0.0 || ^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"

js-yaml@^3.4.3, js-yaml@^3.7.0, js-yaml@^3.9.1:
version "3.10.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc"
Expand Down Expand Up @@ -6085,7 +6107,13 @@ longest@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"

loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.0, loose-envify@^1.3.1:
loose-envify@^1.0.0, loose-envify@^1.3.1:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
dependencies:
js-tokens "^3.0.0 || ^4.0.0"

loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
dependencies:
Expand Down Expand Up @@ -7884,14 +7912,21 @@ prompt@^1.0.0:
utile "0.3.x"
winston "2.1.x"

prop-types@^15.5.10, prop-types@^15.5.6, prop-types@^15.5.8, prop-types@^15.6.0:
prop-types@^15.5.10, prop-types@^15.5.6, prop-types@^15.6.0:
version "15.6.0"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.0.tgz#ceaf083022fc46b4a35f69e13ef75aed0d639856"
dependencies:
fbjs "^0.8.16"
loose-envify "^1.3.1"
object-assign "^4.1.1"

prop-types@^15.5.8:
version "15.6.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102"
dependencies:
loose-envify "^1.3.1"
object-assign "^4.1.1"

prop-types@^15.6.1:
version "15.6.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.1.tgz#36644453564255ddda391191fb3a125cbdf654ca"
Expand Down Expand Up @@ -8192,9 +8227,9 @@ react-virtualized@^9.18.5:
loose-envify "^1.3.0"
prop-types "^15.6.0"

react-vis@^1.10.1:
version "1.10.1"
resolved "https://registry.yarnpkg.com/react-vis/-/react-vis-1.10.1.tgz#e9b49474001186666b4094cfa8b0395f74b22df6"
[email protected].2:
version "1.10.2"
resolved "https://registry.yarnpkg.com/react-vis/-/react-vis-1.10.2.tgz#7520bd31bb2f81a8faef49cc285f678fd0795242"
dependencies:
d3-array "^1.2.0"
d3-collection "^1.0.3"
Expand Down Expand Up @@ -8811,6 +8846,10 @@ [email protected], safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, s
version "5.1.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"

"safer-buffer@>= 2.1.2 < 3":
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"

[email protected]:
version "1.3.0"
resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.3.0.tgz#8d1d9350e25622da30de3e44ba692b5221ab7c50"
Expand Down Expand Up @@ -9956,9 +9995,9 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"

ua-parser-js@^0.7.9:
version "0.7.17"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.17.tgz#e9ec5f9498b9ec910e7ae3ac626a805c4d09ecac"
ua-parser-js@^0.7.18, ua-parser-js@^0.7.9:
version "0.7.18"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.18.tgz#a7bfd92f56edfb117083b69e31d2aa8882d4b1ed"

uc.micro@^1.0.1, uc.micro@^1.0.5:
version "1.0.5"
Expand Down Expand Up @@ -10538,8 +10577,8 @@ whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3:
iconv-lite "0.4.19"

whatwg-fetch@>=0.10.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"
version "2.0.4"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f"

whatwg-url@^6.4.0:
version "6.4.0"
Expand Down

0 comments on commit fc54395

Please sign in to comment.