-
Notifications
You must be signed in to change notification settings - Fork 4
Components
Luke Michals edited this page Apr 6, 2018
·
14 revisions
- Tooltip
- Import module in html template
<script src="{{site.baseurl}}/assets/js/shared/moduleName.js"></script>
- Invoke the module methods when needed (see API Reference for examples)
# tooltipModule.draw(tooltipId, title, information, disclaimers) <>
<div id="tooltip" class="tooltip-module"></div>
function handleMouseOver(d) {
const formatNumber = d3.format(",d");
tooltipModule.draw("#tooltip", d.name, {
Employees: formatNumber(dataByState[d.abbreviation])
}, "Click to view agency information");
d3.select(this).style("fill", "#D334BA");
}
# tooltipModule.remove(tooltipId) <>
<div id="tooltip" class="tooltip-module"></div>
function handleMouseOut() {
tooltipModule.remove("#tooltip");
d3.select(this).style("fill", d => color(dataByState[d.abbreviation]));
}
# tooltipModule.move(tooltipId) <>
<div id="tooltip" class="tooltip-module"></div>
function handleMouseMove() {
tooltipModule.move("#tooltip");
}
#bestteamevar