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

feat(ebay-donut-chart): implement donut chart with highcharts #2140

Draft
wants to merge 24 commits into
base: 13.5.0
Choose a base branch
from

Conversation

mikehobi
Copy link

Description

Context

References

Screenshots

Copy link

changeset-bot bot commented Mar 19, 2024

🦋 Changeset detected

Latest commit: 2730e68

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

This PR includes changesets to release 1 package
Name Type
@ebay/ebayui-core 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

@agliga agliga changed the base branch from master to 13.4.0 March 22, 2024 16:27
Copy link
Contributor

@agliga agliga left a comment

Choose a reason for hiding this comment

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

Quick first look
Looks good. Lets try to get high charts uploaded to the CDN. Maybe we can setup some time to get that done.

Comment on lines 82 to 89
.tooltip-pointer {
position: absolute;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid var(--color-black);
}
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, why is this overriding the tooltip values?

Copy link
Author

Choose a reason for hiding this comment

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

Ah, this is leftover from when I was overriding highcharts default styling (which has no pointer)

Comment on lines 3 to 19
<span class="donut-tooltip tooltip tooltip--expanded">
<div class="tooltip__overlay">
<span class="tooltip__pointer tooltip__pointer--bottom"/>
<div class="tooltip__mask">
<div class="tooltip__cell">
<div class="tooltip__content">
<b>${input.name}</b>
<br>
<if(input.tooltip)>
${input.tooltip}
</if>
<else>${input.value}</else>
</div>
</div>
</div>
</div>
</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

For this, can we not just use ebay-tooltip and pass in open attribute

Copy link
Author

Choose a reason for hiding this comment

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

I tried to do this, but from my testing, setting ebay-tooltip with open as true does not display on first page render. It also appears to still be a controlled value in the demos, this could be a potential bug?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just go with taking the BEM child element which should give you all the styles you need:

<div class="tooltip__overlay">
        <span class="tooltip__pointer tooltip__pointer--bottom"/>
        <div class="tooltip__mask">
            <div class="tooltip__cell">
                <div class="tooltip__content">
                    <b>${input.name}</b>
                    <br>
                    <if(input.tooltip)>
                        ${input.tooltip}
                    </if>
                    <else>${input.value}</else>
                </div>
            </div>
        </div>
    </div>

Comment on lines 44 to 52
background: repeating-linear-gradient(
30deg,
var(--color-data-viz-chart-tertiary-background),
var(--color-data-viz-chart-tertiary-background) 2px,
var(--color-data-viz-chart-tertiary-stroke) 2px,
var(--color-data-viz-chart-tertiary-stroke) 3px,
var(--color-data-viz-chart-tertiary-background) 3px,
var(--color-data-viz-chart-tertiary-background) 4px
);
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be a good candidate for a variable in skin

<div
id=component.getContainerId()
class="ebay-donut-chart__graph-container"
no-update
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is there no-update here?

Copy link
Author

Choose a reason for hiding this comment

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

I noticed the state update (for active portion hover) was causing the highcharts to re-render and destroying the chart instance.

I can work on another solution, as no-update would cause issues if there's a need for data to update dynamically

@@ -0,0 +1,72 @@
.ebay-donut-chart__legend {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to add these styles in skin?

Copy link
Author

Choose a reason for hiding this comment

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

I can move them!

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, seems like this could be in skin. Also wondering if this legend is specific to donut charts or could be generic for other types of chart? i.e. .chart-legend and .chart-legend__item instead of .donut-chart-legend and .donut-chart-legend__item?

<div class="ebay-donut-chart__legend-label">
<div class=[
"ebay-donut-chart__legend-symbol",
`ebay-donut-chart__legend-symbol--${item.symbolClass}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this always defined?
If not, we might need to add a guard like
item.symbolClass && `ebay-donut-chart__legend-symbol--${item.symbolClass}\`,

Copy link
Author

Choose a reason for hiding this comment

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

Good call

<div
class=[
"ebay-donut-chart__legend-item",
input.focusIndex !== -1 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change this logic to be
!(input.focusIndex === index) && "ebay-donut-chart__legend-item--inactive"
I assume that index is not -1. If it can be, then maybe its fine as is

Copy link
Author

Choose a reason for hiding this comment

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

Yea, using -1 is what I would consider an "old school" way of managing the null state of the focus index haha

So in this instance, none of these should have the inactive if there's no active index

I can update this logic to be a little better input.focusIndex !== null &&

src/components/ebay-donut-chart/component.ts Outdated Show resolved Hide resolved
@ianmcburnie
Copy link
Contributor

@mikehobi Is the small version accounted for (with different layout)? I don't see it when running storybook.

Screenshot 2024-04-03 at 12 34 28 PM

}
}

<div class="ebay-donut-chart__legend">
Copy link
Contributor

Choose a reason for hiding this comment

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

We should maybe leverage an HTML description list here?

Copy link
Author

Choose a reason for hiding this comment

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

I did update this to use ul/li

It gets a little bit tricky using dl dt dd when styling, I could be wrong, but I'm not sure it allows for other elements to be nested within dl

@mikehobi
Copy link
Author

mikehobi commented Apr 3, 2024

@mikehobi Is the small version accounted for (with different layout)? I don't see it when running storybook.

Screenshot 2024-04-03 at 12 34 28 PM

@ianmcburnie I first assumed these were two "layout" types, but confirmed with Randy that these are breakpoint sizes, so narrowing the screen should show the small layout

@agliga agliga force-pushed the 13.4.0 branch 4 times, most recently from 609bc89 to 40f354c Compare April 5, 2024 16:26
@agliga agliga force-pushed the 13.4.0 branch 11 times, most recently from f9c329f to 275bdac Compare April 23, 2024 15:17
Base automatically changed from 13.4.0 to master April 29, 2024 17:48
@mikehobi mikehobi changed the base branch from master to 13.5.0 May 17, 2024 18:01
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

4 participants