diff --git a/src/victory-container/victory-container.js b/src/victory-container/victory-container.js index c99005f..4de1790 100644 --- a/src/victory-container/victory-container.js +++ b/src/victory-container/victory-container.js @@ -30,6 +30,7 @@ export default class VictoryContainer extends React.Component { } static defaultProps = { + className: "VictoryContainer", portalComponent: , portalZIndex: 99, responsive: true @@ -101,7 +102,7 @@ export default class VictoryContainer extends React.Component { const { title, desc, portalComponent, className, width, height, portalZIndex } = props; const children = this.getChildren(props); const divStyle = { pointerEvents: "none", touchAction: "none", position: "relative" }; - const svgStyle = { width: "100%", height: "100%", top: 0, left: 0 }; + const svgStyle = { width: "100%", height: "100%" }; const portalProps = { width, height, viewBox: svgProps.viewBox, style: assign({}, svgStyle, { overflow: "visible" }) }; @@ -112,7 +113,7 @@ export default class VictoryContainer extends React.Component { {desc ? {desc} : null} {children} -
+
{React.cloneElement(portalComponent, { ...portalProps, ref: this.savePortalRef })}
diff --git a/src/victory-util/helpers.js b/src/victory-util/helpers.js index eafd64c..86ab732 100644 --- a/src/victory-util/helpers.js +++ b/src/victory-util/helpers.js @@ -5,15 +5,16 @@ import React from "react"; export default { getPoint(datum) { const exists = (val) => val !== undefined; - const { x, _x, _x1, _x0, _voronoiX, y, _y, _y1, _y0, _voronoiY } = datum; - const defaultX = exists(_x1) ? _x1 : _x || x; - const defaultY = exists(_y1) ? _y1 : _y || y; - return { + const { _x, _x1, _x0, _voronoiX, _y, _y1, _y0, _voronoiY } = datum; + const defaultX = exists(_x1) ? _x1 : _x; + const defaultY = exists(_y1) ? _y1 : _y; + const point = { x: exists(_voronoiX) ? _voronoiX : defaultX, - x0: exists(_x0) ? _x0 : _x || x, + x0: exists(_x0) ? _x0 : _x, y: exists(_voronoiY) ? _voronoiY : defaultY, - y0: exists(_y0) ? _y0 : _y || y + y0: exists(_y0) ? _y0 : _y }; + return defaults({}, point, datum); }, scalePoint(props, datum) {