20 - Add a Tooltip to a D3 Element - Data Visualization with D3 - freeCodeCamp Tutorial

Published: 07 June 2020
on channel: Ganesh H
2,995
17

We're gonna add some tool-tips to our SVG Elements. These display some descriptive text when hovering over elements, as well as helping screen readers. We can create an SVG title tag below an element to give it a tool-tip text.

Link to challenge : https://www.freecodecamp.org/learn/da...
Concepts:
Title
The SVG title element provides a human readable name for the SVG content, or a component within it. The SVG 1.1 specification specifically mentions the importance of providing a title for the svg element. The content of the title element isn’t rendered visually by default (although it can be styled to do so).
https://www.sitepoint.com/tips-access....

selection.text([value])
If a value is specified, sets the text content to the specified value on all selected elements, replacing any existing child elements. If the value is a constant, then all elements are given the same text content; otherwise, if the value is a function, it is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The function’s return value is then used to set each element’s text content. A null value will clear the content.
If a value is not specified, returns the text content for the first (non-null) element in the selection. This is generally useful only if you know the selection contains exactly one element.
https://github.com/d3/d3-selection/bl...
————————————————————————————————————
D3.js (also known as D3, short for Data-Driven Documents) is a JavaScript library for producing dynamic, interactive data visualizations in web browsers. It makes use of Scalable Vector Graphics (SVG), HTML5, and Cascading Style Sheets (CSS) standards.

freeCodeCamp (also referred to as “Free Code Camp”) is a non-profit organization that consists of an interactive learning web platform, an online community forum, chat rooms, online publications and local organizations that intend to make learning web development accessible to anyone. Beginning with tutorials that introduce students to HTML, CSS and JavaScript, students progress to project assignments that they complete either alone or in pairs. Upon completion of all project tasks, students are partnered with other nonprofits to build web applications, giving the students practical development experience.

Thanks for Watching


Watch video 20 - Add a Tooltip to a D3 Element - Data Visualization with D3 - freeCodeCamp Tutorial online without registration, duration hours minute second in high quality. This video was added by user Ganesh H 07 June 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,995 once and liked it 17 people.