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

Dynamically changing tooltipBgColor #1279

Closed
davide-capozzi opened this issue Mar 6, 2023 · 9 comments
Closed

Dynamically changing tooltipBgColor #1279

davide-capozzi opened this issue Mar 6, 2023 · 9 comments
Labels
enhancement New feature or request Fundamental good first issue Good for newcomers

Comments

@davide-capozzi
Copy link

davide-capozzi commented Mar 6, 2023

Don't make a duplicate issue.
I didn't find anything like this, sorry if i missed something

Is your feature request relasted to a problem? Please describe.
I would like to be able to dynamically change the tooltipBgColor, in the same way getTooltipItems allows to change the text of a tooltip

Describe the solution you'd like
Ideally this change would be included in the tooltipItem so that also the popup can be configured in the same place, the expected behaviour at the end is the ability to show tooltips of different colors based on the y value of the line, (i.e: i would like to have tooltips for points below 0 to have a black background and tooltips above 0 to have a white background)

Describe alternatives you've considered
i have considered just changing the color of the text, but changing the color of the background is really what i would like to achieve

Additional context
This is the tooltip i'm talking about, i hope it's clear enought even if i don't provide example with both colors
Screenshot 2023-03-06 at 14 36 12

If there is already a way to do this could you show me an example?

@imaNNeo imaNNeo added enhancement New feature or request good first issue Good for newcomers Fundamental labels Mar 6, 2023
@imaNNeo
Copy link
Owner

imaNNeo commented Mar 6, 2023

So we need to implement a callback to receive a color based on the provided data to paint the background.
We should do this for all of line, bar and scatter charts to keep the consistency.

@david-legend
Copy link

I am currently in such a dilemma. For every tooltip provided for a barChart rod, I want each rod to be able to have a different tooltip background color.
Thanks a lot for the amazing work!!

@apekshamehta
Copy link

Hi, I have been working as an iOS application developer for about 4.5 years, and I am currently learning Flutter. I would like to contribute to your open-source project, starting with the change mentioned above. I am in the process of setting up the code base.

@imaNNeo
Copy link
Owner

imaNNeo commented Apr 30, 2023

@apekshamehta Correct choice :))
I was an Android developer for about 7 years, now I completely switched to Flutter and to be honest, it's beautiful.
btw, welcome to the Flutter world

You can start working on this issue, read the code, you can find some samples that we have a callback to get the color from the user.

Don't forget to read the contributing guideline

@apekshamehta
Copy link

@imaNNeo
Thank you for your response, and I apologize for the delayed reply. I was on vacation.

I wanted to provide an update regarding the changes I made. The implementation can be reviewed in my branch named "feature/dynamic-tooltip-bgcolor." Additionally, I have provided comprehensive details regarding the changes in my pull request. I kindly request your valuable feedback on the modifications I have made.

@imaNNeo
Copy link
Owner

imaNNeo commented Jun 7, 2023

t. I kindly request your valuable feedback on the modifications I have made.

Good to have your PR ready, I've written some comments. check them out

@sivaperumal202009
Copy link

This feature looks good. @imaNNeo can we expect this anytime soon?

@iamiota
Copy link

iamiota commented Aug 15, 2023

There are 2 lines with different colors on a chart, and they have tooltips with their respective tooltipBgColor.
This makes sense.

@imaNNeo
Copy link
Owner

imaNNeo commented Mar 28, 2024

Added getTooltipColor getter in 0.67.0
Don't forget to read the migration guide carefully

@imaNNeo imaNNeo closed this as completed Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Fundamental good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

6 participants