onesight-charts 2.0.2 → 2.0.4
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/README.md +1 -1
- package/dist/onesight-charts.min.css +1 -1
- package/dist/onesight-charts.min.js +1 -1
- package/es/components/gauge/demo/base.js +41 -0
- package/es/components/gauge/index.js +371 -0
- package/es/components/gauge/style.scss +67 -0
- package/es/components/vertical-stacked-bar/index.js +32 -0
- package/es/index.js +1 -0
- package/lib/components/gauge/demo/base.js +40 -0
- package/lib/components/gauge/index.js +264 -0
- package/lib/components/gauge/style.scss +67 -0
- package/lib/components/vertical-stacked-bar/index.js +25 -0
- package/lib/index.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/gauge/index.jsx
|
|
30
|
+
var gauge_exports = {};
|
|
31
|
+
__export(gauge_exports, {
|
|
32
|
+
default: () => gauge_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(gauge_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_style = require("./style.scss");
|
|
38
|
+
function Gauge(props) {
|
|
39
|
+
const {
|
|
40
|
+
width = "100%",
|
|
41
|
+
height = "100%",
|
|
42
|
+
/** 当前数值 */
|
|
43
|
+
value = 0,
|
|
44
|
+
/** 数值范围 */
|
|
45
|
+
min = -100,
|
|
46
|
+
max = 100,
|
|
47
|
+
/** 判定阈值:value > positiveThreshold -> 积极,< negativeThreshold -> 消极 */
|
|
48
|
+
positiveThreshold = 0,
|
|
49
|
+
negativeThreshold = 0,
|
|
50
|
+
/** 底部标签文案;不传时按情绪自动判定 */
|
|
51
|
+
label,
|
|
52
|
+
/** 是否展示底部标签 */
|
|
53
|
+
showTag = true,
|
|
54
|
+
/** 是否展示底部标签的信息图标 */
|
|
55
|
+
showInfo = true,
|
|
56
|
+
/** 自定义颜色 */
|
|
57
|
+
colors: colorProp,
|
|
58
|
+
/** 信息图标点击回调 */
|
|
59
|
+
onInfoClick,
|
|
60
|
+
/** tooltip 消息 和 showInfo 结合使用 */
|
|
61
|
+
tip = ""
|
|
62
|
+
} = props;
|
|
63
|
+
const colors = {
|
|
64
|
+
negative: "#EF7B7B",
|
|
65
|
+
positive: "#4CBFA6",
|
|
66
|
+
neutral: "#9CA3AF",
|
|
67
|
+
arcMiddle: "#ECECEC",
|
|
68
|
+
tick: "#D4D4D4",
|
|
69
|
+
pointer: "#D2D3D7",
|
|
70
|
+
...colorProp || {}
|
|
71
|
+
};
|
|
72
|
+
const clamped = Math.max(min, Math.min(max, Number(value) || 0));
|
|
73
|
+
const pointerAngle = (clamped - min) / (max - min) * 180 - 90;
|
|
74
|
+
const mood = getMood(clamped, positiveThreshold, negativeThreshold, colors);
|
|
75
|
+
const displayLabel = label ?? mood.label;
|
|
76
|
+
const valueColor = clamped > 0 ? colors.positive : clamped < 0 ? colors.negative : colors.neutral;
|
|
77
|
+
const VB_W = 400;
|
|
78
|
+
const VB_H = 230;
|
|
79
|
+
const CX = 200;
|
|
80
|
+
const CY = 210;
|
|
81
|
+
const OUTER_R = 180;
|
|
82
|
+
const INNER_R = 152;
|
|
83
|
+
const EMOJI_R = (OUTER_R + INNER_R) / 2;
|
|
84
|
+
const pt = (r, deg) => {
|
|
85
|
+
const rad = deg * Math.PI / 180;
|
|
86
|
+
return { x: CX + r * Math.sin(rad), y: CY - r * Math.cos(rad) };
|
|
87
|
+
};
|
|
88
|
+
const so = pt(OUTER_R, -90);
|
|
89
|
+
const eo = pt(OUTER_R, 90);
|
|
90
|
+
const si = pt(INNER_R, -90);
|
|
91
|
+
const ei = pt(INNER_R, 90);
|
|
92
|
+
const arcPath = `M ${so.x} ${so.y} A ${OUTER_R} ${OUTER_R} 0 0 1 ${eo.x} ${eo.y} L ${ei.x} ${ei.y} A ${INNER_R} ${INNER_R} 0 0 0 ${si.x} ${si.y} Z`;
|
|
93
|
+
const TICK_COUNT = 31;
|
|
94
|
+
const EMOJI_ANGLES = [-60, 0, 60];
|
|
95
|
+
const ticks = [];
|
|
96
|
+
for (let i = 0; i < TICK_COUNT; i++) {
|
|
97
|
+
const angle = -90 + i * 180 / (TICK_COUNT - 1);
|
|
98
|
+
if (EMOJI_ANGLES.some((a) => Math.abs(angle - a) < 7))
|
|
99
|
+
continue;
|
|
100
|
+
const p1 = pt(INNER_R - 4, angle);
|
|
101
|
+
const p2 = pt(INNER_R - 14, angle);
|
|
102
|
+
ticks.push({ p1, p2, key: i });
|
|
103
|
+
}
|
|
104
|
+
const emojis = [
|
|
105
|
+
{ angle: -60, mood: "sad" },
|
|
106
|
+
{ angle: 0, mood: "neutral" },
|
|
107
|
+
{ angle: 60, mood: "happy" }
|
|
108
|
+
];
|
|
109
|
+
const label0Pos = pt(EMOJI_R - 28, 0);
|
|
110
|
+
const labelMinPos = pt(OUTER_R, -90);
|
|
111
|
+
const labelMaxPos = pt(OUTER_R, 90);
|
|
112
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "onesight-gauge", style: { width, height } }, /* @__PURE__ */ import_react.default.createElement("div", { className: "onesight-gauge__inner" }, /* @__PURE__ */ import_react.default.createElement(
|
|
113
|
+
"svg",
|
|
114
|
+
{
|
|
115
|
+
viewBox: `0 0 ${VB_W} ${VB_H}`,
|
|
116
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
117
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
118
|
+
className: "onesight-gauge__svg"
|
|
119
|
+
},
|
|
120
|
+
/* @__PURE__ */ import_react.default.createElement("defs", null, /* @__PURE__ */ import_react.default.createElement("linearGradient", { id: "onesight-gauge-arc", x1: "0", y1: "0", x2: "1", y2: "0" }, /* @__PURE__ */ import_react.default.createElement("stop", { offset: "0%", stopColor: colors.negative }), /* @__PURE__ */ import_react.default.createElement("stop", { offset: "18%", stopColor: colors.negative }), /* @__PURE__ */ import_react.default.createElement("stop", { offset: "38%", stopColor: "#F5C7C7" }), /* @__PURE__ */ import_react.default.createElement("stop", { offset: "50%", stopColor: colors.arcMiddle }), /* @__PURE__ */ import_react.default.createElement("stop", { offset: "62%", stopColor: "#BFE3D8" }), /* @__PURE__ */ import_react.default.createElement("stop", { offset: "82%", stopColor: colors.positive }), /* @__PURE__ */ import_react.default.createElement("stop", { offset: "100%", stopColor: colors.positive }))),
|
|
121
|
+
/* @__PURE__ */ import_react.default.createElement("path", { d: arcPath, fill: "url(#onesight-gauge-arc)" }),
|
|
122
|
+
ticks.map((t) => /* @__PURE__ */ import_react.default.createElement(
|
|
123
|
+
"line",
|
|
124
|
+
{
|
|
125
|
+
key: t.key,
|
|
126
|
+
x1: t.p1.x,
|
|
127
|
+
y1: t.p1.y,
|
|
128
|
+
x2: t.p2.x,
|
|
129
|
+
y2: t.p2.y,
|
|
130
|
+
stroke: colors.tick,
|
|
131
|
+
strokeWidth: 1.5,
|
|
132
|
+
strokeLinecap: "round"
|
|
133
|
+
}
|
|
134
|
+
)),
|
|
135
|
+
emojis.map((e) => {
|
|
136
|
+
const c = pt(EMOJI_R, e.angle);
|
|
137
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
138
|
+
MoodFace,
|
|
139
|
+
{
|
|
140
|
+
key: e.mood,
|
|
141
|
+
mood: e.mood,
|
|
142
|
+
size: 18,
|
|
143
|
+
color: "#ffffff",
|
|
144
|
+
x: c.x - 10,
|
|
145
|
+
y: c.y - 10
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
150
|
+
"text",
|
|
151
|
+
{
|
|
152
|
+
x: 72,
|
|
153
|
+
y: 214,
|
|
154
|
+
fill: colors.negative,
|
|
155
|
+
fontSize: "14",
|
|
156
|
+
fontWeight: "500",
|
|
157
|
+
textAnchor: "middle"
|
|
158
|
+
},
|
|
159
|
+
min
|
|
160
|
+
),
|
|
161
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
162
|
+
"text",
|
|
163
|
+
{
|
|
164
|
+
x: CX,
|
|
165
|
+
y: label0Pos.y,
|
|
166
|
+
fill: "#666",
|
|
167
|
+
fontSize: "14",
|
|
168
|
+
textAnchor: "middle"
|
|
169
|
+
},
|
|
170
|
+
"0"
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
173
|
+
"text",
|
|
174
|
+
{
|
|
175
|
+
x: 322,
|
|
176
|
+
y: 214,
|
|
177
|
+
fill: colors.positive,
|
|
178
|
+
fontSize: "14",
|
|
179
|
+
fontWeight: "500",
|
|
180
|
+
textAnchor: "middle"
|
|
181
|
+
},
|
|
182
|
+
max
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ import_react.default.createElement("g", { transform: `rotate(${pointerAngle} ${CX} ${CY})` }, /* @__PURE__ */ import_react.default.createElement(
|
|
185
|
+
"path",
|
|
186
|
+
{
|
|
187
|
+
d: `M ${CX - 4} ${CY - 79} A 4 4 0 0 1 ${CX + 4} ${CY - 79} L ${CX + 11} ${CY} L ${CX - 11} ${CY} Z`,
|
|
188
|
+
fill: colors.pointer
|
|
189
|
+
}
|
|
190
|
+
), /* @__PURE__ */ import_react.default.createElement("circle", { cx: 200, cy: 208, r: 11, fill: colors.pointer }), /* @__PURE__ */ import_react.default.createElement("circle", { cx: CX, cy: 208, r: 5.5, fill: "#ffffff" }))
|
|
191
|
+
), /* @__PURE__ */ import_react.default.createElement("div", { className: "onesight-gauge__value", style: { color: valueColor } }, clamped), showTag && /* @__PURE__ */ import_react.default.createElement(
|
|
192
|
+
"div",
|
|
193
|
+
{
|
|
194
|
+
className: "onesight-gauge__tag",
|
|
195
|
+
style: {
|
|
196
|
+
borderColor: mood.color,
|
|
197
|
+
color: mood.color,
|
|
198
|
+
backgroundColor: withAlpha(mood.color, 0.08)
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
/* @__PURE__ */ import_react.default.createElement("span", { className: "onesight-gauge__tag-icon" }, /* @__PURE__ */ import_react.default.createElement(MoodFace, { mood: mood.face, size: 16 })),
|
|
202
|
+
/* @__PURE__ */ import_react.default.createElement("span", { className: "onesight-gauge__tag-label" }, displayLabel),
|
|
203
|
+
showInfo && /* @__PURE__ */ import_react.default.createElement(import_antd.Tooltip, { title: tip }, /* @__PURE__ */ import_react.default.createElement(
|
|
204
|
+
"span",
|
|
205
|
+
{
|
|
206
|
+
className: "onesight-gauge__tag-info",
|
|
207
|
+
onClick: onInfoClick,
|
|
208
|
+
role: onInfoClick ? "button" : void 0
|
|
209
|
+
},
|
|
210
|
+
/* @__PURE__ */ import_react.default.createElement(InfoIcon, { color: mood.color })
|
|
211
|
+
))
|
|
212
|
+
)));
|
|
213
|
+
}
|
|
214
|
+
var MOOD_FACE_CONFIG = {
|
|
215
|
+
happy: {
|
|
216
|
+
fill: "#1DA9A0",
|
|
217
|
+
d: "M7,0 C10.8654,0 14,3.1339 14,7 C14,10.8661 10.8654,14 7,14 C3.1346,14 0,10.8661 0,7 C0,3.1339 3.1346,0 7,0 Z M9.8875,8.52684 L4.1125,8.52684 C3.8094,8.52684 3.577,8.81594 3.6603,9.10714 C4.0453,10.44414 5.3928,11.43254 7,11.43254 C8.6072,11.43254 9.9547,10.44414 10.3397,9.10714 C10.423,8.81594 10.1906,8.52684 9.8875,8.52684 Z M4.59606,4.67124 C4.11866,4.67124 3.73086,5.05764 3.73086,5.53574 C3.73086,6.01314 4.11866,6.40024 4.59606,6.40024 C5.07346,6.40024 5.46056,6.01314 5.46056,5.53574 C5.46056,5.05764 5.07346,4.67124 4.59606,4.67124 Z M9.40443,4.67124 C8.92633,4.67124 8.53923,5.05764 8.53923,5.53574 C8.53923,6.01314 8.92633,6.40024 9.40443,6.40024 C9.88113,6.40024 10.26893,6.01314 10.26893,5.53574 C10.26893,5.05764 9.88113,4.67124 9.40443,4.67124 Z"
|
|
218
|
+
},
|
|
219
|
+
sad: {
|
|
220
|
+
fill: "#EE6666",
|
|
221
|
+
d: "M7,0 C10.8661,0 14,3.1339 14,7 C14,10.8661 10.8661,14 7,14 C3.1346,14 0,10.8661 0,7 C0,3.1339 3.1346,0 7,0 Z M7.82369,8.19399 C6.32919,7.88249 4.76749,8.45789 3.83439,9.65839 C3.66849,9.87189 3.70699,10.17989 3.92049,10.34649 C4.13469,10.51169 4.44199,10.47459 4.60789,10.25969 C5.31349,9.35249 6.49789,8.91779 7.62279,9.15299 C8.32279,9.29929 8.95069,9.69199 9.39169,10.25969 C9.48829,10.38429 9.63319,10.4494007 9.77949,10.4494007 C9.88379,10.4494007 9.99019,10.41579 10.07979,10.34649 C10.29259,10.17989 10.33179,9.87259 10.16589,9.65839 C9.58209,8.90729 8.74979,8.38719 7.82369,8.19399 Z M4.59669,4.67124 C4.11859,4.67124 3.73149,5.05764 3.73149,5.53574 C3.73149,6.01314 4.11859,6.40024 4.59669,6.40024 C5.07339,6.40024 5.46119,6.01314 5.46119,5.53574 C5.46119,5.05764 5.07339,4.67124 4.59669,4.67124 Z M9.40443,4.67124 C8.92633,4.67124 8.53923,5.05764 8.53923,5.53574 C8.53923,6.01314 8.92633,6.40024 9.40443,6.40024 C9.88113,6.40024 10.26893,6.01314 10.26893,5.53574 C10.26893,5.05764 9.88113,4.67124 9.40443,4.67124 Z"
|
|
222
|
+
},
|
|
223
|
+
neutral: {
|
|
224
|
+
fill: "#CCCCCC",
|
|
225
|
+
d: "M7,0 C10.8661,0 14,3.1339 14,7 C14,10.8661 10.8661,14 7,14 C3.1346,14 0,10.8661 0,7 C0,3.1339 3.1346,0 7,0 Z M9.17728,9.41962 L4.82328,9.41962 C4.51458,9.41962 4.26328,9.67022 4.26328,9.97962 C4.26328,10.28902 4.51458,10.53962 4.82328,10.53962 L9.17728,10.53962 C9.48598,10.53962 9.73728,10.28902 9.73728,9.97962 C9.73728,9.67022 9.48598,9.41962 9.17728,9.41962 Z M4.59676,4.67124 C4.11866,4.67124 3.73156,5.05764 3.73156,5.53574 C3.73156,6.01314 4.11866,6.40024 4.59676,6.40024 C5.07416,6.40024 5.46126,6.01314 5.46126,5.53574 C5.46126,5.05764 5.07416,4.67124 4.59676,4.67124 Z M9.40443,4.67124 C8.92633,4.67124 8.53923,5.05764 8.53923,5.53574 C8.53923,6.01314 8.92633,6.40024 9.40443,6.40024 C9.88183,6.40024 10.26893,6.01314 10.26893,5.53574 C10.26893,5.05764 9.88183,4.67124 9.40443,4.67124 Z"
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
function MoodFace({ mood, size = 16, color, x, y }) {
|
|
229
|
+
const cfg = MOOD_FACE_CONFIG[mood] || MOOD_FACE_CONFIG.neutral;
|
|
230
|
+
const fill = color || cfg.fill;
|
|
231
|
+
const svgProps = {
|
|
232
|
+
width: size,
|
|
233
|
+
height: size,
|
|
234
|
+
viewBox: "0 0 14 14",
|
|
235
|
+
"aria-hidden": true
|
|
236
|
+
};
|
|
237
|
+
if (x !== void 0)
|
|
238
|
+
svgProps.x = x;
|
|
239
|
+
if (y !== void 0)
|
|
240
|
+
svgProps.y = y;
|
|
241
|
+
return /* @__PURE__ */ import_react.default.createElement("svg", { ...svgProps }, /* @__PURE__ */ import_react.default.createElement("g", { stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd" }, /* @__PURE__ */ import_react.default.createElement("g", { fill }, /* @__PURE__ */ import_react.default.createElement("path", { d: cfg.d }))));
|
|
242
|
+
}
|
|
243
|
+
function InfoIcon({ color }) {
|
|
244
|
+
return /* @__PURE__ */ import_react.default.createElement("svg", { width: "14", height: "14", viewBox: "0 0 14 14", "aria-hidden": "true" }, /* @__PURE__ */ import_react.default.createElement("circle", { cx: "7", cy: "7", r: "6", stroke: color, strokeWidth: "1.1", fill: "none" }), /* @__PURE__ */ import_react.default.createElement("circle", { cx: "7", cy: "4.3", r: "0.9", fill: color }), /* @__PURE__ */ import_react.default.createElement("line", { x1: "7", y1: "6.4", x2: "7", y2: "10.2", stroke: color, strokeWidth: "1.2", strokeLinecap: "round" }));
|
|
245
|
+
}
|
|
246
|
+
function getMood(v, posT, negT, colors) {
|
|
247
|
+
if (v > posT)
|
|
248
|
+
return { label: "积极", color: colors.positive, face: "happy" };
|
|
249
|
+
if (v < negT)
|
|
250
|
+
return { label: "消极", color: colors.negative, face: "sad" };
|
|
251
|
+
return { label: "中性", color: colors.neutral, face: "neutral" };
|
|
252
|
+
}
|
|
253
|
+
function withAlpha(hex, alpha) {
|
|
254
|
+
let h = String(hex || "").replace("#", "");
|
|
255
|
+
if (h.length === 3)
|
|
256
|
+
h = h.split("").map((c) => c + c).join("");
|
|
257
|
+
if (h.length !== 6)
|
|
258
|
+
return hex;
|
|
259
|
+
const r = parseInt(h.substring(0, 2), 16);
|
|
260
|
+
const g = parseInt(h.substring(2, 4), 16);
|
|
261
|
+
const b = parseInt(h.substring(4, 6), 16);
|
|
262
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
263
|
+
}
|
|
264
|
+
var gauge_default = Gauge;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.onesight-gauge {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
|
|
8
|
+
&__inner {
|
|
9
|
+
width: 100%;
|
|
10
|
+
max-width: 640px;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__svg {
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: auto;
|
|
19
|
+
display: block;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&__value {
|
|
23
|
+
margin-top: 4px;
|
|
24
|
+
font-size: 28px;
|
|
25
|
+
font-weight: 700;
|
|
26
|
+
line-height: 1;
|
|
27
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__tag {
|
|
31
|
+
margin-top: 12px;
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: 6px;
|
|
35
|
+
padding: 3px 10px 3px 4px;
|
|
36
|
+
border: 1px solid;
|
|
37
|
+
border-radius: 999px;
|
|
38
|
+
font-size: 13px;
|
|
39
|
+
line-height: 1;
|
|
40
|
+
|
|
41
|
+
&-icon {
|
|
42
|
+
width: 20px;
|
|
43
|
+
height: 20px;
|
|
44
|
+
border-radius: 50%;
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
flex-shrink: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&-label {
|
|
52
|
+
font-weight: 500;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&-info {
|
|
56
|
+
display: inline-flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
opacity: 0.85;
|
|
60
|
+
transition: opacity 0.2s;
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
opacity: 1;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -865,6 +865,31 @@ function VerticalStackedBar(props) {
|
|
|
865
865
|
dataIndex: event.dataIndex
|
|
866
866
|
});
|
|
867
867
|
currentIndex = event.dataIndex;
|
|
868
|
+
setTimeout(() => {
|
|
869
|
+
const chartDom = myChart.getDom();
|
|
870
|
+
const parentElement = (chartDom == null ? void 0 : chartDom.parentElement) || chartDom;
|
|
871
|
+
const tooltipEl = parentElement == null ? void 0 : parentElement.querySelector(
|
|
872
|
+
`.${tooltipClassNameRef.current}`
|
|
873
|
+
);
|
|
874
|
+
if (tooltipEl && !tooltipEl.dataset.axisPointerBound) {
|
|
875
|
+
tooltipEl.addEventListener("mouseenter", () => {
|
|
876
|
+
toggleAxisPointer(myChart, false);
|
|
877
|
+
});
|
|
878
|
+
tooltipEl.addEventListener("mouseleave", () => {
|
|
879
|
+
toggleAxisPointer(myChart, false);
|
|
880
|
+
myChart.dispatchAction({ type: "hideTip" });
|
|
881
|
+
myChart.dispatchAction({
|
|
882
|
+
type: "downplay",
|
|
883
|
+
dataIndex: currentIndex
|
|
884
|
+
});
|
|
885
|
+
});
|
|
886
|
+
tooltipEl.dataset.axisPointerBound = "true";
|
|
887
|
+
}
|
|
888
|
+
}, 0);
|
|
889
|
+
});
|
|
890
|
+
myChart.off("hideTip");
|
|
891
|
+
myChart.on("hideTip", function() {
|
|
892
|
+
toggleAxisPointer(myChart, false);
|
|
868
893
|
});
|
|
869
894
|
myChart.setOption(option, true);
|
|
870
895
|
if (showTotal) {
|
package/lib/index.js
CHANGED
|
@@ -32,6 +32,7 @@ __export(src_exports, {
|
|
|
32
32
|
BrushLine: () => import_brush_line.default,
|
|
33
33
|
CommonBar: () => import_common_bar.default,
|
|
34
34
|
CustomLine: () => import_custom_line.default,
|
|
35
|
+
Gauge: () => import_gauge.default,
|
|
35
36
|
Line: () => import_line.default,
|
|
36
37
|
MapChart: () => import_map_chart.default,
|
|
37
38
|
Pie: () => import_pie.default,
|
|
@@ -52,6 +53,7 @@ var import_pie = __toESM(require("./components/pie"));
|
|
|
52
53
|
var import_radio_tabs = __toESM(require("./components/radio-tabs"));
|
|
53
54
|
var import_stacked_bar = __toESM(require("./components/stacked-bar"));
|
|
54
55
|
var import_standard_custom_line = __toESM(require("./components/standard-custom-line"));
|
|
56
|
+
var import_gauge = __toESM(require("./components/gauge"));
|
|
55
57
|
var import_standard_line = __toESM(require("./components/standard-line"));
|
|
56
58
|
var import_vertical_stacked_bar = __toESM(require("./components/vertical-stacked-bar"));
|
|
57
59
|
var import_word_cloud = __toESM(require("./components/word-cloud"));
|
|
@@ -60,6 +62,7 @@ var import_word_cloud = __toESM(require("./components/word-cloud"));
|
|
|
60
62
|
BrushLine,
|
|
61
63
|
CommonBar,
|
|
62
64
|
CustomLine,
|
|
65
|
+
Gauge,
|
|
63
66
|
Line,
|
|
64
67
|
MapChart,
|
|
65
68
|
Pie,
|