tremor icon indicating copy to clipboard operation
tremor copied to clipboard

[Feature]: Donut Chart Active Value Prop Feature Request

Open kronos1345 opened this issue 1 year ago • 10 comments

What problem does this feature solve?

Use Case and Context: This feature would enable automatic activation of the corresponding data point in the DonutChart component when an item is clicked in the Legend component. Currently, clicking on an item in the Legend does not influence the DonutChart, which negatively impacts user experience.

Importance and Rationale: The feature will enhance user interaction between data visualizations, making it easier for users to understand relationships within the data sets.

What does the proposed API look like?

<DonutChart
  data={...}
  category="..."
  index="..."
  // Other props
  activeValue={this.state.activeValue} // Newly proposed prop
/>

This new activeValue prop would inform the DonutChart component about which data point should be active. Thus, when an item is clicked in the Legend component, updating this value will activate the corresponding data point in the DonutChart.

The working version of the activeValue prop should be as follows. image

kronos1345 avatar Dec 20 '23 16:12 kronos1345

Just to be sure I understand it. a new legend component with the something like elements as text and when the user clicks on one of them the active prop on the DonutChart would change to what the users clicked? similar to what is on AreaChart right?

abdelkd avatar Dec 20 '23 20:12 abdelkd

Hi @abdelkd , thank you for reply.

Yes. Similar to AreaChart. But this shouldn't only happen through LegendSlider. All it takes is an extra prop. In this way, it can be triggered via whatever input it wants to be triggered.

kronos1345 avatar Dec 20 '23 20:12 kronos1345

yeah exactly. what I'm thinking about is new two props. showLegend and activeValue or activeSector so the user would be able to choose between showing legend or not and ability to trigger active value manually.

abdelkd avatar Dec 20 '23 21:12 abdelkd

@severinlandolt can I try working on this?

abdelkd avatar Dec 20 '23 21:12 abdelkd

Hey there! Thanks for the discussion. The donut chart has deliberately no Legend. Your proposal to add activeSector prop thus makes sense. I will discuss this with the team and assign @abdelkd if we want to make this addition.

severinlandolt avatar Dec 22 '23 12:12 severinlandolt

Thank you @severinlandolt . We are waiting..

kronos1345 avatar Dec 27 '23 08:12 kronos1345

Would absolutely love to have this feature.

saman-des avatar Jan 14 '24 18:01 saman-des

Would love this feature. I plan on putting the activeSector prop into a search parameter so that the selected section is active on page load. This would help tremendously.

khanhtruong0808 avatar Feb 22 '24 16:02 khanhtruong0808

Since I've lost all my pc data, I did it again but with some changes. The legend is hidden by default unless you provide activeSector as a string or null. In case of null the legend will be shown but with no default value selected.

Would love this feature. I plan on putting the activeSector prop into a search parameter so that the selected section is active on page load. This would help tremendously.

I like your idea, I will be making the PR once @severinlandolt say his opinion about it

abdelkd avatar Feb 22 '24 21:02 abdelkd

@abdelkd Hi, happy to review, but cannot promise that it will get merged :)

severinlandolt avatar Feb 22 '24 23:02 severinlandolt