Seeking to implement tooltips in my charts using the d3-tip library.
After installing typings for d3-tip
in Typescript 2.0:
npm install @types/d3-tip --save
The typings appear in my package.json:
"dependencies": {
"@types/d3": "^4.7.0",
"@types/d3-tip": "^3.5.4",
}
The index.d.ts
file for d3-tip presents:
import {Primitive} from "d3";
declare module "d3" {
type TooltipDirection = ("n" | "s" | "e" | "w" | "nw" | "ne" | "sw" | "se");
interface Tooltip {
hide(): Tooltip;
show(): Tooltip;
destroy(): Tooltip;
....
}
export function tip(): Tooltip;
}
Question arises on how to correctly utilize/import this in my code. Experimented with the following:
import * as tip from 'd3-tip'; OR
import * from 'd3-tip'; OR
import { tip } from 'd3-tip';
Unfortunately, none of them proved effective, and d3.tip()
fails to provide intellisense.
Seeking guidance on making this implementation work. Appreciate any insights.