-
Notifications
You must be signed in to change notification settings - Fork 298
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
base: dev
Are you sure you want to change the base?
Conversation
Few Updates:
|
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 |
@@ -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 }] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 :)
π Linked issue
#663
β Type of 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