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

Allow passing CustomIcon to Symbol in VictoryLegend and VictoryScatter #2900

Conversation

acharyakavita
Copy link
Contributor

@acharyakavita acharyakavita commented Sep 16, 2024

Description

Fixes # (issue): #2892
This is a new feature to add custom icons into symbol of VictoryScatter and VictoryLegend.

Type of Change

  • 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 not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Checklist: (Feel free to delete this section upon completion)

  • I have included a changeset if this change will require a version change to one of the packages.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have run all builds, tests, and linting and all checks pass
  • I have added tests that prove my fix is effective or that my feature works
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@acharyakavita acharyakavita linked an issue Sep 16, 2024 that may be closed by this pull request
2 tasks
Copy link

vercel bot commented Sep 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
victory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 17, 2024 3:12pm

Copy link

changeset-bot bot commented Sep 16, 2024

🦋 Changeset detected

Latest commit: 868b44c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 32 packages
Name Type
victory-core Minor
victory-scatter Minor
victory-area Minor
victory-axis Minor
victory-bar Minor
victory-box-plot Minor
victory-brush-container Minor
victory-brush-line Minor
victory-candlestick Minor
victory-canvas Minor
victory-chart Minor
victory-create-container Minor
victory-cursor-container Minor
victory-errorbar Minor
victory-group Minor
victory-histogram Minor
victory-legend Minor
victory-line Minor
victory-pie Minor
victory-polar-axis Minor
victory-selection-container Minor
victory-shared-events Minor
victory-stack Minor
victory-tooltip Minor
victory-voronoi-container Minor
victory-voronoi Minor
victory-zoom-container Minor
victory Minor
rn-demo Patch
victory-native Minor
victory-vendor Minor
victory-docs Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@acharyakavita acharyakavita changed the title Allow CustomIcon to VictoryLegend and VictoryScatter Allow CustomIcon to Symbol in VictoryLegend and VictoryScatter Sep 17, 2024
@acharyakavita acharyakavita changed the title Allow CustomIcon to Symbol in VictoryLegend and VictoryScatter Allow passing CustomIcon to Symbol in VictoryLegend and VictoryScatter Sep 17, 2024
@@ -530,16 +531,52 @@ _default (provided by default theme):_ See [grayscale theme][] for more detail

`type: function || options`

The `symbol` prop determines which symbol should be drawn to represent data points. Options are: "circle", "cross", "diamond", "plus", "minus", "square", "star", "triangleDown", "triangleUp". When this prop is given as a function, it will be evaluated for each point with the props corresponding to that point. If no `symbol` prop is specified, a circle will be rendered. `symbol` may also be set directly on each data object.
The `symbol` prop determines which symbol should be drawn to represent data points. Options are: "circle", "cross", "diamond", "plus", "minus", "square", "star", "triangleDown", "triangleUp".It also supports "custom React icons". When this prop is given as a function, it will be evaluated for each point with the props corresponding to that point. If no `symbol` prop is specified, a circle will be rendered. `symbol` may also be set directly on each data object.
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor fix for spacing and slight reword

Suggested change
The `symbol` prop determines which symbol should be drawn to represent data points. Options are: "circle", "cross", "diamond", "plus", "minus", "square", "star", "triangleDown", "triangleUp".It also supports "custom React icons". When this prop is given as a function, it will be evaluated for each point with the props corresponding to that point. If no `symbol` prop is specified, a circle will be rendered. `symbol` may also be set directly on each data object.
The `symbol` prop determines which symbol should be drawn to represent data points. Options are: "circle", "cross", "diamond", "plus", "minus", "square", "star", "triangleDown", "triangleUp". It also supports SVG icons from a custom component or an SVG based icon library like [react-icons](https://react-icons.github.io/react-icons/). When this prop is given as a function, it will be evaluated for each point with the props corresponding to that point. If no `symbol` prop is specified, a circle will be rendered. `symbol` may also be set directly on each data object.

@@ -112,10 +113,51 @@ containerComponent={<VictoryContainer responsive={false}/>}

`type: array[{ name, symbol, labels }]`

Specify data via the `data` prop. `VictoryLegend` expects data as an array of objects with `name` (required), `symbol`, and `labels` properties. The `data` prop must be given as an array. The symbol rendered may be changed by altering the `type` property of the `symbol` object. Valid types include: circle", "diamond", "plus", "minus", "square", "star", "triangleDown", and "triangleUp"
Specify data via the `data` prop. `VictoryLegend` expects data as an array of objects with `name` (required), `symbol`, and `labels` properties. The `data` prop must be given as an array. The symbol rendered may be changed by altering the `type` property of the `symbol` object. Valid types include: circle", "diamond", "plus", "minus", "square", "star", "triangleDown", and "triangleUp". It also supports custom icons.
Copy link
Contributor

Choose a reason for hiding this comment

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

Adds a bit more description

Suggested change
Specify data via the `data` prop. `VictoryLegend` expects data as an array of objects with `name` (required), `symbol`, and `labels` properties. The `data` prop must be given as an array. The symbol rendered may be changed by altering the `type` property of the `symbol` object. Valid types include: circle", "diamond", "plus", "minus", "square", "star", "triangleDown", and "triangleUp". It also supports custom icons.
Specify data via the `data` prop. `VictoryLegend` expects data as an array of objects with `name` (required), `symbol`, and `labels` properties. The `data` prop must be given as an array. The symbol rendered may be changed by altering the `type` property of the `symbol` object. Valid types include: circle", "diamond", "plus", "minus", "square", "star", "triangleDown", and "triangleUp". It also supports SVG icons from a custom component or an SVG based icon library like [react-icons](https://react-icons.github.io/react-icons/)

@acharyakavita
Copy link
Contributor Author

acharyakavita commented Sep 26, 2024

It was decided that we will make use of existing dataComponent to pass custom icons. Adding this feature further complicated the code. Also it will be double the effort to maintain two features which help to achieve the same results. Documentation will be updated to help users use dataComponent effectively to pass custom Icons in another PR

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.

VictoryLegend items should support an Element to allow for custom icons.
2 participants