react-charts icon indicating copy to clipboard operation
react-charts copied to clipboard

Data is not correctly displayed when stacked

Open cedricdelpoux opened this issue 3 years ago • 1 comments

Screenshot 2022-12-17 at 06 18 17

const data = [
    {
      label: "Data 1",
      data: [
        {
          date: "01",
          kilometers: 10,
        },
        {
          date: "03",
          kilometers: 9,
        },
      ],
    },
    {
      label: "Data 2",
      data: [
        {
          date: "01",
          kilometers: 70,
        },
        {
          date: "02",
          kilometers: 50,
        },
        {
          date: "04",
          kilometers: 100,
        },
      ],
    },
  ]
  
  const primaryAxis = React.useMemo(
    () => ({
      getValue: (datum) => datum.date,
    }),
    []
  )

  const secondaryAxes = React.useMemo(
    () => [
      {
        getValue: (datum) => datum.kilometers,
        elementType: "bar",
        stacked: true,
      },
    ],
    []
  )
  
<Chart
  options={{
    data,
    primaryAxis,
    secondaryAxes,
/>

cedricdelpoux avatar Dec 17 '22 05:12 cedricdelpoux

I'm too facing same issue..it would be good if someone can look into it


image

Tushar2098 avatar Jul 16 '23 10:07 Tushar2098