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

fix: fix name rendering in ChartSingleTooltip component #664

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

decito
Copy link

@decito decito commented Jul 17, 2024

πŸ”— Linked issue

#663

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

I managed to fix the bug described in #663 by changing the expected to Object.values(data)[0]. I don't have enough knowledge to understand whether this would be the best course of action, nor have I checked whether the ChartSingleTooltip component is being used by another and whether this change breaks the behavior in other imports. Nonetheless, I'll submit the PR.

πŸ“Έ Screenshots (if appropriate)

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@decito
Copy link
Author

decito commented Jul 17, 2024

Few Updates:

  • Apply the same fix in the "New York" component.
  • Checked the usage of the component in question, and it doesn't appear to be used anywhere else.
  • Also noticed the presence of the styles files and updated those as well.

@decito
Copy link
Author

decito commented Jul 18, 2024

I just noticed that this solution in unoptimal because, in the fix proposed, the name to render would always need to be the first property in the object passed in the data prop. I'll keep looking for a better way to always display the value passed in the index prop

@@ -43,7 +43,7 @@ function template(d: any, i: number, elements: (HTMLElement | SVGElement)[]) {
}
else {
const style = getComputedStyle(elements[i])
const omittedData = [{ name: data.name, value: props.valueFormatter(data[props.index]), color: style.fill }]
const omittedData = [{ name: Object.values(data)[0], value: props.valueFormatter(data[props.index]), color: style.fill }]
Copy link
Member

@zernonia zernonia Jul 22, 2024

Choose a reason for hiding this comment

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

The items props is expecting type BulletLegendItemInterface[], which has name as the primary identifier.
I can't load your codesandbox and not sure what issue you are running into.

interface BulletLegendItemInterface {
    name: string | number;
    color?: string;
    className?: string;
    shape?: BulletShape;
    inactive?: boolean;
    hidden?: boolean;
    pointer?: boolean;
}

Cant load this

https://codesandbox.io/p/devbox/shadcn-vue-donutchartdemo-forked-8z4mt4

Copy link
Author

Choose a reason for hiding this comment

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

Hi, I've granted permission to the codesandbox project :)

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.

3 participants