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

Extend clip path configs - new PR #3602

Merged
merged 15 commits into from May 31, 2023

Conversation

ckifer
Copy link
Member

@ckifer ckifer commented May 23, 2023

Description

Extend clip path configs by @tylerben in 2022

This is the same description and the same PR as #2488 with some changes for type safety as well as merging in the latest and adding a story.

Opening this for draft for thoughts since this work is already done. @nikolasrieble thoughts on these changes to get this stale PR closed?

Related Issue

#2304

Motivation and Context

How Has This Been Tested?

  • test functionality in local storybook

Screenshots (if appropriate):

Without clipDot
image

With clipDot
image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@@ -416,7 +425,7 @@ export default class Demo extends Component<any, any> {
};

render() {
const { data, data01, data02, opacity } = this.state;
const { data, data01, data02, data04, opacity } = this.state;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering, do we want to continue maintaining the demo? Should we consider moving things into storybook instead? 🤔
Unrelated to this PR, curious to hear your opinion.

Copy link
Member Author

@ckifer ckifer May 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah we shouldn't keep maintaining the demo. This was just completely mimicking the linked PR which was pre-storybook.

I think it's fine to merge changes to the demo since it doesn't hurt anything, but overall yeah we have no need for it anymore.

Maybe we should look over it and see if there are any useful things to add to examples

@ckifer
Copy link
Member Author

ckifer commented May 31, 2023

@nikolasrieble think this is good to go?

@nikolasrieble nikolasrieble self-requested a review May 31, 2023 16:18
Copy link
Contributor

@nikolasrieble nikolasrieble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@ckifer ckifer merged commit 91801b1 into recharts:master May 31, 2023
5 checks passed
@ckifer ckifer deleted the extend-clip-path-configs branch May 31, 2023 17:57
@ckifer
Copy link
Member Author

ckifer commented Jun 15, 2023

clipDot={false} causing dots to disappear in 2.7 https://codesandbox.io/s/simple-line-chart-forked-4gczxs?file=/src/App.tsx

@ckifer
Copy link
Member Author

ckifer commented Jun 15, 2023

undefined * 2 + undefined happening here

This default does not work

const { r, strokeWidth } = filterProps(dot) || { r: 3, strokeWidth: 2 };

renovate bot added a commit to SAP/ui5-webcomponents-react that referenced this pull request Jun 15, 2023
[![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.6.2` ->
`2.7.0`](https://renovatebot.com/diffs/npm/recharts/2.6.2/2.7.0) |
[![age](https://badges.renovateapi.com/packages/npm/recharts/2.7.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/recharts/2.7.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/recharts/2.7.0/compatibility-slim/2.6.2)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/recharts/2.7.0/confidence-slim/2.6.2)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>recharts/recharts</summary>

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

[Compare
Source](https://togithub.com/recharts/recharts/compare/v2.6.2...v2.7.0)

#### What's Changed

Storybook updates, a few new features, bug fixes.

**Note:** This release may cause more reports of [this defaultProps
warning](https://togithub.com/recharts/recharts/issues/3615) - we are
aware of this and trying to come up with a feasible solution.

##### Feat

- Allow adding initial dimensions to ResponsiveContainer by
[@&#8203;akamfoad](https://togithub.com/akamfoad) in
[recharts/recharts#3596
- Extend clip path configuration with `clipDot` prop by
[@&#8203;tylerben](https://togithub.com/tylerben)
[@&#8203;ckifer](https://togithub.com/ckifer) in
[recharts/recharts#3602
- Support "bumpX" and "bumpY" curve types by
[@&#8203;jacknevitt](https://togithub.com/jacknevitt) in
[recharts/recharts#3617

##### Fix

- Account for `angle` prop on XAxis visibility calculation by
[@&#8203;bernardobelchior](https://togithub.com/bernardobelchior) in
[recharts/recharts#3576
- Propagate className to CartesianAxis by
[@&#8203;mitrotasios](https://togithub.com/mitrotasios) in
[recharts/recharts#3592
- Add SVGProps to PieLabel type by
[@&#8203;timbonicus](https://togithub.com/timbonicus) in
[recharts/recharts#3594
- Export default tooltip and legend content components by
[@&#8203;oschwede](https://togithub.com/oschwede) in
[recharts/recharts#3604
- Fix error bars not working in stacked bar charts by
[@&#8203;ckifer](https://togithub.com/ckifer) in
[recharts/recharts#3612
- Remove role="img" attribute from bar to prevent accessibility issues
by using incorrect role by
[@&#8203;rhuangabrielsantos](https://togithub.com/rhuangabrielsantos) in
[recharts/recharts#3614

##### Docs

- lots of storybook changes - [go check it
out](https://release--63da8268a0da9970db6992aa.chromatic.com/)!

##### Refactor

- refactor: `Dot` to function component by
[@&#8203;akamfoad](https://togithub.com/akamfoad) in
[recharts/recharts#3478
- refactor: `Polygon` to function component by
[@&#8203;akamfoad](https://togithub.com/akamfoad) in
[recharts/recharts#3479
- refactor: `Reactangle` to function component by
[@&#8203;akamfoad](https://togithub.com/akamfoad) in
[recharts/recharts#3480
- refactor: `Sector` to function component by
[@&#8203;akamfoad](https://togithub.com/akamfoad) in
[recharts/recharts#3481
- refactor: `Trapezoid` to function component by
[@&#8203;akamfoad](https://togithub.com/akamfoad) in
[recharts/recharts#3482
- refactor: change `Symbols` to functional component by
[@&#8203;Yilun-Sun](https://togithub.com/Yilun-Sun) in
[recharts/recharts#3485
- refactor: `DefaultTooltipContent` to be functional component by
[@&#8203;akamfoad](https://togithub.com/akamfoad) in
[recharts/recharts#3618

#### New Contributors

- [@&#8203;CoffeeGeek101](https://togithub.com/CoffeeGeek101) made their
first contribution in
[recharts/recharts#3561
- [@&#8203;bernardobelchior](https://togithub.com/bernardobelchior) made
their first contribution in
[recharts/recharts#3576
- [@&#8203;mitrotasios](https://togithub.com/mitrotasios) made their
first contribution in
[recharts/recharts#3592
- [@&#8203;timbonicus](https://togithub.com/timbonicus) made their first
contribution in
[recharts/recharts#3594
- [@&#8203;oschwede](https://togithub.com/oschwede) made their first
contribution in
[recharts/recharts#3604
- [@&#8203;rhuangabrielsantos](https://togithub.com/rhuangabrielsantos)
made their first contribution in
[recharts/recharts#3614
- [@&#8203;jacknevitt](https://togithub.com/jacknevitt) made their first
contribution in
[recharts/recharts#3617

**Full Changelog**:
recharts/recharts@v2.6.2...v2.7.0

</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://app.renovatebot.com/dashboard#github/SAP/ui5-webcomponents-react).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMTcuMyIsInVwZGF0ZWRJblZlciI6IjM1LjExNy4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
ckifer added a commit that referenced this pull request Jun 15, 2023
…provided by the user (#3624)

<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->
Basically
https://codesandbox.io/s/simple-line-chart-forked-4gczxs?file=/src/App.tsx

When `allowDataOverflow` is true on an axis and `clipDot` is false on a
`dot` (in a Line or Area) without `r` or `strokeWidth` the calculations
[here](https://github.com/recharts/recharts/blob/bf8d626c76c0534fd2a762c0859d6be9e1459e37/src/cartesian/Line.tsx#L468)
cause `NaN` to be added on the `clipPath` and cause console errors. This
is because the defaults just above that do not work if the user provides
their own props for dot i.e. `dot={{ clipDot: false }}`.

Fix this by defaulting the params to the same values they default to if
the user provides no params.

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->
#3602
PR where this was merged, no issue yet. Follow up from release

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->
Fix bug released in 2.7

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
`clipPath` for dots has valid values and does not add attributes with
NaN.

* no more console errors
* add unit test to confirm this for line

## Screenshots (if appropriate):
<img width="505" alt="image"
src="https://github.com/recharts/recharts/assets/25180830/b89acae0-db57-41d4-ab92-41fdc4b2a616">


## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [Y] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [Y] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [Y] I have added tests to cover my changes.
- [Y] All new and existing tests passed.

Co-authored-by: Coltin Kifer <ckifer@amazon.com>
@ckifer
Copy link
Member Author

ckifer commented Jun 15, 2023

GMer78 pushed a commit to GMer78/recharts-1 that referenced this pull request Nov 24, 2023
…provided by the user (recharts#3624)

<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->
Basically
https://codesandbox.io/s/simple-line-chart-forked-4gczxs?file=/src/App.tsx

When `allowDataOverflow` is true on an axis and `clipDot` is false on a
`dot` (in a Line or Area) without `r` or `strokeWidth` the calculations
[here](https://github.com/recharts/recharts/blob/bf8d626c76c0534fd2a762c0859d6be9e1459e37/src/cartesian/Line.tsx#L468)
cause `NaN` to be added on the `clipPath` and cause console errors. This
is because the defaults just above that do not work if the user provides
their own props for dot i.e. `dot={{ clipDot: false }}`.

Fix this by defaulting the params to the same values they default to if
the user provides no params.

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->
recharts#3602
PR where this was merged, no issue yet. Follow up from release

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->
Fix bug released in 2.7

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
`clipPath` for dots has valid values and does not add attributes with
NaN.

* no more console errors
* add unit test to confirm this for line

## Screenshots (if appropriate):
<img width="505" alt="image"
src="https://github.com/recharts/recharts/assets/25180830/b89acae0-db57-41d4-ab92-41fdc4b2a616">


## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [Y] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [Y] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [Y] I have added tests to cover my changes.
- [Y] All new and existing tests passed.

Co-authored-by: Coltin Kifer <ckifer@amazon.com>
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

Successfully merging this pull request may close these issues.

None yet

3 participants