Claire
Claire

Reputation: 11

Does Recharts have an option for floating bar charts?

I want to create a floating bar chart that mimics a boxplot, since Recharts doesn't have a boxplot option. Is there a way to create a floating box plot in Recharts?

Upvotes: 1

Views: 1600

Answers (1)

Fullchee Zhang
Fullchee Zhang

Reputation: 691

Floating Bar chart

Yes!

Setting the data to be an array of two values will work.

const data = [
  {
    name: "Page A",
    uv: [1500, 4500]
  },
  {
    name: "Page B",
    uv: [1000, 3000]
  },
];

enter image description here

https://codesandbox.io/s/simple-bar-chart-forked-ol9h5

Update: To get it to be floating if the Bar has a stackId https://recharts.org/en-US/api/Bar#stackId, have one stack be at the bottom with color: transparent

Upvotes: 1

Related Questions