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

Render Charts in div #299

Merged
merged 8 commits into from
Sep 25, 2017
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
working but incorrectly positioned for responsive containers
  • Loading branch information
boygirl committed Sep 18, 2017
commit 62e54d1335aedc6d5fc5c73b3f5caa22eda773dc
13 changes: 6 additions & 7 deletions src/victory-container/victory-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,24 @@ export default class VictoryContainer extends React.Component {
}

renderContainer(props, svgProps, style) {
const { title, desc, portalComponent, className, width, height } = props;
const { title, desc, portalComponent, className } = props;
const children = this.getChildren(props);
const parentProps = defaults({ style, className }, svgProps);
const percent = `${-height / width * 100}%`;
return (
<div style={Object.assign(style, { position: "relative" })}>
<svg viewBox={parentProps.viewBox} style={{ width: "100%", height: "100%" }}>
<svg {...parentProps} overflow="visible">
<svg>
{children}
</svg>
{title ? <title id={this.getIdForElement("title")}>{title}</title> : null}
{desc ? <desc id={this.getIdForElement("desc")}>{desc}</desc> : null}
<foreignObject>
<div style={{ zIndex: 1, position: "relative", marginTop: percent, pointerEvents: "none" }}>
<svg viewBox={parentProps.viewBox} style={{ width: "100%", height: "100%" }} overflow="visible">
<div style={{ zIndex: 1, position: "relative", pointerEvents: "none" }}>
<svg overflow="visible">
{React.cloneElement(portalComponent, { ref: this.savePortalRef })}
</svg>
</div>
</foreignObject>
</div>
</svg>
);
}

Expand Down