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
hacky container fix
  • Loading branch information
boygirl committed Sep 18, 2017
commit 0b639d8d8e10d7dab1dad4e391e073d92978564d
3 changes: 2 additions & 1 deletion src/victory-container/victory-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default class VictoryContainer extends React.Component {
const { title, desc, portalComponent, className, width, height } = 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%" }}>
Expand All @@ -106,7 +107,7 @@ export default class VictoryContainer extends React.Component {
{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: -height, pointerEvents: "none" }}>
<div style={{ zIndex: 1, position: "relative", marginTop: percent, pointerEvents: "none" }}>
<svg viewBox={parentProps.viewBox} style={{ width: "100%", height: "100%" }} overflow="visible">
{React.cloneElement(portalComponent, { ref: this.savePortalRef })}
</svg>
Expand Down