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

Render Charts in div #299

merged 8 commits into from
Sep 25, 2017

Conversation

boygirl
Copy link
Contributor

@boygirl boygirl commented Sep 21, 2017

this PR changes how portals are rendered to give z-index control to portal components

fixes FormidableLabs/victory#752

This change should also make it easy to create a custom html portal for rendering html labels and tooltips

This may be a breaking change for parent styles, as it changes the rendered tree

before:

<svg {...parentProps} overflow="visible">
  <svg {...parentProps}>
    {children}
  </svg>
    {title ? <title id={this.getIdForElement("title")}>{title}</title> : null}
    {desc ? <desc id={this.getIdForElement("desc")}>{desc}</desc> : null}
   // portalComponent renders a <g>
  {React.cloneElement(portalComponent, { ref: this.savePortalRef })}
</svg>

after:

<div style={defaults({}, style, divStyle)} className={className}>
  <svg {...svgProps} style={{ ...svgStyle, pointerEvents: "all" }}>
    {title ? <title id={this.getIdForElement("title")}>{title}</title> : null}
    {desc ? <desc id={this.getIdForElement("desc")}>{desc}</desc> : null}
    {children}
  </svg>
  <div style={{ ...divStyle, zIndex: portalZIndex, position: "relative", marginTop }}>
    // portalComponent renders an <svg>
    {React.cloneElement(portalComponent, { ...portalProps, ref: this.savePortalRef })}
  </div>
</div>

@boygirl boygirl self-assigned this Sep 21, 2017
@boygirl boygirl merged commit 2559e96 into master Sep 25, 2017
@boygirl boygirl deleted the experiment/portal branch September 25, 2017 19:37
@boygirl boygirl changed the title Experiment/portal Render Charts in div Sep 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tooltips are overlapped by adjacent charts
1 participant