@visactor/vrender 1.0.28-alpha.0 → 1.0.29
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/cjs/index.d.ts +1 -1
- package/cjs/index.js +10 -11
- package/cjs/index.js.map +1 -1
- package/dist/index.es.js +139 -5
- package/dist/index.js +139 -5
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +7 -7
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -21,17 +21,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
21
21
|
|
|
22
22
|
const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits"), vrender_kits_2 = require("@visactor/vrender-kits"), vrender_animate_1 = require("@visactor/vrender-animate");
|
|
23
23
|
|
|
24
|
-
exports.version = "1.0.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
(0, vrender_kits_2.
|
|
28
|
-
(0, vrender_kits_2.
|
|
29
|
-
(0, vrender_kits_2.
|
|
30
|
-
(0, vrender_kits_2.
|
|
31
|
-
|
|
32
|
-
(0, vrender_kits_2.
|
|
33
|
-
(0,
|
|
34
|
-
vrender_kits_1.registerStar)(), (0, vrender_core_1.registerFlexLayoutPlugin)(),
|
|
24
|
+
exports.version = "1.0.29", (0, vrender_core_1.preLoadAllModule)(), (0, vrender_core_1.isBrowserEnv)() ? (0,
|
|
25
|
+
vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0, vrender_core_1.isNodeEnv)() && (0,
|
|
26
|
+
vrender_kits_1.loadNodeEnv)(vrender_core_1.container), (0, vrender_kits_2.registerArc)(),
|
|
27
|
+
(0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(), (0, vrender_kits_2.registerCircle)(),
|
|
28
|
+
(0, vrender_kits_2.registerGlyph)(), (0, vrender_kits_2.registerGroup)(), (0, vrender_kits_2.registerImage)(),
|
|
29
|
+
(0, vrender_kits_2.registerLine)(), (0, vrender_kits_2.registerPath)(), (0, vrender_kits_2.registerPolygon)(),
|
|
30
|
+
(0, vrender_kits_2.registerPyramid3d)(), (0, vrender_kits_2.registerRect)(), (0,
|
|
31
|
+
vrender_kits_2.registerRect3d)(), (0, vrender_kits_2.registerRichtext)(), (0, vrender_kits_2.registerShadowRoot)(),
|
|
32
|
+
(0, vrender_kits_2.registerSymbol)(), (0, vrender_kits_2.registerText)(), (0, vrender_kits_2.registerWrapText)(),
|
|
33
|
+
(0, vrender_kits_1.registerStar)(), (0, vrender_core_1.registerFlexLayoutPlugin)(),
|
|
35
34
|
(0, vrender_core_1.registerViewTransform3dPlugin)(), (0, vrender_core_1.registerHtmlAttributePlugin)(),
|
|
36
35
|
(0, vrender_core_1.registerReactAttributePlugin)(), (0, vrender_core_1.registerDirectionalLight)(),
|
|
37
36
|
(0, vrender_core_1.registerOrthoCamera)(), (0, vrender_animate_1.registerCustomAnimate)(),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAmF;AACnF,yDAmBgC;AAChC,+DAAmF;AAEtE,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAmF;AACnF,yDAmBgC;AAChC,+DAAmF;AAEtE,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,2BAAY,GAAE,CAAC;AAEf,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,4CAA6B,GAAE,CAAC;AAChC,IAAA,0CAA2B,GAAE,CAAC;AAC9B,IAAA,2CAA4B,GAAE,CAAC;AAC/B,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,kCAAmB,GAAE,CAAC;AAEtB,IAAA,uCAAqB,GAAE,CAAC;AACxB,IAAA,iCAAe,GAAE,CAAC;AAElB,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C;AAC1C,+DAA6C;AAG7C,6DAAkD;AAAzC,wGAAA,KAAK,OAAA;AACd,uDAAmD;AAA1C,yGAAA,SAAS,OAAA","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport {\n container,\n isBrowserEnv,\n isNodeEnv,\n preLoadAllModule,\n registerFlexLayoutPlugin,\n registerViewTransform3dPlugin,\n registerHtmlAttributePlugin,\n registerReactAttributePlugin,\n registerDirectionalLight,\n registerOrthoCamera\n} from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv, registerStar } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\nimport { registerCustomAnimate, registerAnimate } from '@visactor/vrender-animate';\n// 导出版本号\nexport const version = \"1.0.29\";\n\npreLoadAllModule();\n\nif (isBrowserEnv()) {\n loadBrowserEnv(container);\n} else if (isNodeEnv()) {\n loadNodeEnv(container);\n}\nregisterArc();\nregisterArc3d();\nregisterArea();\nregisterCircle();\nregisterGlyph();\nregisterGroup();\nregisterImage();\nregisterLine();\nregisterPath();\nregisterPolygon();\nregisterPyramid3d();\nregisterRect();\nregisterRect3d();\nregisterRichtext();\nregisterShadowRoot();\nregisterSymbol();\nregisterText();\nregisterWrapText();\nregisterStar();\n\nregisterFlexLayoutPlugin();\nregisterViewTransform3dPlugin();\nregisterHtmlAttributePlugin();\nregisterReactAttributePlugin();\nregisterDirectionalLight();\nregisterOrthoCamera();\n\nregisterCustomAnimate();\nregisterAnimate();\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\nexport * from '@visactor/vrender-animate';\nexport * from '@visactor/vrender-components';\n\n// avoid naming conflicts with 'State' & 'Direction' in '@visactor/vrender-components'\nexport { State } from '@visactor/vrender-animate';\nexport { Direction } from '@visactor/vrender-core';\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -589,7 +589,7 @@ class SyncHook extends Hook {
|
|
|
589
589
|
|
|
590
590
|
const EnvContribution = Symbol.for("EnvContribution");
|
|
591
591
|
const VGlobal = Symbol.for("VGlobal");
|
|
592
|
-
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui
|
|
592
|
+
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
|
|
593
593
|
|
|
594
594
|
const container = new Container();
|
|
595
595
|
|
|
@@ -4753,7 +4753,7 @@ const DefaultTextStyle = {
|
|
|
4753
4753
|
textAlign: "left",
|
|
4754
4754
|
textBaseline: "alphabetic",
|
|
4755
4755
|
fontSize: 16,
|
|
4756
|
-
fontFamily: "PingFang SC,Microsoft Yahei,system-ui
|
|
4756
|
+
fontFamily: "PingFang SC,Microsoft Yahei,system-ui,'-apple-system',segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",
|
|
4757
4757
|
fontWeight: "",
|
|
4758
4758
|
ellipsis: "…",
|
|
4759
4759
|
fontVariant: "",
|
|
@@ -39326,7 +39326,7 @@ class ArcSegment extends Segment {
|
|
|
39326
39326
|
|
|
39327
39327
|
var AXIS_ELEMENT_NAME;
|
|
39328
39328
|
!function (AXIS_ELEMENT_NAME) {
|
|
39329
|
-
AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break", AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
|
|
39329
|
+
AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.labelHoverOnAxis = "axis-label-hover-on-axis", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break", AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
|
|
39330
39330
|
}(AXIS_ELEMENT_NAME || (AXIS_ELEMENT_NAME = {}));
|
|
39331
39331
|
var AxisStateValue;
|
|
39332
39332
|
!function (AxisStateValue) {
|
|
@@ -39363,6 +39363,26 @@ const DEFAULT_AXIS_THEME = {
|
|
|
39363
39363
|
fillOpacity: 1
|
|
39364
39364
|
}
|
|
39365
39365
|
},
|
|
39366
|
+
labelHoverOnAxis: {
|
|
39367
|
+
visible: !1,
|
|
39368
|
+
space: 7,
|
|
39369
|
+
padding: 2,
|
|
39370
|
+
position: 0,
|
|
39371
|
+
autoRotate: !1,
|
|
39372
|
+
textStyle: {
|
|
39373
|
+
fontSize: 12,
|
|
39374
|
+
fill: "red",
|
|
39375
|
+
fontWeight: "normal",
|
|
39376
|
+
fillOpacity: 1
|
|
39377
|
+
},
|
|
39378
|
+
background: {
|
|
39379
|
+
visible: !0,
|
|
39380
|
+
style: {
|
|
39381
|
+
cornerRadius: 2,
|
|
39382
|
+
fill: "black"
|
|
39383
|
+
}
|
|
39384
|
+
}
|
|
39385
|
+
},
|
|
39366
39386
|
tick: {
|
|
39367
39387
|
visible: !0,
|
|
39368
39388
|
inside: !1,
|
|
@@ -40354,7 +40374,17 @@ var __rest$b = undefined && undefined.__rest || function (s, e) {
|
|
|
40354
40374
|
loadLineAxisComponent();
|
|
40355
40375
|
class LineAxis extends AxisBase {
|
|
40356
40376
|
constructor(attributes, options) {
|
|
40357
|
-
|
|
40377
|
+
var _a;
|
|
40378
|
+
if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) {
|
|
40379
|
+
const {
|
|
40380
|
+
padding = 2
|
|
40381
|
+
} = attributes.labelHoverOnAxis,
|
|
40382
|
+
parsedPadding = normalizePadding(padding),
|
|
40383
|
+
toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3],
|
|
40384
|
+
space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding;
|
|
40385
|
+
attributes.labelHoverOnAxis.space = space;
|
|
40386
|
+
}
|
|
40387
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null;
|
|
40358
40388
|
}
|
|
40359
40389
|
_renderInner(container) {
|
|
40360
40390
|
var _a;
|
|
@@ -40416,6 +40446,15 @@ class LineAxis extends AxisBase {
|
|
|
40416
40446
|
}, panel.style));
|
|
40417
40447
|
bgRect.name = AXIS_ELEMENT_NAME.background, bgRect.id = this._getNodeId("background"), bgRect.states = merge({}, DEFAULT_STATES$1, null !== (_a = panel.state) && void 0 !== _a ? _a : {}), axisContainer.insertBefore(bgRect, axisContainer.firstChild);
|
|
40418
40448
|
}
|
|
40449
|
+
const {
|
|
40450
|
+
labelHoverOnAxis: labelHoverOnAxis
|
|
40451
|
+
} = this.attribute;
|
|
40452
|
+
labelHoverOnAxis && labelHoverOnAxis.visible && this.renderLabelHoverOnAxis();
|
|
40453
|
+
}
|
|
40454
|
+
renderLabelHoverOnAxis() {
|
|
40455
|
+
const hoverOnLabelAttributes = this.getLabelHoverOnAxisAttribute(),
|
|
40456
|
+
hoverOnLabel = new Tag(Object.assign({}, hoverOnLabelAttributes));
|
|
40457
|
+
hoverOnLabel.name = AXIS_ELEMENT_NAME.title, hoverOnLabel.id = this._getNodeId("hover-on-label"), this.labelHoverOnAxisGroup = hoverOnLabel, this.axisContainer.add(hoverOnLabel);
|
|
40419
40458
|
}
|
|
40420
40459
|
renderLine(container) {
|
|
40421
40460
|
const {
|
|
@@ -40556,6 +40595,66 @@ class LineAxis extends AxisBase {
|
|
|
40556
40595
|
visible: !0
|
|
40557
40596
|
}, background.style)), attrs;
|
|
40558
40597
|
}
|
|
40598
|
+
getLabelHoverOnAxisAttribute() {
|
|
40599
|
+
var _a, _b;
|
|
40600
|
+
const {
|
|
40601
|
+
orient: orient
|
|
40602
|
+
} = this.attribute,
|
|
40603
|
+
_c = this.attribute.labelHoverOnAxis,
|
|
40604
|
+
{
|
|
40605
|
+
position = 0,
|
|
40606
|
+
space = 4,
|
|
40607
|
+
autoRotate = !0,
|
|
40608
|
+
textStyle = {},
|
|
40609
|
+
background = {},
|
|
40610
|
+
formatMethod: formatMethod,
|
|
40611
|
+
text: textContent = "",
|
|
40612
|
+
maxWidth: maxWidth
|
|
40613
|
+
} = _c,
|
|
40614
|
+
restAttrs = __rest$b(_c, ["position", "space", "autoRotate", "textStyle", "background", "formatMethod", "text", "maxWidth"]),
|
|
40615
|
+
point = this.getTickCoord(0);
|
|
40616
|
+
"bottom" === orient || "top" === orient ? point.x = position : point.y = position;
|
|
40617
|
+
let tickLength = 0;
|
|
40618
|
+
(null === (_a = this.attribute.tick) || void 0 === _a ? void 0 : _a.visible) && !1 === this.attribute.tick.inside && (tickLength = this.attribute.tick.length || 4), (null === (_b = this.attribute.subTick) || void 0 === _b ? void 0 : _b.visible) && !1 === this.attribute.subTick.inside && (tickLength = Math.max(tickLength, this.attribute.subTick.length || 2));
|
|
40619
|
+
const offset = tickLength + 0 + space,
|
|
40620
|
+
labelPoint = this.getVerticalCoord(point, offset, !1),
|
|
40621
|
+
vector = this.getVerticalVector(offset, !1, {
|
|
40622
|
+
x: 0,
|
|
40623
|
+
y: 0
|
|
40624
|
+
});
|
|
40625
|
+
let textBaseline,
|
|
40626
|
+
{
|
|
40627
|
+
angle: angle
|
|
40628
|
+
} = restAttrs,
|
|
40629
|
+
textAlign = "center";
|
|
40630
|
+
if (isNil$1(angle) && autoRotate) {
|
|
40631
|
+
const axisVector = this.getRelativeVector();
|
|
40632
|
+
angle = angleTo(axisVector, [1, 0], !0);
|
|
40633
|
+
const {
|
|
40634
|
+
verticalFactor = 1
|
|
40635
|
+
} = this.attribute;
|
|
40636
|
+
textBaseline = 1 === -1 * verticalFactor ? "bottom" : "top";
|
|
40637
|
+
} else {
|
|
40638
|
+
const {
|
|
40639
|
+
textAlign: textAlign2,
|
|
40640
|
+
textBaseline: textBaseline2
|
|
40641
|
+
} = this.getLabelAlign(vector, !1, textStyle.angle);
|
|
40642
|
+
textAlign = textAlign2, textBaseline = textBaseline2;
|
|
40643
|
+
}
|
|
40644
|
+
const maxTagWidth = maxWidth,
|
|
40645
|
+
text = formatMethod ? formatMethod(textContent) : textContent,
|
|
40646
|
+
attrs = Object.assign(Object.assign(Object.assign({}, labelPoint), restAttrs), {
|
|
40647
|
+
maxWidth: maxTagWidth,
|
|
40648
|
+
textStyle: Object.assign({
|
|
40649
|
+
textAlign: textAlign,
|
|
40650
|
+
textBaseline: textBaseline
|
|
40651
|
+
}, textStyle),
|
|
40652
|
+
text: text
|
|
40653
|
+
});
|
|
40654
|
+
return attrs.angle = angle, background && background.visible && (attrs.panel = Object.assign(Object.assign({
|
|
40655
|
+
visible: !0
|
|
40656
|
+
}, restAttrs.panel), background.style)), attrs;
|
|
40657
|
+
}
|
|
40559
40658
|
getTextBaseline(vector, inside) {
|
|
40560
40659
|
let base = "middle";
|
|
40561
40660
|
const {
|
|
@@ -40746,6 +40845,41 @@ class LineAxis extends AxisBase {
|
|
|
40746
40845
|
}
|
|
40747
40846
|
return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength;
|
|
40748
40847
|
}
|
|
40848
|
+
showLabelHoverOnAxis(position, text) {
|
|
40849
|
+
let adjustPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
40850
|
+
if (this.attribute.labelHoverOnAxis) {
|
|
40851
|
+
const preContainerBounds = this.axisContainer.AABBBounds,
|
|
40852
|
+
preWidth = preContainerBounds.width(),
|
|
40853
|
+
preHeight = preContainerBounds.height(),
|
|
40854
|
+
preX1 = preContainerBounds.x1,
|
|
40855
|
+
preY1 = preContainerBounds.y1,
|
|
40856
|
+
preX2 = preContainerBounds.x2,
|
|
40857
|
+
preY2 = preContainerBounds.y2;
|
|
40858
|
+
if (this.labelHoverOnAxisGroup) {
|
|
40859
|
+
const {
|
|
40860
|
+
formatMethod: formatMethod
|
|
40861
|
+
} = this.attribute.labelHoverOnAxis,
|
|
40862
|
+
textStr = formatMethod ? formatMethod(text) : text;
|
|
40863
|
+
this.labelHoverOnAxisGroup.setAttribute("text", textStr), this.labelHoverOnAxisGroup.setAttribute("visible", !0), this.labelHoverOnAxisGroup.setAttribute("visibleAll", !0), "left" === this.attribute.orient || "right" === this.attribute.orient ? this.labelHoverOnAxisGroup.setAttributes({
|
|
40864
|
+
y: position
|
|
40865
|
+
}) : this.labelHoverOnAxisGroup.setAttributes({
|
|
40866
|
+
x: position
|
|
40867
|
+
});
|
|
40868
|
+
} else this.attribute.labelHoverOnAxis.visible = !0, this.attribute.labelHoverOnAxis.position = position, this.attribute.labelHoverOnAxis.text = text, this.renderLabelHoverOnAxis();
|
|
40869
|
+
if (adjustPosition) {
|
|
40870
|
+
const afterContainerBounds = this.axisContainer.AABBBounds,
|
|
40871
|
+
diffWidth = afterContainerBounds.width() - preWidth,
|
|
40872
|
+
diffHeight = afterContainerBounds.height() - preHeight;
|
|
40873
|
+
diffWidth > 0 && ("top" === this.attribute.orient || "bottom" === this.attribute.orient) && (afterContainerBounds.x1 < preX1 ? this.showLabelHoverOnAxis(position + diffWidth, text, !1) : afterContainerBounds.x2 > preX2 && this.showLabelHoverOnAxis(position - diffWidth, text, !1)), diffHeight > 0 && ("left" === this.attribute.orient || "right" === this.attribute.orient) && (afterContainerBounds.y1 < preY1 ? this.showLabelHoverOnAxis(position + diffHeight, text, !1) : afterContainerBounds.y2 > preY2 && this.showLabelHoverOnAxis(position - diffHeight, text, !1));
|
|
40874
|
+
}
|
|
40875
|
+
}
|
|
40876
|
+
}
|
|
40877
|
+
hideLabelHoverOnAxis() {
|
|
40878
|
+
this.attribute.labelHoverOnAxis && this.labelHoverOnAxisGroup && this.labelHoverOnAxisGroup.setAttributes({
|
|
40879
|
+
visible: !1,
|
|
40880
|
+
visibleAll: !1
|
|
40881
|
+
});
|
|
40882
|
+
}
|
|
40749
40883
|
release() {
|
|
40750
40884
|
super.release(), this._breaks = null;
|
|
40751
40885
|
}
|
|
@@ -52823,7 +52957,7 @@ TableSeriesNumber.defaultAttributes = {
|
|
|
52823
52957
|
select: !0
|
|
52824
52958
|
};
|
|
52825
52959
|
|
|
52826
|
-
const version = "1.0.
|
|
52960
|
+
const version = "1.0.29";
|
|
52827
52961
|
preLoadAllModule();
|
|
52828
52962
|
if (isBrowserEnv()) {
|
|
52829
52963
|
loadBrowserEnv(container);
|
package/dist/index.js
CHANGED
|
@@ -595,7 +595,7 @@
|
|
|
595
595
|
|
|
596
596
|
const EnvContribution = Symbol.for("EnvContribution");
|
|
597
597
|
const VGlobal = Symbol.for("VGlobal");
|
|
598
|
-
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui
|
|
598
|
+
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
|
|
599
599
|
|
|
600
600
|
const container = new Container();
|
|
601
601
|
|
|
@@ -4759,7 +4759,7 @@
|
|
|
4759
4759
|
textAlign: "left",
|
|
4760
4760
|
textBaseline: "alphabetic",
|
|
4761
4761
|
fontSize: 16,
|
|
4762
|
-
fontFamily: "PingFang SC,Microsoft Yahei,system-ui
|
|
4762
|
+
fontFamily: "PingFang SC,Microsoft Yahei,system-ui,'-apple-system',segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",
|
|
4763
4763
|
fontWeight: "",
|
|
4764
4764
|
ellipsis: "…",
|
|
4765
4765
|
fontVariant: "",
|
|
@@ -39332,7 +39332,7 @@
|
|
|
39332
39332
|
|
|
39333
39333
|
exports.AXIS_ELEMENT_NAME = void 0;
|
|
39334
39334
|
!function (AXIS_ELEMENT_NAME) {
|
|
39335
|
-
AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break", AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
|
|
39335
|
+
AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.labelHoverOnAxis = "axis-label-hover-on-axis", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break", AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
|
|
39336
39336
|
}(exports.AXIS_ELEMENT_NAME || (exports.AXIS_ELEMENT_NAME = {}));
|
|
39337
39337
|
exports.AxisStateValue = void 0;
|
|
39338
39338
|
!function (AxisStateValue) {
|
|
@@ -39369,6 +39369,26 @@
|
|
|
39369
39369
|
fillOpacity: 1
|
|
39370
39370
|
}
|
|
39371
39371
|
},
|
|
39372
|
+
labelHoverOnAxis: {
|
|
39373
|
+
visible: !1,
|
|
39374
|
+
space: 7,
|
|
39375
|
+
padding: 2,
|
|
39376
|
+
position: 0,
|
|
39377
|
+
autoRotate: !1,
|
|
39378
|
+
textStyle: {
|
|
39379
|
+
fontSize: 12,
|
|
39380
|
+
fill: "red",
|
|
39381
|
+
fontWeight: "normal",
|
|
39382
|
+
fillOpacity: 1
|
|
39383
|
+
},
|
|
39384
|
+
background: {
|
|
39385
|
+
visible: !0,
|
|
39386
|
+
style: {
|
|
39387
|
+
cornerRadius: 2,
|
|
39388
|
+
fill: "black"
|
|
39389
|
+
}
|
|
39390
|
+
}
|
|
39391
|
+
},
|
|
39372
39392
|
tick: {
|
|
39373
39393
|
visible: !0,
|
|
39374
39394
|
inside: !1,
|
|
@@ -40360,7 +40380,17 @@
|
|
|
40360
40380
|
loadLineAxisComponent();
|
|
40361
40381
|
class LineAxis extends AxisBase {
|
|
40362
40382
|
constructor(attributes, options) {
|
|
40363
|
-
|
|
40383
|
+
var _a;
|
|
40384
|
+
if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) {
|
|
40385
|
+
const {
|
|
40386
|
+
padding = 2
|
|
40387
|
+
} = attributes.labelHoverOnAxis,
|
|
40388
|
+
parsedPadding = normalizePadding(padding),
|
|
40389
|
+
toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3],
|
|
40390
|
+
space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding;
|
|
40391
|
+
attributes.labelHoverOnAxis.space = space;
|
|
40392
|
+
}
|
|
40393
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null;
|
|
40364
40394
|
}
|
|
40365
40395
|
_renderInner(container) {
|
|
40366
40396
|
var _a;
|
|
@@ -40422,6 +40452,15 @@
|
|
|
40422
40452
|
}, panel.style));
|
|
40423
40453
|
bgRect.name = exports.AXIS_ELEMENT_NAME.background, bgRect.id = this._getNodeId("background"), bgRect.states = merge({}, DEFAULT_STATES$1, null !== (_a = panel.state) && void 0 !== _a ? _a : {}), axisContainer.insertBefore(bgRect, axisContainer.firstChild);
|
|
40424
40454
|
}
|
|
40455
|
+
const {
|
|
40456
|
+
labelHoverOnAxis: labelHoverOnAxis
|
|
40457
|
+
} = this.attribute;
|
|
40458
|
+
labelHoverOnAxis && labelHoverOnAxis.visible && this.renderLabelHoverOnAxis();
|
|
40459
|
+
}
|
|
40460
|
+
renderLabelHoverOnAxis() {
|
|
40461
|
+
const hoverOnLabelAttributes = this.getLabelHoverOnAxisAttribute(),
|
|
40462
|
+
hoverOnLabel = new Tag(Object.assign({}, hoverOnLabelAttributes));
|
|
40463
|
+
hoverOnLabel.name = exports.AXIS_ELEMENT_NAME.title, hoverOnLabel.id = this._getNodeId("hover-on-label"), this.labelHoverOnAxisGroup = hoverOnLabel, this.axisContainer.add(hoverOnLabel);
|
|
40425
40464
|
}
|
|
40426
40465
|
renderLine(container) {
|
|
40427
40466
|
const {
|
|
@@ -40562,6 +40601,66 @@
|
|
|
40562
40601
|
visible: !0
|
|
40563
40602
|
}, background.style)), attrs;
|
|
40564
40603
|
}
|
|
40604
|
+
getLabelHoverOnAxisAttribute() {
|
|
40605
|
+
var _a, _b;
|
|
40606
|
+
const {
|
|
40607
|
+
orient: orient
|
|
40608
|
+
} = this.attribute,
|
|
40609
|
+
_c = this.attribute.labelHoverOnAxis,
|
|
40610
|
+
{
|
|
40611
|
+
position = 0,
|
|
40612
|
+
space = 4,
|
|
40613
|
+
autoRotate = !0,
|
|
40614
|
+
textStyle = {},
|
|
40615
|
+
background = {},
|
|
40616
|
+
formatMethod: formatMethod,
|
|
40617
|
+
text: textContent = "",
|
|
40618
|
+
maxWidth: maxWidth
|
|
40619
|
+
} = _c,
|
|
40620
|
+
restAttrs = __rest$b(_c, ["position", "space", "autoRotate", "textStyle", "background", "formatMethod", "text", "maxWidth"]),
|
|
40621
|
+
point = this.getTickCoord(0);
|
|
40622
|
+
"bottom" === orient || "top" === orient ? point.x = position : point.y = position;
|
|
40623
|
+
let tickLength = 0;
|
|
40624
|
+
(null === (_a = this.attribute.tick) || void 0 === _a ? void 0 : _a.visible) && !1 === this.attribute.tick.inside && (tickLength = this.attribute.tick.length || 4), (null === (_b = this.attribute.subTick) || void 0 === _b ? void 0 : _b.visible) && !1 === this.attribute.subTick.inside && (tickLength = Math.max(tickLength, this.attribute.subTick.length || 2));
|
|
40625
|
+
const offset = tickLength + 0 + space,
|
|
40626
|
+
labelPoint = this.getVerticalCoord(point, offset, !1),
|
|
40627
|
+
vector = this.getVerticalVector(offset, !1, {
|
|
40628
|
+
x: 0,
|
|
40629
|
+
y: 0
|
|
40630
|
+
});
|
|
40631
|
+
let textBaseline,
|
|
40632
|
+
{
|
|
40633
|
+
angle: angle
|
|
40634
|
+
} = restAttrs,
|
|
40635
|
+
textAlign = "center";
|
|
40636
|
+
if (isNil$1(angle) && autoRotate) {
|
|
40637
|
+
const axisVector = this.getRelativeVector();
|
|
40638
|
+
angle = angleTo(axisVector, [1, 0], !0);
|
|
40639
|
+
const {
|
|
40640
|
+
verticalFactor = 1
|
|
40641
|
+
} = this.attribute;
|
|
40642
|
+
textBaseline = 1 === -1 * verticalFactor ? "bottom" : "top";
|
|
40643
|
+
} else {
|
|
40644
|
+
const {
|
|
40645
|
+
textAlign: textAlign2,
|
|
40646
|
+
textBaseline: textBaseline2
|
|
40647
|
+
} = this.getLabelAlign(vector, !1, textStyle.angle);
|
|
40648
|
+
textAlign = textAlign2, textBaseline = textBaseline2;
|
|
40649
|
+
}
|
|
40650
|
+
const maxTagWidth = maxWidth,
|
|
40651
|
+
text = formatMethod ? formatMethod(textContent) : textContent,
|
|
40652
|
+
attrs = Object.assign(Object.assign(Object.assign({}, labelPoint), restAttrs), {
|
|
40653
|
+
maxWidth: maxTagWidth,
|
|
40654
|
+
textStyle: Object.assign({
|
|
40655
|
+
textAlign: textAlign,
|
|
40656
|
+
textBaseline: textBaseline
|
|
40657
|
+
}, textStyle),
|
|
40658
|
+
text: text
|
|
40659
|
+
});
|
|
40660
|
+
return attrs.angle = angle, background && background.visible && (attrs.panel = Object.assign(Object.assign({
|
|
40661
|
+
visible: !0
|
|
40662
|
+
}, restAttrs.panel), background.style)), attrs;
|
|
40663
|
+
}
|
|
40565
40664
|
getTextBaseline(vector, inside) {
|
|
40566
40665
|
let base = "middle";
|
|
40567
40666
|
const {
|
|
@@ -40752,6 +40851,41 @@
|
|
|
40752
40851
|
}
|
|
40753
40852
|
return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength;
|
|
40754
40853
|
}
|
|
40854
|
+
showLabelHoverOnAxis(position, text) {
|
|
40855
|
+
let adjustPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
40856
|
+
if (this.attribute.labelHoverOnAxis) {
|
|
40857
|
+
const preContainerBounds = this.axisContainer.AABBBounds,
|
|
40858
|
+
preWidth = preContainerBounds.width(),
|
|
40859
|
+
preHeight = preContainerBounds.height(),
|
|
40860
|
+
preX1 = preContainerBounds.x1,
|
|
40861
|
+
preY1 = preContainerBounds.y1,
|
|
40862
|
+
preX2 = preContainerBounds.x2,
|
|
40863
|
+
preY2 = preContainerBounds.y2;
|
|
40864
|
+
if (this.labelHoverOnAxisGroup) {
|
|
40865
|
+
const {
|
|
40866
|
+
formatMethod: formatMethod
|
|
40867
|
+
} = this.attribute.labelHoverOnAxis,
|
|
40868
|
+
textStr = formatMethod ? formatMethod(text) : text;
|
|
40869
|
+
this.labelHoverOnAxisGroup.setAttribute("text", textStr), this.labelHoverOnAxisGroup.setAttribute("visible", !0), this.labelHoverOnAxisGroup.setAttribute("visibleAll", !0), "left" === this.attribute.orient || "right" === this.attribute.orient ? this.labelHoverOnAxisGroup.setAttributes({
|
|
40870
|
+
y: position
|
|
40871
|
+
}) : this.labelHoverOnAxisGroup.setAttributes({
|
|
40872
|
+
x: position
|
|
40873
|
+
});
|
|
40874
|
+
} else this.attribute.labelHoverOnAxis.visible = !0, this.attribute.labelHoverOnAxis.position = position, this.attribute.labelHoverOnAxis.text = text, this.renderLabelHoverOnAxis();
|
|
40875
|
+
if (adjustPosition) {
|
|
40876
|
+
const afterContainerBounds = this.axisContainer.AABBBounds,
|
|
40877
|
+
diffWidth = afterContainerBounds.width() - preWidth,
|
|
40878
|
+
diffHeight = afterContainerBounds.height() - preHeight;
|
|
40879
|
+
diffWidth > 0 && ("top" === this.attribute.orient || "bottom" === this.attribute.orient) && (afterContainerBounds.x1 < preX1 ? this.showLabelHoverOnAxis(position + diffWidth, text, !1) : afterContainerBounds.x2 > preX2 && this.showLabelHoverOnAxis(position - diffWidth, text, !1)), diffHeight > 0 && ("left" === this.attribute.orient || "right" === this.attribute.orient) && (afterContainerBounds.y1 < preY1 ? this.showLabelHoverOnAxis(position + diffHeight, text, !1) : afterContainerBounds.y2 > preY2 && this.showLabelHoverOnAxis(position - diffHeight, text, !1));
|
|
40880
|
+
}
|
|
40881
|
+
}
|
|
40882
|
+
}
|
|
40883
|
+
hideLabelHoverOnAxis() {
|
|
40884
|
+
this.attribute.labelHoverOnAxis && this.labelHoverOnAxisGroup && this.labelHoverOnAxisGroup.setAttributes({
|
|
40885
|
+
visible: !1,
|
|
40886
|
+
visibleAll: !1
|
|
40887
|
+
});
|
|
40888
|
+
}
|
|
40755
40889
|
release() {
|
|
40756
40890
|
super.release(), this._breaks = null;
|
|
40757
40891
|
}
|
|
@@ -52829,7 +52963,7 @@
|
|
|
52829
52963
|
select: !0
|
|
52830
52964
|
};
|
|
52831
52965
|
|
|
52832
|
-
const version = "1.0.
|
|
52966
|
+
const version = "1.0.29";
|
|
52833
52967
|
preLoadAllModule();
|
|
52834
52968
|
if (isBrowserEnv()) {
|
|
52835
52969
|
loadBrowserEnv(container);
|