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

BUG: Custom tooltip not rendering background #5980

Closed
musmuris opened this issue Jan 12, 2019 · 6 comments
Closed

BUG: Custom tooltip not rendering background #5980

musmuris opened this issue Jan 12, 2019 · 6 comments

Comments

@musmuris
Copy link

musmuris commented Jan 12, 2019

When implementing a custom tootltip, the background is only under the title and not the title and the body.

Example at https://codepen.io/anon/pen/zyMRdG

image

Expected that the background should be covering the whole tootip

The options section is as follows:

options: {
  tooltips: {  		
    custom : t => {
      if(t.labelTextColors) {
        t.titleFontColor = t.labelTextColors[0];         
      }    		      
      t.title = ['Hello'];
      t.body  = [{ lines: ['foo']}];
    }
  }
}

My reason for a custom one is to override the title color depending on underlying data. A workaround is just to set the color like above but then implement the title and label callbacks, but it should be possible to just update the custom tooltip model in one go I thought?

@etimberg
Copy link
Member

@musmuris unfortunately the custom tooltip option is meant for rendering the tooltip as HTML instead of on the canvas. I realize the name is confusing but we're stuck with it until v3.0.

We've been working on a number of PRs recently for "scriptable" options that support a function (see #5973, #5976, etc). I think we could support those here so ultimately what would happen is that you would set titleFontColor to a function that returns based on what's selected.

CC @simonbrunel @nagix @kurkle thoughts?

@etimberg
Copy link
Member

@kurkle @benmccann thoughts on this?

My thoughts are:

  • Update tootip fonts to be scriptable (title & footer get all items, body gets context per item in tooltip) which eliminates the need for using custom tooltips in this use case
  • Consider renaming custom to something else (or drop entirely in favour of an HTML tooltip plugin) Advantage of the plugin method is ease of integration with other frameworks like react.

@LeeLenaleee
Copy link
Collaborator

Dont know how much work it is to make it into a plugin, but I think that renaming it to html or external from custom might be a good idea to make it more clear its not customization for the default tooltip.

@etimberg
Copy link
Member

@kurkle thoughts on the above rename?

@kurkle
Copy link
Member

kurkle commented Feb 24, 2021

Sounds good!

@etimberg
Copy link
Member

Closing since custom was renamed to external and released in 3.0.0-beta.12

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

4 participants