src/overview/tooltip/tooltip.ts   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 26
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 22
mnd 0
bc 0
fnc 3
dl 0
loc 26
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A tooltip.ts ➔ hideTooltip 0 3 1
A tooltip.ts ➔ createTooltip 0 13 1
A tooltip.ts ➔ showTooltip 0 3 1
1
import { NodeSelection } from '../../components/types';
2
import { Colors } from '../../utils/AppConsts';
3
import { selectTooltip } from '../../utils/helpers/Selectors';
4
5
export function createTooltip(svgContainer: NodeSelection<SVGGElement>) {
6
    const tooltipElement = svgContainer
7
        .append('g')
8
        .attr('id', 'tooltip')
9
        .attr('data-test-id', 'tooltip')
10
        .style('opacity', 0);
11
    tooltipElement
12
        .append('rect')
13
        .attr('fill', Colors.BLACK)
14
        .attr('rx', 5)
15
        .attr('ry', 5);
16
    tooltipElement.append('text').attr('fill', Colors.WHITE);
17
}
18
19
export function showTooltip() {
20
    selectTooltip().attr('visibility', 'visible');
21
}
22
23
export function hideTooltip() {
24
    selectTooltip().attr('visibility', 'hidden');
25
}
26