Skip to content

Conversation

@slizhevskyv-semrush
Copy link
Contributor

Changelog

@semcore/d3-chart

Added

  • showPercentValueInTooltip prop for Area/Bar/Cigarette/Histogram/Line charts.

Fixed

  • Fixed types by removing unsupported showTotalInTooltip prop from certain chart components.

Motivation and Context

How has this been tested?

Screenshots (if appropriate):

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 not work as expected).
  • Nice improve.

Checklist:

  • I have updated the documentation accordingly.
  • I have added new tests on added of fixed functionality.

…r/Cigarette/Histogram/Line charts + updated types
@slizhevskyv-semrush
Copy link
Contributor Author

@ilyabrower I've updated chart component's types which doesn't have any logic related to showTotalInTooltip. Let me know if it's still needed. Thanks!

slizhevskyv-semrush and others added 2 commits January 28, 2026 14:01
Co-authored-by: ilyabrower <ilia.brauer@semrush.com>
Signed-off-by: slizhevskyv-semrush <uladzislau.slizheuski@semrush.com>
Co-authored-by: ilyabrower <ilia.brauer@semrush.com>
Signed-off-by: slizhevskyv-semrush <uladzislau.slizheuski@semrush.com>
ilyabrower
ilyabrower previously approved these changes Jan 29, 2026
@Valeria-Zimnitskaya
Copy link
Contributor

Valeria-Zimnitskaya commented Feb 3, 2026

@sheila-semrush Could you please review the visual of tooltip with percent. You can check them on the website (we've added new props here http://localhost:5173/intergalactic/data-display/stacked-area-chart/stacked-area-chart)
Screenshot 2026-02-03 at 13 52 19

Also, should we add this props for the Cigarrete example, what do you think?
http://localhost:5173/intergalactic/data-display/cigarette-chart/cigarette-chart-code
Screenshot 2026-02-03 at 13 54 39

Copy link
Contributor

@sheila-semrush sheila-semrush left a comment

Choose a reason for hiding this comment

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

@slizhevskyv-semrush I added a playground for Cigarette chart, can you review it?

@sheila-semrush
Copy link
Contributor

@Valeria-Zimnitskaya I added showPercentValueInTooltip to both charts in the "Tooltip" example (renamed from "Tooltip type") http://localhost:5173/intergalactic/data-display/cigarette-chart/cigarette-chart-code#tooltip

function getJSX(props: CigaretteChartJSXProps) {
const { ...legendProps } = props.legendProps ?? {};
return (
<Chart.Cigarette
Copy link
Contributor

@sheila-semrush sheila-semrush Feb 3, 2026

Choose a reason for hiding this comment

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

@slizhevskyv-semrush I have a concern about the display name, isn't "Cigarette.Bar" invalid here?
image

plotHeight={props.cigaretteProps.layout === 'horizontal' ? 28 : 200}
aria-label='Cigarette chart'
tooltipViewType={props.cigaretteProps.tooltipViewType}
invertAxis={props.cigaretteProps.layout !== 'vertical'}
Copy link
Contributor

@sheila-semrush sheila-semrush Feb 3, 2026

Choose a reason for hiding this comment

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

@slizhevskyv-semrush there's also an issue with invertAxis={false}, I guess we hide it, but in this case the default value is true and we should show it explicitly when it's false

Also would be nice if undefined hid properties, now it's printed in the snippet as is. In this case I'm expecting:

  • layout="horizontal" => invertAxis={undefined} (hidden from snipped, default value),
  • layout="vertical" => invertAxis={false} (printed in snippet)

In general, I wouldn't hide false, but instead would hide undefined.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants