@visactor/vrender-components 0.19.13-alpha.1 → 0.20.0-alpha.0
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/axis/base.js.map +1 -1
- package/cjs/axis/mixin/circle.js.map +1 -1
- package/cjs/axis/tick-data/cartesian-ticks.d.ts +3 -0
- package/cjs/axis/tick-data/cartesian-ticks.js +13 -0
- package/cjs/axis/tick-data/cartesian-ticks.js.map +1 -0
- package/cjs/axis/tick-data/discrete/polar-angle.d.ts +3 -1
- package/cjs/axis/tick-data/discrete/polar-angle.js +24 -3
- package/cjs/axis/tick-data/discrete/polar-angle.js.map +1 -1
- package/cjs/axis/tick-data/index.d.ts +6 -3
- package/cjs/axis/tick-data/index.js +53 -10
- package/cjs/axis/tick-data/index.js.map +1 -1
- package/cjs/axis/tick-data/polar-ticks.d.ts +3 -0
- package/cjs/axis/tick-data/polar-ticks.js +13 -0
- package/cjs/axis/tick-data/polar-ticks.js.map +1 -0
- package/cjs/axis/tick-data/ticks.d.ts +3 -0
- package/cjs/axis/tick-data/ticks.js +17 -0
- package/cjs/axis/tick-data/ticks.js.map +1 -0
- package/cjs/axis/tick-data/util.d.ts +1 -2
- package/cjs/axis/tick-data/util.js +2 -23
- package/cjs/axis/tick-data/util.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/arc.d.ts +1 -0
- package/cjs/label/arc.js +9 -3
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/data-label-register.d.ts +2 -0
- package/cjs/label/data-label-register.js +16 -0
- package/cjs/label/data-label-register.js.map +1 -0
- package/cjs/label/dataLabel.js +2 -9
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/label/index.d.ts +0 -2
- package/cjs/label/index.js +0 -1
- package/cjs/label/index.js.map +1 -1
- package/cjs/label/line.d.ts +1 -0
- package/cjs/label/line.js +9 -3
- package/cjs/label/line.js.map +1 -1
- package/cjs/label/rect.d.ts +1 -0
- package/cjs/label/rect.js +9 -3
- package/cjs/label/rect.js.map +1 -1
- package/cjs/label/symbol.d.ts +1 -0
- package/cjs/label/symbol.js +8 -2
- package/cjs/label/symbol.js.map +1 -1
- package/cjs/util/matrix.d.ts +0 -1
- package/cjs/util/matrix.js +10 -12
- package/cjs/util/matrix.js.map +1 -1
- package/dist/index.es.js +6570 -6715
- package/es/axis/base.js.map +1 -1
- package/es/axis/mixin/circle.js.map +1 -1
- package/es/axis/tick-data/cartesian-ticks.d.ts +3 -0
- package/es/axis/tick-data/cartesian-ticks.js +10 -0
- package/es/axis/tick-data/cartesian-ticks.js.map +1 -0
- package/es/axis/tick-data/discrete/polar-angle.d.ts +3 -1
- package/es/axis/tick-data/discrete/polar-angle.js +24 -1
- package/es/axis/tick-data/discrete/polar-angle.js.map +1 -1
- package/es/axis/tick-data/index.d.ts +6 -3
- package/es/axis/tick-data/index.js +9 -14
- package/es/axis/tick-data/index.js.map +1 -1
- package/es/axis/tick-data/polar-ticks.d.ts +3 -0
- package/es/axis/tick-data/polar-ticks.js +10 -0
- package/es/axis/tick-data/polar-ticks.js.map +1 -0
- package/es/axis/tick-data/ticks.d.ts +3 -0
- package/es/axis/tick-data/ticks.js +19 -0
- package/es/axis/tick-data/ticks.js.map +1 -0
- package/es/axis/tick-data/util.d.ts +1 -2
- package/es/axis/tick-data/util.js +0 -19
- package/es/axis/tick-data/util.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/arc.d.ts +1 -0
- package/es/label/arc.js +6 -0
- package/es/label/arc.js.map +1 -1
- package/es/label/data-label-register.d.ts +2 -0
- package/es/label/data-label-register.js +8 -0
- package/es/label/data-label-register.js.map +1 -0
- package/es/label/dataLabel.js +2 -21
- package/es/label/dataLabel.js.map +1 -1
- package/es/label/index.d.ts +0 -2
- package/es/label/index.js +0 -4
- package/es/label/index.js.map +1 -1
- package/es/label/line.d.ts +1 -0
- package/es/label/line.js +7 -1
- package/es/label/line.js.map +1 -1
- package/es/label/rect.d.ts +1 -0
- package/es/label/rect.js +7 -1
- package/es/label/rect.js.map +1 -1
- package/es/label/symbol.d.ts +1 -0
- package/es/label/symbol.js +6 -0
- package/es/label/symbol.js.map +1 -1
- package/es/util/matrix.d.ts +0 -1
- package/es/util/matrix.js +5 -8
- package/es/util/matrix.js.map +1 -1
- package/package.json +3 -3
- package/cjs/label/area.d.ts +0 -15
- package/cjs/label/area.js +0 -36
- package/cjs/label/area.js.map +0 -1
- package/cjs/label/line-data.d.ts +0 -13
- package/cjs/label/line-data.js +0 -26
- package/cjs/label/line-data.js.map +0 -1
- package/es/label/area.d.ts +0 -15
- package/es/label/area.js +0 -34
- package/es/label/area.js.map +0 -1
- package/es/label/line-data.d.ts +0 -13
- package/es/label/line-data.js +0 -24
- package/es/label/line-data.js.map +0 -1
package/es/util/matrix.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { crossProduct } from "@visactor/vutils";
|
|
2
|
+
|
|
1
3
|
export function scale(vector, scale) {
|
|
2
4
|
return [ vector[0] * scale, vector[1] * scale ];
|
|
3
5
|
}
|
|
@@ -8,9 +10,8 @@ export function length(vector) {
|
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export function normalize(vector) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return len > 0 && (len = 1 / Math.sqrt(len)), [ vector[0] * len, vector[1] * len ];
|
|
13
|
+
let len = length(vector);
|
|
14
|
+
return len > 0 && (len = 1 / len), [ vector[0] * len, vector[1] * len ];
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export function angle(vector1, vector2) {
|
|
@@ -18,12 +19,8 @@ export function angle(vector1, vector2) {
|
|
|
18
19
|
return Math.acos(Math.min(Math.max(cosine, -1), 1));
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
export function direction(v1, v2) {
|
|
22
|
-
return v1[0] * v2[1] - v2[0] * v1[1];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
22
|
export function angleTo(v1, v2, direct) {
|
|
26
|
-
const ang = angle(v1, v2), angleLargeThanPI =
|
|
23
|
+
const ang = angle(v1, v2), angleLargeThanPI = crossProduct(v1, v2) >= 0;
|
|
27
24
|
return direct ? angleLargeThanPI ? 2 * Math.PI - ang : ang : angleLargeThanPI ? ang : 2 * Math.PI - ang;
|
|
28
25
|
}
|
|
29
26
|
//# sourceMappingURL=matrix.js.map
|
package/es/util/matrix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/matrix.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/util/matrix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOhD,MAAM,UAAU,KAAK,CAAC,MAAe,EAAE,KAAa;IAClD,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;AAChD,CAAC;AAKD,MAAM,UAAU,MAAM,CAAC,MAAe;IACpC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC;IACtB,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAClC,CAAC;AAKD,MAAM,UAAU,SAAS,CAAC,MAAe;IACvC,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACzB,IAAI,GAAG,GAAG,CAAC,EAAE;QACX,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;KACf;IACD,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;AAC5C,CAAC;AAKD,MAAM,UAAU,KAAK,CAAC,OAAgB,EAAE,OAAgB;IACtD,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC;IACzB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC;IAChD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC;AAQD,MAAM,UAAU,OAAO,CAAC,EAAoB,EAAE,EAAoB,EAAE,MAAe;IACjF,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1B,MAAM,gBAAgB,GAAG,YAAY,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,MAAM,EAAE;QACV,IAAI,gBAAgB,EAAE;YACpB,OAAO,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC;SAC1B;QACD,OAAO,GAAG,CAAC;KACZ;IAED,IAAI,gBAAgB,EAAE;QACpB,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3B,CAAC","file":"matrix.js","sourcesContent":["import { crossProduct } from '@visactor/vutils';\n\nexport type Vector2 = [number, number];\n\n/**\n * Scales a vec2 by a scalar number\n */\nexport function scale(vector: Vector2, scale: number): [number, number] {\n return [vector[0] * scale, vector[1] * scale];\n}\n\n/**\n * Calculates the length of a vec2\n */\nexport function length(vector: Vector2) {\n const [x, y] = vector;\n return Math.sqrt(x * x + y * y);\n}\n\n/**\n * Normalize a vec2\n */\nexport function normalize(vector: Vector2) {\n let len = length(vector);\n if (len > 0) {\n len = 1 / len;\n }\n return [vector[0] * len, vector[1] * len];\n}\n\n/**\n * Get the angle between two 2D vectors\n */\nexport function angle(vector1: Vector2, vector2: Vector2) {\n const [x1, y1] = vector1;\n const [x2, y2] = vector2;\n const mag = Math.sqrt((x1 * x1 + y1 * y1) * (x2 * x2 + y2 * y2));\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n\n/**\n * 二维向量 v1 到 v2 的夹角\n * @param v1\n * @param v2\n * @param direct\n */\nexport function angleTo(v1: [number, number], v2: [number, number], direct: boolean): number {\n const ang = angle(v1, v2);\n const angleLargeThanPI = crossProduct(v1, v2) >= 0;\n if (direct) {\n if (angleLargeThanPI) {\n return Math.PI * 2 - ang;\n }\n return ang;\n }\n\n if (angleLargeThanPI) {\n return ang;\n }\n return Math.PI * 2 - ang;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vrender-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0-alpha.0",
|
|
4
4
|
"description": "components library for dp visualization",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@visactor/vrender-core": "0.
|
|
16
|
-
"@visactor/vrender-kits": "0.
|
|
15
|
+
"@visactor/vrender-core": "0.20.0-alpha.0",
|
|
16
|
+
"@visactor/vrender-kits": "0.20.0-alpha.0",
|
|
17
17
|
"@visactor/vutils": "~0.18.9",
|
|
18
18
|
"@visactor/vscale": "~0.18.9"
|
|
19
19
|
},
|
package/cjs/label/area.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { IBoundsLike } from '@visactor/vutils';
|
|
2
|
-
import type { IArea } from '@visactor/vrender-core';
|
|
3
|
-
import type { PointLocationCfg } from '../core/type';
|
|
4
|
-
import type { AreaLabelAttrs } from './type';
|
|
5
|
-
import { LabelBase } from './base';
|
|
6
|
-
export declare class AreaLabel extends LabelBase<AreaLabelAttrs> {
|
|
7
|
-
name: string;
|
|
8
|
-
static defaultAttributes: Partial<AreaLabelAttrs>;
|
|
9
|
-
constructor(attributes: AreaLabelAttrs);
|
|
10
|
-
protected getGraphicBounds(graphic: IArea, point?: Partial<PointLocationCfg>, position?: string): IBoundsLike;
|
|
11
|
-
protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position?: string, offset?: number): {
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
};
|
|
15
|
-
}
|
package/cjs/label/area.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.AreaLabel = void 0;
|
|
6
|
-
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"), base_1 = require("./base"), util_1 = require("./util");
|
|
8
|
-
|
|
9
|
-
class AreaLabel extends base_1.LabelBase {
|
|
10
|
-
constructor(attributes) {
|
|
11
|
-
super((0, vutils_1.merge)({}, AreaLabel.defaultAttributes, attributes)), this.name = "line-label";
|
|
12
|
-
}
|
|
13
|
-
getGraphicBounds(graphic, point = {}, position = "end") {
|
|
14
|
-
var _a;
|
|
15
|
-
if ("area" !== graphic.type) return super.getGraphicBounds(graphic, point);
|
|
16
|
-
const points = (null === (_a = null == graphic ? void 0 : graphic.attribute) || void 0 === _a ? void 0 : _a.points) || [ point ], index = "start" === position ? 0 : points.length - 1;
|
|
17
|
-
return {
|
|
18
|
-
x1: points[index].x,
|
|
19
|
-
x2: points[index].x,
|
|
20
|
-
y1: points[index].y,
|
|
21
|
-
y2: points[index].y
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
labeling(textBounds, graphicBounds, position = "end", offset = 0) {
|
|
25
|
-
return (0, util_1.labelingLineOrArea)(textBounds, graphicBounds, position, offset);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
exports.AreaLabel = AreaLabel, AreaLabel.defaultAttributes = {
|
|
30
|
-
textStyle: {
|
|
31
|
-
fill: "#000"
|
|
32
|
-
},
|
|
33
|
-
position: "end",
|
|
34
|
-
offset: 6
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=area.js.map
|
package/cjs/label/area.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/label/area.ts"],"names":[],"mappings":";;;AACA,6CAAyC;AAIzC,iCAAmC;AACnC,iCAA4C;AAE5C,MAAa,SAAU,SAAQ,gBAAyB;IAWtD,YAAY,UAA0B;QACpC,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAX5D,SAAI,GAAG,YAAY,CAAC;IAYpB,CAAC;IAES,gBAAgB,CAAC,OAAc,EAAE,QAAmC,EAAE,EAAE,QAAQ,GAAG,KAAK;;QAChG,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;YAC3B,OAAO,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SAC/C;QAED,MAAM,MAAM,GAAG,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,0CAAE,MAAM,KAAI,CAAC,KAAK,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3D,OAAO;YACL,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAW;YAC7B,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAW;YAC7B,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAW;YAC7B,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAW;SAC9B,CAAC;IACJ,CAAC;IAES,QAAQ,CAAC,UAAuB,EAAE,aAA0B,EAAE,WAAmB,KAAK,EAAE,MAAM,GAAG,CAAC;QAC1G,OAAO,IAAA,yBAAkB,EAAC,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzE,CAAC;;AAhCH,8BAiCC;AA9BQ,2BAAiB,GAA4B;IAClD,SAAS,EAAE;QACT,IAAI,EAAE,MAAM;KACb;IACD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,CAAC;CACV,CAAC","file":"area.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport { merge } from '@visactor/vutils';\nimport type { IArea } from '@visactor/vrender-core';\nimport type { PointLocationCfg } from '../core/type';\nimport type { AreaLabelAttrs } from './type';\nimport { LabelBase } from './base';\nimport { labelingLineOrArea } from './util';\n\nexport class AreaLabel extends LabelBase<AreaLabelAttrs> {\n name = 'line-label';\n\n static defaultAttributes: Partial<AreaLabelAttrs> = {\n textStyle: {\n fill: '#000'\n },\n position: 'end',\n offset: 6\n };\n\n constructor(attributes: AreaLabelAttrs) {\n super(merge({}, AreaLabel.defaultAttributes, attributes));\n }\n\n protected getGraphicBounds(graphic: IArea, point: Partial<PointLocationCfg> = {}, position = 'end') {\n if (graphic.type !== 'area') {\n return super.getGraphicBounds(graphic, point);\n }\n\n const points = graphic?.attribute?.points || [point];\n const index = position === 'start' ? 0 : points.length - 1;\n return {\n x1: points[index].x as number,\n x2: points[index].x as number,\n y1: points[index].y as number,\n y2: points[index].y as number\n };\n }\n\n protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position: string = 'end', offset = 0) {\n return labelingLineOrArea(textBounds, graphicBounds, position, offset);\n }\n}\n"]}
|
package/cjs/label/line-data.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { IBoundsLike } from '@visactor/vutils';
|
|
2
|
-
import type { LineDataLabelAttrs } from './type';
|
|
3
|
-
import { LabelBase } from './base';
|
|
4
|
-
import type { ComponentOptions } from '../interface';
|
|
5
|
-
export declare class LineDataLabel extends LabelBase<LineDataLabelAttrs> {
|
|
6
|
-
name: string;
|
|
7
|
-
static defaultAttributes: Partial<LineDataLabelAttrs>;
|
|
8
|
-
constructor(attributes: LineDataLabelAttrs, options?: ComponentOptions);
|
|
9
|
-
protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position?: string, offset?: number): {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
};
|
|
13
|
-
}
|
package/cjs/label/line-data.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.LineDataLabel = void 0;
|
|
6
|
-
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"), base_1 = require("./base"), util_1 = require("./util");
|
|
8
|
-
|
|
9
|
-
class LineDataLabel extends base_1.LabelBase {
|
|
10
|
-
constructor(attributes, options) {
|
|
11
|
-
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, LineDataLabel.defaultAttributes, attributes)),
|
|
12
|
-
this.name = "line-data-label";
|
|
13
|
-
}
|
|
14
|
-
labeling(textBounds, graphicBounds, position = "top", offset = 0) {
|
|
15
|
-
return (0, util_1.labelingPoint)(textBounds, graphicBounds, position, offset);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
exports.LineDataLabel = LineDataLabel, LineDataLabel.defaultAttributes = {
|
|
20
|
-
textStyle: {
|
|
21
|
-
fill: "#000"
|
|
22
|
-
},
|
|
23
|
-
position: "top",
|
|
24
|
-
offset: 5
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=line-data.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/label/line-data.ts"],"names":[],"mappings":";;;AACA,6CAAyC;AAEzC,iCAAmC;AACnC,iCAAuC;AAGvC,MAAa,aAAc,SAAQ,gBAA6B;IAW9D,YAAY,UAA8B,EAAE,OAA0B;QACpE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,aAAa,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAXpG,SAAI,GAAG,iBAAiB,CAAC;IAYzB,CAAC;IAES,QAAQ,CAAC,UAAuB,EAAE,aAA0B,EAAE,QAAQ,GAAG,KAAK,EAAE,MAAM,GAAG,CAAC;QAClG,OAAO,IAAA,oBAAa,EAAC,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;;AAjBH,sCAkBC;AAfQ,+BAAiB,GAAgC;IACtD,SAAS,EAAE;QACT,IAAI,EAAE,MAAM;KACb;IACD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,CAAC;CACV,CAAC","file":"line-data.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport { merge } from '@visactor/vutils';\nimport type { LineDataLabelAttrs } from './type';\nimport { LabelBase } from './base';\nimport { labelingPoint } from './util';\nimport type { ComponentOptions } from '../interface';\n\nexport class LineDataLabel extends LabelBase<LineDataLabelAttrs> {\n name = 'line-data-label';\n\n static defaultAttributes: Partial<LineDataLabelAttrs> = {\n textStyle: {\n fill: '#000'\n },\n position: 'top',\n offset: 5\n };\n\n constructor(attributes: LineDataLabelAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, LineDataLabel.defaultAttributes, attributes));\n }\n\n protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position = 'top', offset = 0) {\n return labelingPoint(textBounds, graphicBounds, position, offset);\n }\n}\n"]}
|
package/es/label/area.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { IBoundsLike } from '@visactor/vutils';
|
|
2
|
-
import type { IArea } from '@visactor/vrender-core';
|
|
3
|
-
import type { PointLocationCfg } from '../core/type';
|
|
4
|
-
import type { AreaLabelAttrs } from './type';
|
|
5
|
-
import { LabelBase } from './base';
|
|
6
|
-
export declare class AreaLabel extends LabelBase<AreaLabelAttrs> {
|
|
7
|
-
name: string;
|
|
8
|
-
static defaultAttributes: Partial<AreaLabelAttrs>;
|
|
9
|
-
constructor(attributes: AreaLabelAttrs);
|
|
10
|
-
protected getGraphicBounds(graphic: IArea, point?: Partial<PointLocationCfg>, position?: string): IBoundsLike;
|
|
11
|
-
protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position?: string, offset?: number): {
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
};
|
|
15
|
-
}
|
package/es/label/area.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { merge } from "@visactor/vutils";
|
|
2
|
-
|
|
3
|
-
import { LabelBase } from "./base";
|
|
4
|
-
|
|
5
|
-
import { labelingLineOrArea } from "./util";
|
|
6
|
-
|
|
7
|
-
export class AreaLabel extends LabelBase {
|
|
8
|
-
constructor(attributes) {
|
|
9
|
-
super(merge({}, AreaLabel.defaultAttributes, attributes)), this.name = "line-label";
|
|
10
|
-
}
|
|
11
|
-
getGraphicBounds(graphic, point = {}, position = "end") {
|
|
12
|
-
var _a;
|
|
13
|
-
if ("area" !== graphic.type) return super.getGraphicBounds(graphic, point);
|
|
14
|
-
const points = (null === (_a = null == graphic ? void 0 : graphic.attribute) || void 0 === _a ? void 0 : _a.points) || [ point ], index = "start" === position ? 0 : points.length - 1;
|
|
15
|
-
return {
|
|
16
|
-
x1: points[index].x,
|
|
17
|
-
x2: points[index].x,
|
|
18
|
-
y1: points[index].y,
|
|
19
|
-
y2: points[index].y
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
labeling(textBounds, graphicBounds, position = "end", offset = 0) {
|
|
23
|
-
return labelingLineOrArea(textBounds, graphicBounds, position, offset);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
AreaLabel.defaultAttributes = {
|
|
28
|
-
textStyle: {
|
|
29
|
-
fill: "#000"
|
|
30
|
-
},
|
|
31
|
-
position: "end",
|
|
32
|
-
offset: 6
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=area.js.map
|
package/es/label/area.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/label/area.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIzC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,MAAM,OAAO,SAAU,SAAQ,SAAyB;IAWtD,YAAY,UAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAX5D,SAAI,GAAG,YAAY,CAAC;IAYpB,CAAC;IAES,gBAAgB,CAAC,OAAc,EAAE,QAAmC,EAAE,EAAE,QAAQ,GAAG,KAAK;;QAChG,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;YAC3B,OAAO,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SAC/C;QAED,MAAM,MAAM,GAAG,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,0CAAE,MAAM,KAAI,CAAC,KAAK,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3D,OAAO;YACL,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAW;YAC7B,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAW;YAC7B,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAW;YAC7B,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAW;SAC9B,CAAC;IACJ,CAAC;IAES,QAAQ,CAAC,UAAuB,EAAE,aAA0B,EAAE,WAAmB,KAAK,EAAE,MAAM,GAAG,CAAC;QAC1G,OAAO,kBAAkB,CAAC,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzE,CAAC;;AA7BM,2BAAiB,GAA4B;IAClD,SAAS,EAAE;QACT,IAAI,EAAE,MAAM;KACb;IACD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,CAAC;CACV,CAAC","file":"area.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport { merge } from '@visactor/vutils';\nimport type { IArea } from '@visactor/vrender-core';\nimport type { PointLocationCfg } from '../core/type';\nimport type { AreaLabelAttrs } from './type';\nimport { LabelBase } from './base';\nimport { labelingLineOrArea } from './util';\n\nexport class AreaLabel extends LabelBase<AreaLabelAttrs> {\n name = 'line-label';\n\n static defaultAttributes: Partial<AreaLabelAttrs> = {\n textStyle: {\n fill: '#000'\n },\n position: 'end',\n offset: 6\n };\n\n constructor(attributes: AreaLabelAttrs) {\n super(merge({}, AreaLabel.defaultAttributes, attributes));\n }\n\n protected getGraphicBounds(graphic: IArea, point: Partial<PointLocationCfg> = {}, position = 'end') {\n if (graphic.type !== 'area') {\n return super.getGraphicBounds(graphic, point);\n }\n\n const points = graphic?.attribute?.points || [point];\n const index = position === 'start' ? 0 : points.length - 1;\n return {\n x1: points[index].x as number,\n x2: points[index].x as number,\n y1: points[index].y as number,\n y2: points[index].y as number\n };\n }\n\n protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position: string = 'end', offset = 0) {\n return labelingLineOrArea(textBounds, graphicBounds, position, offset);\n }\n}\n"]}
|
package/es/label/line-data.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { IBoundsLike } from '@visactor/vutils';
|
|
2
|
-
import type { LineDataLabelAttrs } from './type';
|
|
3
|
-
import { LabelBase } from './base';
|
|
4
|
-
import type { ComponentOptions } from '../interface';
|
|
5
|
-
export declare class LineDataLabel extends LabelBase<LineDataLabelAttrs> {
|
|
6
|
-
name: string;
|
|
7
|
-
static defaultAttributes: Partial<LineDataLabelAttrs>;
|
|
8
|
-
constructor(attributes: LineDataLabelAttrs, options?: ComponentOptions);
|
|
9
|
-
protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position?: string, offset?: number): {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
};
|
|
13
|
-
}
|
package/es/label/line-data.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { merge } from "@visactor/vutils";
|
|
2
|
-
|
|
3
|
-
import { LabelBase } from "./base";
|
|
4
|
-
|
|
5
|
-
import { labelingPoint } from "./util";
|
|
6
|
-
|
|
7
|
-
export class LineDataLabel extends LabelBase {
|
|
8
|
-
constructor(attributes, options) {
|
|
9
|
-
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, LineDataLabel.defaultAttributes, attributes)),
|
|
10
|
-
this.name = "line-data-label";
|
|
11
|
-
}
|
|
12
|
-
labeling(textBounds, graphicBounds, position = "top", offset = 0) {
|
|
13
|
-
return labelingPoint(textBounds, graphicBounds, position, offset);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
LineDataLabel.defaultAttributes = {
|
|
18
|
-
textStyle: {
|
|
19
|
-
fill: "#000"
|
|
20
|
-
},
|
|
21
|
-
position: "top",
|
|
22
|
-
offset: 5
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=line-data.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/label/line-data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAGvC,MAAM,OAAO,aAAc,SAAQ,SAA6B;IAW9D,YAAY,UAA8B,EAAE,OAA0B;QACpE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,aAAa,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAXpG,SAAI,GAAG,iBAAiB,CAAC;IAYzB,CAAC;IAES,QAAQ,CAAC,UAAuB,EAAE,aAA0B,EAAE,QAAQ,GAAG,KAAK,EAAE,MAAM,GAAG,CAAC;QAClG,OAAO,aAAa,CAAC,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;;AAdM,+BAAiB,GAAgC;IACtD,SAAS,EAAE;QACT,IAAI,EAAE,MAAM;KACb;IACD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,CAAC;CACV,CAAC","file":"line-data.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport { merge } from '@visactor/vutils';\nimport type { LineDataLabelAttrs } from './type';\nimport { LabelBase } from './base';\nimport { labelingPoint } from './util';\nimport type { ComponentOptions } from '../interface';\n\nexport class LineDataLabel extends LabelBase<LineDataLabelAttrs> {\n name = 'line-data-label';\n\n static defaultAttributes: Partial<LineDataLabelAttrs> = {\n textStyle: {\n fill: '#000'\n },\n position: 'top',\n offset: 5\n };\n\n constructor(attributes: LineDataLabelAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, LineDataLabel.defaultAttributes, attributes));\n }\n\n protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position = 'top', offset = 0) {\n return labelingPoint(textBounds, graphicBounds, position, offset);\n }\n}\n"]}
|