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

Tooltip callback labelColor not being applied #7227

Closed
alexeigs opened this issue Mar 28, 2020 · 5 comments
Closed

Tooltip callback labelColor not being applied #7227

alexeigs opened this issue Mar 28, 2020 · 5 comments

Comments

@alexeigs
Copy link

alexeigs commented Mar 28, 2020

Using chart.js 2.9.3 through vue-chartjs 3.5.0.

chart options:

{ ...
tooltips: {
       callbacks: {
          label: (item, data) => 'someLabel',
          labelTextColor: (item, chart) => 'green',
          labelColor: (item, chart) => {
            console.log('I am called successfully')
            return {
              borderColor: 'yellow',
              backgroundColor: 'red'
          }
       }
    }
}

label and labelTextColor work as expected, labelColor get's called but no background or border gets applied.

@etimberg
Copy link
Member

@alexeigs all of the tooltip callbacks are nested one level deeper.

tooltips: {
  callbacks: {
    labelColor: ...
  },
}

@alexeigs
Copy link
Author

@etimberg Sorry, that was a mistake in copying code. In the actual example it is of course nested one lever deeper. I edited the initial post.

@alexeigs
Copy link
Author

It actually gets applied, just not to the background of the tooltip but only the small colored box. Is there a way to apply it to the full tooltip background?

@etimberg
Copy link
Member

@alexeigs you can use the background color option, but it's not possible to supply a function for it.

@etimberg
Copy link
Member

etimberg commented Oct 2, 2020

Closing since the immediate issue was resolved and #7201 takes care of the background option being scriptable

@etimberg etimberg closed this as completed Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants