question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tooltip title with custom font not rendering properly at first

See original GitHub issue

I have a line chart and I want to set a custom font to it (of every part of the chart, from ticks to tooltip).

But I’m having issues with the tooltip title: the first time I hover a point in the chart, the tooltip title is showing the default font, and then in all the other attempts shows the correct one. Same thing happens every time I refresh my page: first attempt renders the title with the default font.

First time I hover a point after page refresh: screen shot 2017-07-11 at 12 18 36

All other hover attempts: screen shot 2017-07-11 at 12 19 35

However, notice the ticks and tooltip content already show the proper font the first time, the issue is happening only with the tooltip title!

This is how I’m setting the font, in the options object of the line chart:

const lineChartOptions = {
  responsive: true,
  defaultFontFamily: Chart.defaults.global.defaultFontFamily = 'fabriga',
  ...
}

I also tried setting specifically the tooltip title font, before defining my chart component:

import { defaults } from 'react-chartjs-2'
defaults.global.tooltips.titleFontFamily = 'fabriga'

And also tried to set it in the options object that gets passed to the chart:

const lineChartOptions = {
  ...
  tooltips: { titleFontFamily: 'fabriga' }
  ...
}

But the behavior is the same. Anyone know the reason of this? What am I doing wrong?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
shaunlandau1973commented, Sep 5, 2017

I too noticed strange font flicker artifacts but only while dev tools are open and causing cached fonts to be reloaded. With dev tools closed robbieyng’s strategy does the trick.

0reactions
Pringelscommented, Dec 11, 2019

Closing for now. Please supply a sandbox or code example with the latest versions of both libraries. If the problem persists, feel free to open a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tooltip title with custom font not rendering properly at first · Issue ...
I have a line chart and I want to set a custom font to it (of every part of the chart, from ticks...
Read more >
ChartJS custom tooltip doesn't render background on labels ...
Using ChartJS, I want to be able to change the title on a tooltip depending on the data (mainly as I want the...
Read more >
Tooltips · Bootstrap v5.0
Documentation and examples for adding custom Bootstrap tooltips with CSS and JavaScript using CSS3 for animations and data-bs-attributes for local title ...
Read more >
Tooltips | Charts - Google Developers
In this documentation, you'll learn how to create and customize tooltips in Google Charts. Specifying the tooltip type. Google Charts automatically creates ...
Read more >
Use Custom Fonts - Tableau Help
To ensure that Tableau Server can render the font correctly, ... download a workbook from Tableau Server, custom fonts are not downloaded with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found