Is layering XYcharts on top of each other possible? #1161
Answered
by
williaster
VigneshTrantor
asked this question in
Q&A
-
Hey guys, |
Beta Was this translation helpful? Give feedback.
Answered by
williaster
Apr 14, 2021
Replies: 1 comment 2 replies
-
this should be possible, I think you'd just need to
Something like this might work for 1) (untested) import { ParentSize } from '@visx/responsive';
import { XYChart, ... } from '@visx/xychart';
// rendered inside of the container of choice, it will expand to 100% width/height
() => (
<ParentSize>
{({ width, height }) => (
<>
<XYChart width={width} height={height} {...propsAndChildren1} />
<div style={{ position: 'absolute', top: 0, left: 0, width, height }}>
<XYChart width={width} height={height} {...propsAndChildren2} />
</div>
</>
)}
</ParentSize>
) For shared tooltips you could probably pull out the |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
VigneshTrantor
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this should be possible, I think you'd just need to
absolute
ly position one in a container on top of the other. Two things that might be tricky areabsolute
ly positioned container won't have any size on its own and would render with 0width/height
.Something like this might work for 1) (untested)