@tradingaction/tooltip 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/IndicatorDisplayTooltip.js +9 -2
- package/lib/IndicatorDisplayTooltip.js.map +1 -1
- package/package.json +4 -5
- package/src/BollingerBandTooltip.tsx +0 -99
- package/src/GroupTooltip.tsx +0 -152
- package/src/HoverTooltip.tsx +0 -270
- package/src/IndicatorDisplayTooltip.tsx +0 -460
- package/src/MACDTooltip.tsx +0 -116
- package/src/MovingAverageTooltip.tsx +0 -167
- package/src/OHLCTooltip.tsx +0 -150
- package/src/RSITooltip.tsx +0 -80
- package/src/SingleTooltip.tsx +0 -122
- package/src/SingleValueTooltip.tsx +0 -131
- package/src/StochasticTooltip.tsx +0 -97
- package/src/ToolTipTSpanLabel.tsx +0 -14
- package/src/ToolTipText.tsx +0 -15
- package/src/index.ts +0 -13
|
@@ -137,8 +137,14 @@ class SingleIndicatorDisplay extends React.Component {
|
|
|
137
137
|
// Position after calculated content width with spacing
|
|
138
138
|
iconX = 20 + displayNameWidth + horizontalContentWidth + 10 + idx * 16;
|
|
139
139
|
}
|
|
140
|
+
else if (multiValues && multiValues.length === 0 && !value) {
|
|
141
|
+
// Single label only (no value/multiValues) - position close to label
|
|
142
|
+
const fontSize = effectiveFontSize || 12;
|
|
143
|
+
const charWidth = fontSize * 0.55;
|
|
144
|
+
iconX = 10 + displayName.length * charWidth + 10 + idx * 16;
|
|
145
|
+
}
|
|
140
146
|
else {
|
|
141
|
-
// Position for vertical or single value
|
|
147
|
+
// Position for vertical or single value with data
|
|
142
148
|
iconX = 210 + idx * 16;
|
|
143
149
|
}
|
|
144
150
|
return (React.createElement("g", { key: icon.id, onClick: (e) => this.handleIconClick(e, icon) },
|
|
@@ -182,7 +188,8 @@ export class IndicatorDisplayTooltip extends React.Component {
|
|
|
182
188
|
})));
|
|
183
189
|
}
|
|
184
190
|
const tooltipLabel = each.displayName || `${each.type} (${each.windowSize || "n/a"})`;
|
|
185
|
-
|
|
191
|
+
// Only show value if yAccessor exists, otherwise pass empty string
|
|
192
|
+
const yDisplayValue = yValue !== undefined ? displayFormat(yValue) : "";
|
|
186
193
|
return (React.createElement(SingleIndicatorDisplay, { key: idx, origin: [idx * 40, idx * 40], color: each.stroke, displayName: tooltipLabel, value: yDisplayValue, multiValues: multiValues, options: each, forChart: chartId, onClick: onClick, onIconClick: onIconClick, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, textFill: textFill, labelFill: labelFill }));
|
|
187
194
|
})));
|
|
188
195
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndicatorDisplayTooltip.js","sourceRoot":"","sources":["../src/IndicatorDisplayTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAa,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AA4D5C,MAAM,sBAAuB,SAAQ,KAAK,CAAC,SAAmE;IAG1G,YAAY,KAAkC;QAC1C,KAAK,CAAC,KAAK,CAAC,CAAC;QAHT,SAAI,GAAG,KAAK,CAAC,SAAS,EAAe,CAAC;QAStC,qBAAgB,GAAG,GAAG,EAAE;YAC5B,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC;QAEM,qBAAgB,GAAG,GAAG,EAAE;YAC5B,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QACxC,CAAC,CAAC;QAEM,oBAAe,GAAG,CAAC,CAAgD,EAAE,IAA0B,EAAE,EAAE;YACvG,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,IAAI,IAAI,CAA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C,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAExE,OAAO,CACH,oBAAC,sBAAsB,IACnB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,CAAC,EAC5B,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,WAAW,EAAE,YAAY,EACzB,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,GACtB,CACL,CAAC;YACN,CAAC,CAAC,CACF,CACP,CAAC;QACN,CAAC,CAAC;IACN,CAAC;IAjFU,MAAM;QACT,OAAO,oBAAC,qBAAqB,IAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,GAAI,CAAC;IAClG,CAAC;;AAXa,oCAAY,GAAG;IACzB,SAAS,EAAE,iFAAiF;IAC5F,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC;IAC5B,WAAW,EAAE,KAAK;IAClB,gBAAgB,EAAE,CAAC,CAAM,EAAE,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW;IAC3D,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;IACf,KAAK,EAAE,EAAE;CACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradingaction/tooltip",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "Tooltips for react-financial-charts",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
10
10
|
"files": [
|
|
11
|
-
"lib"
|
|
12
|
-
"src"
|
|
11
|
+
"lib"
|
|
13
12
|
],
|
|
14
13
|
"sideEffects": false,
|
|
15
14
|
"author": "Reactive Markets",
|
|
@@ -38,7 +37,7 @@
|
|
|
38
37
|
"watch": "tsc -p tsconfig.json --watch --preserveWatchOutput"
|
|
39
38
|
},
|
|
40
39
|
"dependencies": {
|
|
41
|
-
"@tradingaction/core": "^2.1.
|
|
40
|
+
"@tradingaction/core": "^2.1.2",
|
|
42
41
|
"d3-array": "^2.9.1",
|
|
43
42
|
"d3-format": "^2.0.0",
|
|
44
43
|
"d3-time-format": "^3.0.0"
|
|
@@ -47,5 +46,5 @@
|
|
|
47
46
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
48
47
|
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
49
48
|
},
|
|
50
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "8b8fc8c751cebbed2ff486c0cea46e561a477054"
|
|
51
50
|
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { functor, GenericChartComponent, last } from "@tradingaction/core";
|
|
2
|
-
import { format } from "d3-format";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { ToolTipText } from "./ToolTipText";
|
|
5
|
-
import { ToolTipTSpanLabel } from "./ToolTipTSpanLabel";
|
|
6
|
-
|
|
7
|
-
export interface BollingerBandTooltipProps {
|
|
8
|
-
readonly className?: string;
|
|
9
|
-
readonly displayFormat: (value: number) => string;
|
|
10
|
-
readonly displayInit?: string;
|
|
11
|
-
readonly displayValuesFor?: (props: BollingerBandTooltipProps, moreProps: any) => any;
|
|
12
|
-
readonly fontFamily?: string;
|
|
13
|
-
readonly fontSize?: number;
|
|
14
|
-
readonly fontWeight?: number;
|
|
15
|
-
readonly labelFill?: string;
|
|
16
|
-
readonly labelFontWeight?: number;
|
|
17
|
-
readonly onClick?: (event: React.MouseEvent) => void;
|
|
18
|
-
readonly options: {
|
|
19
|
-
movingAverageType: string;
|
|
20
|
-
multiplier: number;
|
|
21
|
-
sourcePath: string;
|
|
22
|
-
windowSize: number;
|
|
23
|
-
};
|
|
24
|
-
readonly origin?: [number, number] | ((width: number, height: number) => [number, number]);
|
|
25
|
-
readonly textFill?: string;
|
|
26
|
-
readonly yAccessor?: (data: any) => { bottom: number; middle: number; top: number };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export class BollingerBandTooltip extends React.Component<BollingerBandTooltipProps> {
|
|
30
|
-
public static defaultProps = {
|
|
31
|
-
className: "react-financial-charts-tooltip react-financial-charts-bollingerband-tooltip",
|
|
32
|
-
displayFormat: format(".2f"),
|
|
33
|
-
displayValuesFor: (_: any, props: any) => props.currentItem,
|
|
34
|
-
displayInit: "n/a",
|
|
35
|
-
origin: [8, 8],
|
|
36
|
-
yAccessor: (data: any) => data.bb,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
public render() {
|
|
40
|
-
return <GenericChartComponent clip={false} svgDraw={this.renderSVG} drawOn={["mousemove"]} />;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
private readonly renderSVG = (moreProps: any) => {
|
|
44
|
-
const {
|
|
45
|
-
onClick,
|
|
46
|
-
displayFormat,
|
|
47
|
-
yAccessor = BollingerBandTooltip.defaultProps.yAccessor,
|
|
48
|
-
options,
|
|
49
|
-
origin: originProp,
|
|
50
|
-
textFill,
|
|
51
|
-
labelFill,
|
|
52
|
-
labelFontWeight,
|
|
53
|
-
className,
|
|
54
|
-
displayValuesFor = BollingerBandTooltip.defaultProps.displayValuesFor,
|
|
55
|
-
displayInit,
|
|
56
|
-
fontFamily,
|
|
57
|
-
fontSize,
|
|
58
|
-
fontWeight,
|
|
59
|
-
} = this.props;
|
|
60
|
-
|
|
61
|
-
const {
|
|
62
|
-
chartConfig: { width, height },
|
|
63
|
-
fullData,
|
|
64
|
-
} = moreProps;
|
|
65
|
-
|
|
66
|
-
const currentItem = displayValuesFor(this.props, moreProps) ?? last(fullData);
|
|
67
|
-
|
|
68
|
-
let top = displayInit;
|
|
69
|
-
let middle = displayInit;
|
|
70
|
-
let bottom = displayInit;
|
|
71
|
-
|
|
72
|
-
if (currentItem !== undefined) {
|
|
73
|
-
const item = yAccessor(currentItem);
|
|
74
|
-
if (item !== undefined) {
|
|
75
|
-
top = displayFormat(item.top);
|
|
76
|
-
middle = displayFormat(item.middle);
|
|
77
|
-
bottom = displayFormat(item.bottom);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const origin = functor(originProp);
|
|
82
|
-
const [x, y] = origin(width, height);
|
|
83
|
-
|
|
84
|
-
const { sourcePath, windowSize, multiplier, movingAverageType } = options;
|
|
85
|
-
const tooltipLabel = `BB(${sourcePath}, ${windowSize}, ${multiplier}, ${movingAverageType}): `;
|
|
86
|
-
const tooltipValue = `${top}, ${middle}, ${bottom}`;
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<g transform={`translate(${x}, ${y})`} className={className} onClick={onClick}>
|
|
90
|
-
<ToolTipText x={0} y={0} fontFamily={fontFamily} fontSize={fontSize} fontWeight={fontWeight}>
|
|
91
|
-
<ToolTipTSpanLabel fill={labelFill} fontWeight={labelFontWeight}>
|
|
92
|
-
{tooltipLabel}
|
|
93
|
-
</ToolTipTSpanLabel>
|
|
94
|
-
<tspan fill={textFill}>{tooltipValue}</tspan>
|
|
95
|
-
</ToolTipText>
|
|
96
|
-
</g>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
}
|
package/src/GroupTooltip.tsx
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { GenericChartComponent, last } from "@tradingaction/core";
|
|
2
|
-
import { format } from "d3-format";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { layouts, SingleTooltip } from "./SingleTooltip";
|
|
5
|
-
import { ToolTipText } from "./ToolTipText";
|
|
6
|
-
|
|
7
|
-
export interface GroupTooltipProps {
|
|
8
|
-
readonly className?: string;
|
|
9
|
-
readonly fontFamily?: string;
|
|
10
|
-
readonly fontSize?: number;
|
|
11
|
-
readonly fontWeight?: number;
|
|
12
|
-
readonly displayFormat: (value: number) => string;
|
|
13
|
-
readonly displayInit?: string;
|
|
14
|
-
readonly displayValuesFor: (props: GroupTooltipProps, moreProps: any) => any;
|
|
15
|
-
readonly layout: layouts;
|
|
16
|
-
readonly onClick?: (event: React.MouseEvent, details: any) => void;
|
|
17
|
-
readonly options: {
|
|
18
|
-
labelFill?: string;
|
|
19
|
-
yLabel: string;
|
|
20
|
-
yAccessor: (data: any) => number;
|
|
21
|
-
valueFill?: string;
|
|
22
|
-
withShape?: boolean;
|
|
23
|
-
}[];
|
|
24
|
-
readonly origin: [number, number];
|
|
25
|
-
readonly position?: "topRight" | "bottomLeft" | "bottomRight";
|
|
26
|
-
readonly verticalSize?: number; // "verticalSize" only be used, if layout is "vertical", "verticalRows".
|
|
27
|
-
readonly width?: number; // "width" only be used, if layout is "horizontal" or "horizontalRows".
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export class GroupTooltip extends React.Component<GroupTooltipProps> {
|
|
31
|
-
public static defaultProps = {
|
|
32
|
-
className: "react-financial-charts-tooltip react-financial-charts-group-tooltip",
|
|
33
|
-
layout: "horizontal",
|
|
34
|
-
displayFormat: format(".2f"),
|
|
35
|
-
displayInit: "",
|
|
36
|
-
displayValuesFor: (_: any, props: any) => props.currentItem,
|
|
37
|
-
origin: [0, 0],
|
|
38
|
-
width: 60,
|
|
39
|
-
verticalSize: 13,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
public render() {
|
|
43
|
-
return <GenericChartComponent clip={false} svgDraw={this.renderSVG} drawOn={["mousemove"]} />;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
private readonly getPosition = (moreProps: any) => {
|
|
47
|
-
const { position } = this.props;
|
|
48
|
-
const { height, width } = moreProps.chartConfig;
|
|
49
|
-
|
|
50
|
-
const dx = 20;
|
|
51
|
-
const dy = 40;
|
|
52
|
-
let textAnchor: "start" | "middle" | "end" | "inherit" | undefined;
|
|
53
|
-
let xyPos: (number | null)[] | null = null;
|
|
54
|
-
|
|
55
|
-
if (position !== undefined) {
|
|
56
|
-
switch (position) {
|
|
57
|
-
case "topRight":
|
|
58
|
-
xyPos = [width - dx, null];
|
|
59
|
-
textAnchor = "end";
|
|
60
|
-
break;
|
|
61
|
-
case "bottomLeft":
|
|
62
|
-
xyPos = [null, height - dy];
|
|
63
|
-
break;
|
|
64
|
-
case "bottomRight":
|
|
65
|
-
xyPos = [width - dx, height - dy];
|
|
66
|
-
textAnchor = "end";
|
|
67
|
-
break;
|
|
68
|
-
default:
|
|
69
|
-
xyPos = [null, null];
|
|
70
|
-
}
|
|
71
|
-
} else {
|
|
72
|
-
xyPos = [null, null];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return { xyPos, textAnchor };
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
private readonly renderSVG = (moreProps: any) => {
|
|
79
|
-
const { chartId, fullData } = moreProps;
|
|
80
|
-
|
|
81
|
-
const {
|
|
82
|
-
className,
|
|
83
|
-
displayInit = GroupTooltip.defaultProps.displayInit,
|
|
84
|
-
displayValuesFor,
|
|
85
|
-
onClick,
|
|
86
|
-
width = 60,
|
|
87
|
-
verticalSize = 13,
|
|
88
|
-
fontFamily,
|
|
89
|
-
fontSize,
|
|
90
|
-
fontWeight,
|
|
91
|
-
layout,
|
|
92
|
-
origin,
|
|
93
|
-
displayFormat,
|
|
94
|
-
options,
|
|
95
|
-
} = this.props;
|
|
96
|
-
|
|
97
|
-
const currentItem = displayValuesFor(this.props, moreProps) ?? last(fullData);
|
|
98
|
-
|
|
99
|
-
const { xyPos, textAnchor } = this.getPosition(moreProps);
|
|
100
|
-
|
|
101
|
-
const xPos = xyPos != null && xyPos[0] != null ? xyPos[0] : origin[0];
|
|
102
|
-
const yPos = xyPos != null && xyPos[1] != null ? xyPos[1] : origin[1];
|
|
103
|
-
|
|
104
|
-
const singleTooltip = options.map((each, idx) => {
|
|
105
|
-
const yValue = currentItem && each.yAccessor(currentItem);
|
|
106
|
-
const yDisplayValue = yValue ? displayFormat(yValue) : displayInit;
|
|
107
|
-
|
|
108
|
-
const orig: () => [number, number] = () => {
|
|
109
|
-
if (layout === "horizontal" || layout === "horizontalRows") {
|
|
110
|
-
return [width * idx, 0];
|
|
111
|
-
}
|
|
112
|
-
if (layout === "vertical") {
|
|
113
|
-
return [0, verticalSize * idx];
|
|
114
|
-
}
|
|
115
|
-
if (layout === "verticalRows") {
|
|
116
|
-
return [0, verticalSize * 2.3 * idx];
|
|
117
|
-
}
|
|
118
|
-
return [0, 0];
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
return (
|
|
122
|
-
<SingleTooltip
|
|
123
|
-
key={idx}
|
|
124
|
-
layout={layout}
|
|
125
|
-
origin={orig()}
|
|
126
|
-
yLabel={each.yLabel}
|
|
127
|
-
yValue={yDisplayValue}
|
|
128
|
-
options={each}
|
|
129
|
-
forChart={chartId}
|
|
130
|
-
onClick={onClick}
|
|
131
|
-
fontFamily={fontFamily}
|
|
132
|
-
fontSize={fontSize}
|
|
133
|
-
labelFill={each.labelFill}
|
|
134
|
-
valueFill={each.valueFill}
|
|
135
|
-
withShape={each.withShape}
|
|
136
|
-
/>
|
|
137
|
-
);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
return (
|
|
141
|
-
<g transform={`translate(${xPos}, ${yPos})`} className={className} textAnchor={textAnchor}>
|
|
142
|
-
{layout === "horizontalInline" ? (
|
|
143
|
-
<ToolTipText x={0} y={0} fontFamily={fontFamily} fontSize={fontSize} fontWeight={fontWeight}>
|
|
144
|
-
{singleTooltip}
|
|
145
|
-
</ToolTipText>
|
|
146
|
-
) : (
|
|
147
|
-
singleTooltip
|
|
148
|
-
)}
|
|
149
|
-
</g>
|
|
150
|
-
);
|
|
151
|
-
};
|
|
152
|
-
}
|
package/src/HoverTooltip.tsx
DELETED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import { max, sum } from "d3-array";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { ChartCanvasContext, first, GenericComponent, isDefined, last } from "@tradingaction/core";
|
|
4
|
-
|
|
5
|
-
const PADDING = 4;
|
|
6
|
-
const X = 8;
|
|
7
|
-
const Y = 8;
|
|
8
|
-
|
|
9
|
-
const roundRect = (
|
|
10
|
-
ctx: CanvasRenderingContext2D,
|
|
11
|
-
x: number,
|
|
12
|
-
y: number,
|
|
13
|
-
width: number,
|
|
14
|
-
height: number,
|
|
15
|
-
radius: number,
|
|
16
|
-
) => {
|
|
17
|
-
ctx.beginPath();
|
|
18
|
-
ctx.moveTo(x + radius, y);
|
|
19
|
-
ctx.lineTo(x + width - radius, y);
|
|
20
|
-
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
|
|
21
|
-
ctx.lineTo(x + width, y + height - radius);
|
|
22
|
-
ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
|
|
23
|
-
ctx.lineTo(x + radius, y + height);
|
|
24
|
-
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
|
|
25
|
-
ctx.lineTo(x, y + radius);
|
|
26
|
-
ctx.quadraticCurveTo(x, y, x + radius, y);
|
|
27
|
-
ctx.closePath();
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const defaultBackgroundShapeCanvas = (
|
|
31
|
-
props: HoverTooltipProps,
|
|
32
|
-
{ width, height }: { width: number; height: number },
|
|
33
|
-
ctx: CanvasRenderingContext2D,
|
|
34
|
-
) => {
|
|
35
|
-
const { toolTipFillStyle, toolTipStrokeStyle } = props;
|
|
36
|
-
|
|
37
|
-
ctx.beginPath();
|
|
38
|
-
roundRect(ctx, 0, 0, width, height, 4);
|
|
39
|
-
if (toolTipFillStyle !== undefined) {
|
|
40
|
-
ctx.fillStyle = toolTipFillStyle;
|
|
41
|
-
ctx.shadowColor = "#898";
|
|
42
|
-
ctx.shadowBlur = 4;
|
|
43
|
-
ctx.fill();
|
|
44
|
-
ctx.shadowBlur = 0;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (toolTipStrokeStyle !== undefined) {
|
|
48
|
-
ctx.strokeStyle = toolTipStrokeStyle;
|
|
49
|
-
ctx.stroke();
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const defaultTooltipCanvas = (props: HoverTooltipProps, content: any, ctx: CanvasRenderingContext2D) => {
|
|
54
|
-
const { fontSize = 14, fontFamily, fontFill } = props;
|
|
55
|
-
|
|
56
|
-
const startY = Y + fontSize * 0.9;
|
|
57
|
-
ctx.font = `bold ${fontSize}px ${fontFamily}`;
|
|
58
|
-
if (fontFill !== undefined) {
|
|
59
|
-
ctx.fillStyle = fontFill;
|
|
60
|
-
}
|
|
61
|
-
ctx.textAlign = "left";
|
|
62
|
-
ctx.fillText(content.x, X, startY);
|
|
63
|
-
|
|
64
|
-
const maxLabel = max(content.y, (y: any) => ctx.measureText(y.label as string).width) ?? 0;
|
|
65
|
-
|
|
66
|
-
for (let i = 0; i < content.y.length; i++) {
|
|
67
|
-
const y = content.y[i];
|
|
68
|
-
const textY = (i + 1) * PADDING + startY + fontSize * (i + 1);
|
|
69
|
-
ctx.font = `${fontSize}px ${fontFamily}`;
|
|
70
|
-
ctx.fillStyle = y.stroke ?? fontFill;
|
|
71
|
-
ctx.fillText(y.label, X, textY);
|
|
72
|
-
|
|
73
|
-
if (fontFill !== undefined) {
|
|
74
|
-
ctx.fillStyle = fontFill;
|
|
75
|
-
}
|
|
76
|
-
ctx.fillText(y.value, X * 2 + maxLabel, textY);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const drawOnCanvas = (
|
|
81
|
-
ctx: CanvasRenderingContext2D,
|
|
82
|
-
props: HoverTooltipProps,
|
|
83
|
-
context: any,
|
|
84
|
-
pointer: any,
|
|
85
|
-
height: number,
|
|
86
|
-
) => {
|
|
87
|
-
const { margin, ratio } = context;
|
|
88
|
-
const { backgroundShapeCanvas, tooltipCanvas, background } = props;
|
|
89
|
-
|
|
90
|
-
const originX = 0.5 * ratio + margin.left;
|
|
91
|
-
const originY = 0.5 * ratio + margin.top;
|
|
92
|
-
|
|
93
|
-
ctx.save();
|
|
94
|
-
|
|
95
|
-
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
96
|
-
ctx.scale(ratio, ratio);
|
|
97
|
-
|
|
98
|
-
ctx.translate(originX, originY);
|
|
99
|
-
|
|
100
|
-
const { x, y, content, centerX, pointWidth, bgSize } = pointer;
|
|
101
|
-
|
|
102
|
-
if (background?.fillStyle !== undefined) {
|
|
103
|
-
ctx.fillStyle = background.fillStyle;
|
|
104
|
-
}
|
|
105
|
-
ctx.beginPath();
|
|
106
|
-
ctx.rect(centerX - pointWidth / 2, 0, pointWidth, height);
|
|
107
|
-
ctx.fill();
|
|
108
|
-
|
|
109
|
-
ctx.translate(x, y);
|
|
110
|
-
|
|
111
|
-
backgroundShapeCanvas(props, bgSize, ctx);
|
|
112
|
-
|
|
113
|
-
tooltipCanvas(props, content, ctx);
|
|
114
|
-
|
|
115
|
-
ctx.restore();
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const calculateTooltipSize = (props: HoverTooltipProps, content: any, ctx: CanvasRenderingContext2D) => {
|
|
119
|
-
const { fontFamily, fontSize = 12, fontFill } = props;
|
|
120
|
-
|
|
121
|
-
ctx.font = `bold ${fontSize}px ${fontFamily}`;
|
|
122
|
-
if (fontFill !== undefined) {
|
|
123
|
-
ctx.fillStyle = fontFill;
|
|
124
|
-
}
|
|
125
|
-
ctx.textAlign = "left";
|
|
126
|
-
|
|
127
|
-
const measureText = (str: string) => ({
|
|
128
|
-
width: ctx.measureText(str).width,
|
|
129
|
-
height: fontSize + PADDING,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
const { width, height } = content.y
|
|
133
|
-
.map(({ label, value }: any) => measureText(`${label} ${value}`))
|
|
134
|
-
// Sum all y and x sizes (begin with x label size)
|
|
135
|
-
.reduce((res: any, size: any) => sumSizes(res, size), measureText(String(content.x)));
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
width: width + 2 * X,
|
|
139
|
-
height: height + 2 * Y,
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
const sumSizes = (...sizes: any[]) => {
|
|
144
|
-
return {
|
|
145
|
-
width: Math.max(...sizes.map((size) => size.width)),
|
|
146
|
-
height: sum(sizes, (d) => d.height),
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const normalizeX = (x: number, bgSize: any, pointWidth: number, width: number) => {
|
|
151
|
-
return x < width / 2 ? x + pointWidth / 2 + PADDING : x - bgSize.width - pointWidth / 2 - PADDING;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const normalizeY = (y: number, bgSize: any) => {
|
|
155
|
-
return y - bgSize.height <= 0 ? y + PADDING : y - bgSize.height - PADDING;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const defaultOrigin = (props: HoverTooltipProps, moreProps: any, bgSize: any, pointWidth: any) => {
|
|
159
|
-
const { chartId, yAccessor } = props;
|
|
160
|
-
|
|
161
|
-
const { mouseXY, xAccessor, currentItem, xScale, chartConfig, width } = moreProps;
|
|
162
|
-
|
|
163
|
-
let y = last(mouseXY);
|
|
164
|
-
|
|
165
|
-
const xValue = xAccessor(currentItem);
|
|
166
|
-
|
|
167
|
-
let x = Math.round(xScale(xValue));
|
|
168
|
-
|
|
169
|
-
if (isDefined(chartId) && isDefined(yAccessor) && isDefined(chartConfig) && isDefined(chartConfig.findIndex)) {
|
|
170
|
-
const yValue = yAccessor(currentItem);
|
|
171
|
-
const chartIndex = chartConfig.findIndex((c: any) => c.id === chartId);
|
|
172
|
-
|
|
173
|
-
y = Math.round(chartConfig[chartIndex].yScale(yValue));
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
x = normalizeX(x, bgSize, pointWidth, width);
|
|
177
|
-
y = normalizeY(y, bgSize);
|
|
178
|
-
|
|
179
|
-
return [x, y];
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
export interface HoverTooltipProps {
|
|
183
|
-
readonly background?: {
|
|
184
|
-
fillStyle?: string;
|
|
185
|
-
height?: number;
|
|
186
|
-
strokeStyle?: string;
|
|
187
|
-
width?: number;
|
|
188
|
-
};
|
|
189
|
-
readonly backgroundShapeCanvas: (
|
|
190
|
-
props: HoverTooltipProps,
|
|
191
|
-
{ width, height }: { width: number; height: number },
|
|
192
|
-
ctx: CanvasRenderingContext2D,
|
|
193
|
-
) => void;
|
|
194
|
-
readonly chartId?: number | string;
|
|
195
|
-
readonly fontFamily?: string;
|
|
196
|
-
readonly fontFill?: string;
|
|
197
|
-
readonly fontSize?: number;
|
|
198
|
-
readonly origin?: (
|
|
199
|
-
props: HoverTooltipProps,
|
|
200
|
-
moreProps: any,
|
|
201
|
-
bgSize: { width: number; height: number },
|
|
202
|
-
pointWidth: number,
|
|
203
|
-
) => [number, number];
|
|
204
|
-
readonly tooltip: {
|
|
205
|
-
content: (data: any) => { x: string; y: { label: string; value?: string; stroke?: string }[] };
|
|
206
|
-
};
|
|
207
|
-
readonly toolTipFillStyle?: string;
|
|
208
|
-
readonly toolTipStrokeStyle?: string;
|
|
209
|
-
readonly tooltipCanvas: (props: HoverTooltipProps, content: any, ctx: CanvasRenderingContext2D) => void;
|
|
210
|
-
readonly yAccessor: (data: any) => number;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export class HoverTooltip extends React.Component<HoverTooltipProps> {
|
|
214
|
-
public static defaultProps = {
|
|
215
|
-
background: {
|
|
216
|
-
fillStyle: "rgba(33, 148, 243, 0.1)",
|
|
217
|
-
},
|
|
218
|
-
toolTipFillStyle: "rgba(250, 250, 250, 1)",
|
|
219
|
-
toolTipStrokeStyle: "rgba(33, 148, 243)",
|
|
220
|
-
tooltipCanvas: defaultTooltipCanvas,
|
|
221
|
-
origin: defaultOrigin,
|
|
222
|
-
backgroundShapeCanvas: defaultBackgroundShapeCanvas,
|
|
223
|
-
fontFill: "#000000",
|
|
224
|
-
fontFamily: "-apple-system, system-ui, Roboto, 'Helvetica Neue', Ubuntu, sans-serif",
|
|
225
|
-
fontSize: 14,
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
public static contextType = ChartCanvasContext;
|
|
229
|
-
|
|
230
|
-
public render() {
|
|
231
|
-
return <GenericComponent canvasDraw={this.drawOnCanvas} drawOn={["mousemove", "pan"]} />;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
private readonly drawOnCanvas = (ctx: CanvasRenderingContext2D, moreProps: any) => {
|
|
235
|
-
const pointer = this.helper(ctx, moreProps);
|
|
236
|
-
if (pointer === undefined) {
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
const { height } = moreProps;
|
|
241
|
-
|
|
242
|
-
drawOnCanvas(ctx, this.props, this.context, pointer, height);
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
private readonly helper = (ctx: CanvasRenderingContext2D, moreProps: any) => {
|
|
246
|
-
const { show, xScale, currentItem, plotData, xAccessor, displayXAccessor } = moreProps;
|
|
247
|
-
|
|
248
|
-
const { origin = HoverTooltip.defaultProps.origin, tooltip } = this.props;
|
|
249
|
-
|
|
250
|
-
if (!show || currentItem === undefined) {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const xValue = xAccessor(currentItem);
|
|
255
|
-
if (xValue === undefined) {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const content = tooltip.content({ currentItem, xAccessor: displayXAccessor });
|
|
260
|
-
const centerX = xScale(xValue);
|
|
261
|
-
const pointWidth =
|
|
262
|
-
Math.abs(xScale(xAccessor(last(plotData))) - xScale(xAccessor(first(plotData)))) / (plotData.length - 1);
|
|
263
|
-
|
|
264
|
-
const bgSize = calculateTooltipSize(this.props, content, ctx);
|
|
265
|
-
|
|
266
|
-
const [x, y] = origin(this.props, moreProps, bgSize, pointWidth);
|
|
267
|
-
|
|
268
|
-
return { x, y, content, centerX, pointWidth, bgSize };
|
|
269
|
-
};
|
|
270
|
-
}
|