Skip to content

XYChart: Handling gaps in data #1727

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

You must be logged in to vote

Hey @RyKilleen thanks for checking out visx. To create gaps in your LineSeries all you'll need to do is fill in the missing x values in your dataset and set the corresponding y values to null.

For example

[
  { x: '2023-04-30', y: 10 },
  { x: '2023-05-01', y: 10 },
  { x: '2023-05-02', y: null }, // add something like this
  { x: '2023-05-03', y: null }, // add something like this
  { x: '2023-05-04', y: 10 },
]

That should accomplish something like this (link). I would note that you must set stroke-linecap=round in order to see single points surrounded by missing data (this is the default in XYChart, but mentioning in case anyone overrides this)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RyKilleen
Comment options

Answer selected by RyKilleen
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