Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn Chart.js

You're reading from   Learn Chart.js Create interactive visualizations for the Web with Chart.js 2

Arrow left icon
Product type Paperback
Published in Feb 2019
Publisher
ISBN-13 9781789342482
Length 284 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Helder da Rocha Helder da Rocha
Author Profile Icon Helder da Rocha
Helder da Rocha
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Introduction 2. Technology Fundamentals FREE CHAPTER 3. Chart.js - Quick Start 4. Creating Charts 5. Scales and Grid Configuration 6. Configuring Styles and Interactivity 7. Advanced Chart.js 8. Other Books You May Enjoy

Tooltip configuration


Tooltips are the main feature used by Chart.js to reveal quantitative details about data. While some context comes from the grid, the only way to natively display data right next to the data point is using a tooltip. Of course, you can label the value points as we saw in the previous chapter, but that requires extensions or plugins, and may clutter your chart if used in excess. Chart.js visualizations rely on interactivity to show details. In this section, we will learn how to configure the way these details are displayed.

Tooltips can be configured for each chart using the tooltips key in the options object. They can also be configured for all charts using Chart.defaults.global.tooltips. The properties of these objects that you can configure are listed in the following table:

Object

Value

Description

titleSpacing

Number

Space before and after each title line. Default is 2.

bodySpacing

Number

Space before and after each tooltip item. Default is 2.

footerSpacing

Number

Space before...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime