Skip to content

Is layering XYcharts on top of each other possible? #1161

Answered by williaster
VigneshTrantor asked this question in Q&A
Discussion options

You must be logged in to vote

this should be possible, I think you'd just need to absolutely position one in a container on top of the other. Two things that might be tricky are

  1. matching the chart dimensions between the two if you need them to be responsive, because whichever you render inside an absolutely positioned container won't have any size on its own and would render with 0 width/height.
  2. supporting Tooltips for both (ideally you would probably want a tooltip to show data points across both charts)

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% w…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@VigneshTrantor
Comment options

@VigneshTrantor
Comment options

Answer selected by VigneshTrantor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants