Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

add default class name, fix bug #307

Merged
merged 1 commit into from
Oct 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/victory-container/victory-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default class VictoryContainer extends React.Component {
}

static defaultProps = {
className: "VictoryContainer",
portalComponent: <Portal/>,
portalZIndex: 99,
responsive: true
Expand Down Expand Up @@ -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" })
};
Expand All @@ -112,7 +113,7 @@ export default class VictoryContainer extends React.Component {
{desc ? <desc id={this.getIdForElement("desc")}>{desc}</desc> : null}
{children}
</svg>
<div style={{ ...svgStyle, zIndex: portalZIndex, position: "absolute" }}>
<div style={{ ...svgStyle, zIndex: portalZIndex, position: "absolute", top: 0, left: 0 }}>
{React.cloneElement(portalComponent, { ...portalProps, ref: this.savePortalRef })}
</div>
</div>
Expand Down
13 changes: 7 additions & 6 deletions src/victory-util/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down