Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pie chart with animation causes 'non-unique keys' react-dom warning #4004

Closed
1 task done
lennartfranke opened this issue Nov 30, 2023 · 26 comments
Closed
1 task done

Comments

@lennartfranke
Copy link

lennartfranke commented Nov 30, 2023

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Open codesandbox and open console, see react non-unique key warnings.

What is expected?

All generated sector elements have a unique key in any case.

What is actually happening?

If isAnimationActive is set to true all sectors in the pie chart are initially rendered with the same start and end angle and therefore have the same key prop.

Environment Info
Recharts v2.10.2
React react 18.2.0
System MacOS 14.1.1
Browser Chrome 119.0.6045.159
@ckifer
Copy link
Member

ckifer commented Nov 30, 2023

@imagineLife

ckifer pushed a commit that referenced this issue Nov 30, 2023
## Description

Updates the `key` value for pie sectors

## Related Issue
[4004](#4004)

## Motivation and Context
Fix a duplicate-key error

## How Has This Been Tested?
- [x] new passing test based on codesandbox example in original issue

## Types of changes

- [x] Bug fix (non-breaking change which fixes an issue)

## Checklist:
- [x] My code follows the code style of this project.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
@ckifer
Copy link
Member

ckifer commented Nov 30, 2023

@imagineLife it looks like there are more instances of this. Can you go through the demo and look for all instances? They don't show on the storybook for some reason...

npm run demo -> ComposedChart - produces another duplicate set of keys for tooltip

@ckifer
Copy link
Member

ckifer commented Nov 30, 2023

same with legend item

@imagineLife
Copy link
Contributor

Surely 👍

  • Can this convo be "migrated" to this issue? there are perhaps many keys that need updating that aren't "throwing" lint errors during development :/ I can post more based on some of my findings either here or the other issue

@ckifer
Copy link
Member

ckifer commented Nov 30, 2023

Summarized over there

ckifer pushed a commit that referenced this issue Dec 1, 2023
## Description
In pursuit of removing all `no-array-index-key` lint-skipping instances,
some keys are more complicate to set, particularly
- Labels
- Tooltips
- Pie segments

## Related Issue
[4004](#4004)  
[3273](#3273)  

## Motivation and Context
_Remove immediately-discovered console warnings based on demo charts_.  

## How Has This Been Tested?
- [x] manual usage of demo charts
- [x] unit tests are still passing

## Types of changes

- [x] "Bug" fix (non-breaking change which fixes an issue)

## Checklist:
- [x] My code follows the code style of this project.
- [x] All new and existing tests passed.
@ckifer
Copy link
Member

ckifer commented Dec 1, 2023

This should be resolved in the latest (see sandbox https://codesandbox.io/s/pie-chart-of-straight-angle-forked-rvsnly)

We'll try to be more careful when making key changes!

@ckifer ckifer closed this as completed Dec 1, 2023
renovate bot added a commit to SAP/ui5-webcomponents-react that referenced this issue Dec 1, 2023
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [recharts](https://togithub.com/recharts/recharts) | [`2.10.2` ->
`2.10.3`](https://renovatebot.com/diffs/npm/recharts/2.10.2/2.10.3) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/recharts/2.10.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/recharts/2.10.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/recharts/2.10.2/2.10.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/recharts/2.10.2/2.10.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>recharts/recharts (recharts)</summary>

###
[`v2.10.3`](https://togithub.com/recharts/recharts/releases/tag/v2.10.3)

[Compare
Source](https://togithub.com/recharts/recharts/compare/v2.10.2...v2.10.3)

#### What's Changed

- Fix non-unique react `key` bug(s) by
[@&#8203;imagineLife](https://togithub.com/imagineLife) in
[recharts/recharts#4006
- closes
[recharts/recharts#4004

#### New Contributors

- [@&#8203;hkmarques](https://togithub.com/hkmarques) made their first
contribution in
[recharts/recharts#4002

**Full Changelog**:
recharts/recharts@v2.10.2...v2.10.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/SAP/ui5-webcomponents-react).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@HHongSeungWoo
Copy link
Member

Unfortunately, it seems that Bar also need to be reverted

@imagineLife
Copy link
Contributor

imagineLife commented Dec 2, 2023

Unfortunately, it seems that Bar also need to be reverted

Hi @HHongSeungWoo 👋 Do you have &/or can you put together an example showing the key error, like a code sandbox? :/ The bar tests all pass and the demo bar charts all render without key errors, I'd love to see what props and/or features cause the key issue! (and likely reset the recent key-change back to index-based until more thorough testing is done on cases like this!)

@HHongSeungWoo
Copy link
Member

Hello~! It seems that errors may occur when directly controlling the axis.
For example, <XAxis type="number" domain={[0, 100]} />

It appears that in some cases, entry.x or entry.y could become null or NaN.
An error occurs when the values are the same in such situations.

@DiegoZan
Copy link

DiegoZan commented Jan 10, 2024

Hi!
I am also having this warning.
Code is very straightforward:

<ResponsiveContainer width='100%' height='100%'>
   <BarChart
      data={dataPercentage}
      layout='vertical'
      margin={{ top: 5, right: 10, left: 10, bottom: 5,}}
   >
      <CartesianGrid strokeDasharray='3 3' fill='#eee' />
      <XAxis type='number' />
      <YAxis type='category' dataKey="name" tick={{ fontSize: 12 }} />
      <Tooltip content={<CustomTooltip />} />
      <Legend wrapperStyle={{fontSize: 12, fontWeight: 600}} formatter={renderColorfulLegendText} iconSize={12} />
      <Bar dataKey="inSLA" stackId="a" fill="#007700" maxBarSize={10} />
      <Bar dataKey="outSLA" stackId="a" fill="#cc0000" maxBarSize={10} />
   </BarChart>
</ResponsiveContainer>

The warning only shows when two bars have the exact same values. E.g.:

{
   name: 'Service 1',
   inSLA: 5,
   outSLA: 7
}
 
{
   name: 'Service 2',
   inSLA: 5,
   outSLA: 7
}

Warnings are:

Warning: Encountered two children with the same key, `rectangle-164.62-5-83,100`. 
Keys should be unique so that components maintain their identity across updates. 
Non-unique keys may cause children to be duplicated and/or omitted — the 
behavior is unsupported and could change in a future version.

@ckifer
Copy link
Member

ckifer commented Jan 10, 2024

Is this after updating to 2.10.4?

@DiegoZan
Copy link

It happens with both 2.10.3 and 2.10.4.

@ckifer
Copy link
Member

ckifer commented Jan 10, 2024

Thanks - sorry about this, these key issues are hard to manage...

@ckifer
Copy link
Member

ckifer commented Jan 10, 2024

@imagineLife - I don't think its possible to use your approach for key in pie sectors, we'll have to add the index in there to prevent bugs like this

@ckifer ckifer reopened this Jan 10, 2024
@imagineLife
Copy link
Contributor

Hello all 👋
here's a fork+branch showing no errors using the example in the above comment, sans legend and tooltip, as some code is not in that snippet.

@ckifer @DiegoZan can a separate issue+codesandbox be made to show the key error?
Screenshot 2024-01-18 at 7 57 16 AM

@TVYDev
Copy link

TVYDev commented Jan 26, 2024

I have also been facing this warning with PieChart.

recharts: 2.10.4
react: 18.2.0

@ckifer
Copy link
Member

ckifer commented Jan 26, 2024

Can you provide us the data that causes this?

@TVYDev
Copy link

TVYDev commented Jan 26, 2024

@ckifer
I've done a little more testing.
It seems to show warning when two or more items of data have value property equals zero.

CodeSandbox to check out.

@ckifer
Copy link
Member

ckifer commented Jan 26, 2024

@imagineLife

@sudojoseph
Copy link

sudojoseph commented Feb 1, 2024

following

@ckifer
Copy link
Member

ckifer commented Feb 9, 2024

re-added index in 2.12. Not the end of the overall issue but should resolve the errors

@ckifer ckifer closed this as completed Feb 9, 2024
anatolii-yemets added a commit to opendatadiscovery/odd-platform that referenced this issue Feb 13, 2024
renovate bot added a commit to specfy/specfy that referenced this issue Feb 21, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [recharts](https://togithub.com/recharts/recharts) | [`2.9.3` ->
`2.12.1`](https://renovatebot.com/diffs/npm/recharts/2.9.3/2.12.1) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/recharts/2.12.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/recharts/2.12.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/recharts/2.9.3/2.12.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/recharts/2.9.3/2.12.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>recharts/recharts (recharts)</summary>

###
[`v2.12.1`](https://togithub.com/recharts/recharts/releases/tag/v2.12.1)

[Compare
Source](https://togithub.com/recharts/recharts/compare/v2.12.0...v2.12.1)

#### What's Changed

Unintentional regression broke panoramic/compact Brush in 2.11.0 and
2.12.0, backport the fix to 2.x as we work on 3.x

##### Fix

- fix: compact render should read from context, fixes brush panorama by
[@&#8203;ckifer](https://togithub.com/ckifer) in
[recharts/recharts#4194
fixes
[recharts/recharts#4193

**Full Changelog**:
recharts/recharts@v2.12.0...v2.12.1

###
[`v2.12.0`](https://togithub.com/recharts/recharts/releases/tag/v2.12.0)

[Compare
Source](https://togithub.com/recharts/recharts/compare/36c14c63d271d05b701e1d32ac931de0fd30b360...v2.12.0)

#### What's Changed

Bug fixes and a few small new features.

Releasing 2.12.0 to create a "clean slate" as contributors are
discussing next moves for recharts.

We will try to focus on upgrades, architectural changes, and
long-pending breaking changes so we can release a recharts v3. This will
not be a large major version, or one hard to upgrade to, but rather a
major version bump to prevent us from breaking people with library
upgrades, large refactors, etc. Feature parity should hold. Thanks!

#### Features

- `Bar`: Accept a callback function for `minPointSize` so it can be
determined by data by [@&#8203;ckifer](https://togithub.com/ckifer) in
[recharts/recharts#4099
closes
[recharts/recharts#2819
- `Accessibility`: Enable screen reader support with accessibilityLayer
and default tooltip by
[@&#8203;julianna-langston](https://togithub.com/julianna-langston) in
[recharts/recharts#4077

#### Fix

- `Bar`: `activeBar` should not be true by default, fixes a breaking
change from 2.9.0 by [@&#8203;ckifer](https://togithub.com/ckifer) in
[recharts/recharts#4139
- fixes
[recharts/recharts#4103
and
[recharts/recharts#4101
- `Scatter`: fix non-unique key errors by
[@&#8203;imagineLife](https://togithub.com/imagineLife) in
[recharts/recharts#4087
- fixes
[recharts/recharts#4151
and
[recharts/recharts#4060
- `Pie`: fix non-unique key errors by
[@&#8203;imagineLife](https://togithub.com/imagineLife) in
[recharts/recharts#4106
- `Tooltip`: fix bug that caused throttled tooltip to stay active when
moving mouse quickly by
[@&#8203;HHongSeungWoo](https://togithub.com/HHongSeungWoo) in
[recharts/recharts#4100
fixes
[recharts/recharts#4093

#### Chore

- Cleanup, tests, and refactoring work. Thanks
[@&#8203;PavelVanecek](https://togithub.com/PavelVanecek)
- Upgrade react smooth, remove `translateStyle`, remove prop-types as a
peerDep
- **NOTE**: animations will no longer have browser prefixes on them.
Browsers have good support for this
(https://caniuse.com/?search=transforms)
-   Upgrade dev dependencies
    -   Upgrade TypeScript to 4.9.5 (no definition changes from upgrade)

#### Storybook

-   New storybook stories and doc updates

#### New Contributors

- [@&#8203;TRFielder](https://togithub.com/TRFielder) made their first
contribution in
[recharts/recharts#4088

**Full Changelog**:
recharts/recharts@v2.11...v2.12.0

###
[`v2.11.0`](https://togithub.com/recharts/recharts/compare/v2.10.4...36c14c63d271d05b701e1d32ac931de0fd30b360)

[Compare
Source](https://togithub.com/recharts/recharts/compare/v2.10.4...36c14c63d271d05b701e1d32ac931de0fd30b360)

###
[`v2.10.4`](https://togithub.com/recharts/recharts/releases/tag/v2.10.4)

[Compare
Source](https://togithub.com/recharts/recharts/compare/v2.10.3...v2.10.4)

#### What's Changed

Fix some older bugs annoying bugs, TS typings, update to the storybook
theme, and more

##### Fix

- `ResponsiveContainer`: fix `ref.current.current` without breaking
users using current implementation by
[@&#8203;HHongSeungWoo](https://togithub.com/HHongSeungWoo) in
[recharts/recharts#4008
- closes
[recharts/recharts#3718
- `Brush`: Allow Brush to be controlled with start and end index via
state by [@&#8203;ckifer](https://togithub.com/ckifer) in
[recharts/recharts#4034
- closes
[recharts/recharts#2404
- `Legend`: TypeScript - Add the dataKey type to legend props by
[@&#8203;HHongSeungWoo](https://togithub.com/HHongSeungWoo) in
[recharts/recharts#4035
- closes
[recharts/recharts#2909
- `Pie`: TypeScript - added `payload` to `PieSectorDataItem` type by
[@&#8203;PavelVanecek](https://togithub.com/PavelVanecek) in
[recharts/recharts#4030
- `Pie`: unique sector keys fix by
[@&#8203;imagineLife](https://togithub.com/imagineLife) in
[recharts/recharts#4009
closes
[recharts/recharts#3273
- `RadialBar`: allow className to be passed to Radial Bar background by
[@&#8203;ckifer](https://togithub.com/ckifer) in
[recharts/recharts#4027
- closes
[recharts/recharts#4011

##### Storybook

- Storybook: Added Legend component story! by
[@&#8203;AnujSharma141](https://togithub.com/AnujSharma141) in
[recharts/recharts#4039
- Storybook: add controlled brush storybook entry by
[@&#8203;ckifer](https://togithub.com/ckifer) in
[recharts/recharts#4032
- Storybook: Custom Storybook theme for Recharts brand by
[@&#8203;csdiehl](https://togithub.com/csdiehl) in
[recharts/recharts#4016

#### New Contributors

- [@&#8203;csdiehl](https://togithub.com/csdiehl) made their first
contribution in
[recharts/recharts#4016
- [@&#8203;AnujSharma141](https://togithub.com/AnujSharma141) made their
first contribution in
[recharts/recharts#4039

**Full Changelog**:
recharts/recharts@v2.10.3...v2.10.4

###
[`v2.10.3`](https://togithub.com/recharts/recharts/releases/tag/v2.10.3)

[Compare
Source](https://togithub.com/recharts/recharts/compare/v2.10.2...v2.10.3)

#### What's Changed

- Fix non-unique react `key` bug(s) by
[@&#8203;imagineLife](https://togithub.com/imagineLife) in
[recharts/recharts#4006
- closes
[recharts/recharts#4004

#### New Contributors

- [@&#8203;hkmarques](https://togithub.com/hkmarques) made their first
contribution in
[recharts/recharts#4002

**Full Changelog**:
recharts/recharts@v2.10.2...v2.10.3

###
[`v2.10.2`](https://togithub.com/recharts/recharts/releases/tag/v2.10.2)

[Compare
Source](https://togithub.com/recharts/recharts/compare/v2.10.1...v2.10.2)

#### What's Changed

Patch some bugs from 2.9 / 2.10

##### Fix

- `Tooltip`: Fix tooltip rendering crash when activeItem is undefined by
[@&#8203;tran-simon](https://togithub.com/tran-simon) in
[recharts/recharts#3982
- `Cursor`: should no longer show gray background on hover where there
was none previously
[@&#8203;HHongSeungWoo](https://togithub.com/HHongSeungWoo) in
[recharts/recharts#3992
- `Tooltip`: show tooltip when `data` prop is on individual cartesian
component by [@&#8203;HHongSeungWoo](https://togithub.com/HHongSeungWoo)
in
[recharts/recharts#3988
- `LabelList` - TypeScript: LabelList offset prop issue by
[@&#8203;ckifer](https://togithub.com/ckifer) in
[recharts/recharts#3999

##### Accessibility

- `Brush`: set default aria-label and allow value override by
[@&#8203;enriquetamames-cpi](https://togithub.com/enriquetamames-cpi) in
[recharts/recharts#3950

##### Refactor / Cleanup

- Removing some eslint errors for "no array index key" by
[@&#8203;imagineLife](https://togithub.com/imagineLife)

#### New Contributors

- [@&#8203;tran-simon](https://togithub.com/tran-simon) made their first
contribution in
[recharts/recharts#3982
- [@&#8203;enriquetamames-cpi](https://togithub.com/enriquetamames-cpi)
made their first contribution in
[recharts/recharts#3950

**Full Changelog**:
recharts/recharts@v2.10.1...v2.10.2

###
[`v2.10.1`](https://togithub.com/recharts/recharts/releases/tag/v2.10.1):
Patch: Do not include types from test folder

[Compare
Source](https://togithub.com/recharts/recharts/compare/15328ec11b78968c847b43b646767b7b0c0d9e36...v2.10.1)

Fixes
[recharts/recharts#3978

**Full Changelog**:
recharts/recharts@v2.10...v2.10.1

###
[`v2.10.0`](https://togithub.com/recharts/recharts/compare/v2.9.3...15328ec11b78968c847b43b646767b7b0c0d9e36)

[Compare
Source](https://togithub.com/recharts/recharts/compare/v2.9.3...15328ec11b78968c847b43b646767b7b0c0d9e36)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 4pm every weekday" in timezone
Europe/Paris, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/specfy/specfy).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44MS4zIiwidXBkYXRlZEluVmVyIjoiMzcuMjAwLjAiLCJ0YXJnZXRCcmFuY2giOiJjaG9yZS9yZW5vdmF0ZUJhc2VCcmFuY2gifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@viniciusrad
Copy link

I had this problem for a whole day, it took my sleep, the next day after a lot of research I partially understood the reason for the problem/warning and managed to make it stop

I used a trick that may not be the best solution, but at least the warning disappeared

I used
import dynamic from "next/dynamic";
const NoSSR = dynamic(() => import('../componentes/NeedleChartComponent'), { ssr: false })
I don't know why but 'use client' in the files involved wasn't enough

and on return I used
<NoSSR charValue={40} labelTitle='Cpu Usage'/>

Maybe everyone should try this approach when the problem arises.

@ckifer
Copy link
Member

ckifer commented Apr 10, 2024

it took my sleep

😅 - hoping that this issue doesn't take anyone else's sleep

@viniciusrad can you share the code and the data that made the chart throw the key error? You shouldn't have to do that work-around. Does this happen when not using next?

@TimonSotiropoulos
Copy link

TimonSotiropoulos commented Apr 16, 2024

I am having the same issue, basically I am rendering 2 Scatter datasets because i want the resulting points to be different sizes (and there doesn't seem to be a way to get access to that within the Scatter Cells, or at least not in the documentation).

The easiest way to solve this would be to add the key from the parent Scatter component down onto the actual Layer that is wrapping each ScatterPoint render:

  renderSymbolsStatically(points: ScatterPointItem[]) {
    const { shape, activeShape, activeIndex } = this.props;
    const baseProps = filterProps(this.props, false);

    return points.map((entry, i) => {
      const isActive = activeIndex === i;
      const option = isActive ? activeShape : shape;
      const props = { key: `symbol-${i}`, ...baseProps, ...entry };

      return (
        <Layer
          className="recharts-scatter-symbol"
          {...adaptEventsOfChild(this.props, entry, i)}
          // eslint-disable-next-line react/no-array-index-key
          key={`symbol-${entry?.cx}-${entry?.cy}-${entry?.size}-${i}`} // <---- Update this line to pass the key from the scatter parent
          role="img"
        >
          <ScatterSymbol option={option} isActive={isActive} {...props} />
        </Layer>
      );
    });
  }

This would need to be done in the animation part of the component as well, but this is a pretty big issue at the moment as you can't have 2 different sized datasets without doing some weird transformations on the data.

Heres a subset of what I have in my codebase that doesn't work if you want to attempt to recreate:

<RECHARTS.ScatterChart
            width={_props.width}
            height={_props.height}
            margin={{
                top: 0,
                right: 0,
                bottom: 0,
                left: 0,
            }}
        >
            <RECHARTS.XAxis
                dataKey="extent_v"
                type="number"
                name="Extent"
                unit=""
                height={xAxisHeight}
                domain={[0, 100.05]}
                ticks={[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 105]}
                tick={false}
                axisLine={<line x1="0" y1="100" x2="100" y2="20" stroke={C.THEME.Colours.White[0]} strokeWidth={1} />}
            >
                <RECHARTS.Label position={'center'} style={{ fill: C.THEME.Colours.White[0], fontSize: fontSize }}>
                    {xLabel}
                </RECHARTS.Label>
            </RECHARTS.XAxis>
            <RECHARTS.YAxis
                dataKey="severity_v"
                type="number"
                name="Severity"
                domain={[0, 0.55]}
                ticks={[0.1, 0.2, 0.3, 0.4, 0.5]}
                tick={false}
                unit=""
                axisLine={<line x1="0" y1="100" x2="100" y2="20" stroke="white" strokeWidth={1} />}
            >
                <RECHARTS.Label
                    angle={-90}
                    position={'center'}
                    style={{ fill: C.THEME.Colours.White[0], fontSize: fontSize, textAnchor: 'middle' }}
                >
                    {yLabel}
                </RECHARTS.Label>
            </RECHARTS.YAxis>
            <RECHARTS.ZAxis zAxisId={'dataSetCurrent'} range={[300, 301]} />
            <RECHARTS.ZAxis zAxisId={'dataSetHistory'} range={[100, 101]} />
            <RECHARTS.ZAxis zAxisId={'dataSetTimeseries'} range={[10, 11]} />
            <RECHARTS.ReferenceArea x1={0} x2={100} y1={0} y2={0.5} fill={C.THEME.Colours.Red[0]} fillOpacity={1} />
            <RECHARTS.ReferenceArea x1={0} x2={70} y1={0} y2={0.4} fill={C.THEME.Colours.Yellow[0]} fillOpacity={1} />
            <RECHARTS.ReferenceArea x1={0} x2={50} y1={0} y2={0.2} fill={C.THEME.Colours.Green[0]} fillOpacity={1} />
            {dataSetLegacyHistory ? (
                <RECHARTS.Scatter
                    key={'dataSetLegacyHistory'}
                    name="Waterbody Analysis - Timeseries"
                    id={'dataSetLegacyHistory'}
                    zAxisId={'dataSetTimeseries'}
                    data={dataSetLegacyHistory}
                    isAnimationActive={false}
                ></RECHARTS.Scatter>
            ) : null}
            {dataSet1stHistory ? (
                <RECHARTS.Scatter
                    name="Waterbody Analysis - Recent 1st Result"
                    id={'dataSet1stHistory'}
                    zAxisId={'dataSetHistory'}
                    data={dataSet1stHistory}
                    isAnimationActive={false}
                > </RECHARTS.Scatter>
            ) : null}
            {dataSetCurrent ? (
                <RECHARTS.Scatter
                    name="Waterbody Analysis - Current"
                    id={'dataSetCurrent'}
                    zAxisId={'dataSetCurrent'}
                    data={dataSetCurrent}
                    isAnimationActive={false}
                ></RECHARTS.Scatter>
            ) : null}
        </RECHARTS.ScatterChart>

@ckifer
Copy link
Member

ckifer commented Apr 16, 2024

@TimonSotiropoulos feel free to create a PR if you have something that makes sense

@TimonSotiropoulos
Copy link

TimonSotiropoulos commented Apr 16, 2024

@ckifer

#4434 is the idea, i'm sure it can be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants