@antv/g2 4.2.4 → 4.2.5
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/dist/g2.min.js +1 -1
- package/dist/g2.min.js.map +1 -1
- package/esm/animate/animation/sector-path-update.js +3 -2
- package/esm/animate/animation/sector-path-update.js.map +1 -1
- package/esm/chart/controller/annotation.js +0 -1
- package/esm/chart/controller/annotation.js.map +1 -1
- package/esm/chart/controller/slider.js +4 -4
- package/esm/chart/controller/slider.js.map +1 -1
- package/esm/chart/controller/tooltip.js +1 -7
- package/esm/chart/controller/tooltip.js.map +1 -1
- package/esm/core.d.ts +1 -1
- package/esm/core.js +1 -1
- package/esm/core.js.map +1 -1
- package/esm/geometry/shape/area/index.js +1 -0
- package/esm/geometry/shape/area/index.js.map +1 -1
- package/esm/geometry/shape/area/smooth.js +1 -0
- package/esm/geometry/shape/area/smooth.js.map +1 -1
- package/esm/geometry/shape/interval/index.js +3 -1
- package/esm/geometry/shape/interval/index.js.map +1 -1
- package/esm/util/coordinate.js.map +1 -1
- package/lib/animate/animation/sector-path-update.js +3 -2
- package/lib/animate/animation/sector-path-update.js.map +1 -1
- package/lib/chart/controller/annotation.js +0 -1
- package/lib/chart/controller/annotation.js.map +1 -1
- package/lib/chart/controller/slider.js +4 -4
- package/lib/chart/controller/slider.js.map +1 -1
- package/lib/chart/controller/tooltip.js +0 -6
- package/lib/chart/controller/tooltip.js.map +1 -1
- package/lib/core.d.ts +1 -1
- package/lib/core.js +1 -1
- package/lib/core.js.map +1 -1
- package/lib/geometry/shape/area/index.js +1 -0
- package/lib/geometry/shape/area/index.js.map +1 -1
- package/lib/geometry/shape/area/smooth.js +1 -0
- package/lib/geometry/shape/area/smooth.js.map +1 -1
- package/lib/geometry/shape/interval/index.js +3 -1
- package/lib/geometry/shape/interval/index.js.map +1 -1
- package/lib/util/coordinate.js.map +1 -1
- package/package.json +1 -1
- package/src/animate/animation/sector-path-update.ts +3 -2
- package/src/chart/controller/annotation.ts +1 -1
- package/src/chart/controller/slider.ts +4 -4
- package/src/chart/controller/tooltip.ts +1 -7
- package/src/core.ts +1 -1
- package/src/geometry/shape/area/index.ts +1 -0
- package/src/geometry/shape/area/smooth.ts +1 -0
- package/src/geometry/shape/interval/index.ts +3 -1
- package/src/util/coordinate.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smooth.js","sourceRoot":"","sources":["../../../../src/geometry/shape/area/smooth.ts"],"names":[],"mappings":";;AAGA,gCAAwC;AACxC,+BAAsD;AAEtD;;GAEG;AACH,IAAA,oBAAa,EAAC,MAAM,EAAE,QAAQ,EAAE;IAC9B,IAAI,EAAJ,UAAK,GAAc,EAAE,SAAiB;QACpC,IAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,IAAM,KAAK,GAAG,IAAA,oBAAa,EAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAA,oBAAa,EAAC,UAAU,CAAC,CAAC,CAAC;QAC/E,IAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC;YAC/B,IAAI,EAAE,MAAM;YACZ,KAAK,OAAA;YACL,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;IACD,SAAS,EAAT,UAAU,SAAyB;QACzB,IAAA,KAAK,GAAK,SAAS,MAAd,CAAe;QAC5B,OAAO;YACL,MAAM,EAAE,UAAC,CAAS,EAAE,CAAS,EAAE,CAAe;gBAAf,kBAAA,EAAA,OAAe;gBAC5C,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,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C,CAAC;YACrG,CAAC;YACD,KAAK,EAAE;gBACL,CAAC,EAAE,CAAC;gBACJ,IAAI,EAAE,KAAK;gBACX,WAAW,EAAE,CAAC;aACf;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { IGroup } from '../../../dependents';\nimport { ShapeInfo, ShapeMarkerCfg } from '../../../interface';\n\nimport { registerShape } from '../base';\nimport { getConstraint, getShapeAttrs } from './util';\n\n/**\n * 填充的平滑曲面图\n */\nregisterShape('area', 'smooth', {\n draw(cfg: ShapeInfo, container: IGroup) {\n const coordinate = this.coordinate;\n const attrs = getShapeAttrs(cfg, false, true, this, getConstraint(coordinate));\n const shape = container.addShape({\n type: 'path',\n attrs,\n name: 'area',\n });\n\n return shape;\n },\n getMarker(markerCfg: ShapeMarkerCfg) {\n const { color } = markerCfg;\n return {\n symbol: (x: number, y: number, r: number = 5.5) => {\n return [['M', x - r, y - 4], ['L', x + r, y - 4], ['L', x + r, y + 4], ['L', x - r, y + 4], ['Z']];\n },\n style: {\n r: 5,\n fill: color,\n fillOpacity: 1,\n },\n };\n },\n});\n"]}
|
|
@@ -19,7 +19,9 @@ var IntervalShapeFactory = (0, base_1.registerShapeFactory)('interval', {
|
|
|
19
19
|
var group = container;
|
|
20
20
|
var backgroundCfg = cfg === null || cfg === void 0 ? void 0 : cfg.background;
|
|
21
21
|
if (backgroundCfg) {
|
|
22
|
-
group = container.addGroup(
|
|
22
|
+
group = container.addGroup({
|
|
23
|
+
name: 'interval-group',
|
|
24
|
+
});
|
|
23
25
|
var backgroundStyle = (0, get_style_1.getBackgroundRectStyle)(cfg);
|
|
24
26
|
var backgroundPath = (0, util_1.getBackgroundRectPath)(cfg, this.parsePoints(cfg.points), this.coordinate);
|
|
25
27
|
group.addShape('path', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/geometry/shape/interval/index.ts"],"names":[],"mappings":";;;AAGA,gCAA8D;AAC9D,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U,SAAyB;QACzB,IAAA,KAAK,GAAgB,SAAS,MAAzB,EAAE,SAAS,GAAK,SAAS,UAAd,CAAe;QACvC,IAAI,SAAS,EAAE;YACb,OAAO;gBACL,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE;oBACL,CAAC,EAAE,GAAG;oBACN,IAAI,EAAE,KAAK;iBACZ;aACF,CAAC;SACH;QAED,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE;gBACL,CAAC,EAAE,CAAC;gBACJ,IAAI,EAAE,KAAK;aACZ;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,kBAAe,oBAAoB,CAAC","sourcesContent":["import { IGroup } from '../../../dependents';\nimport { Point, ShapeInfo, ShapeMarkerCfg, ShapePoint } from '../../../interface';\n\nimport { registerShape, registerShapeFactory } from '../base';\nimport { BACKGROUND_SHAPE } from '../constant';\nimport { getBackgroundRectStyle, getStyle } from '../util/get-style';\nimport { getBackgroundRectPath, getIntervalRectPath, getRectPoints, getRectWithCornerRadius } from './util';\n\n/** Interval 的 shape 工厂 */\nconst IntervalShapeFactory = registerShapeFactory('interval', {\n defaultShapeType: 'rect',\n getDefaultPoints(pointInfo: ShapePoint): Point[] {\n return getRectPoints(pointInfo);\n },\n});\n\n/** Inerval 默认 shape,填充的矩形 */\nregisterShape('interval', 'rect', {\n draw(cfg: ShapeInfo, container: IGroup) {\n const style = getStyle(cfg, false, true);\n let group = container;\n\n const backgroundCfg = cfg?.background;\n if (backgroundCfg) {\n group = container.addGroup({\n name: 'interval-group',\n });\n const backgroundStyle = getBackgroundRectStyle(cfg);\n const backgroundPath = getBackgroundRectPath(cfg, this.parsePoints(cfg.points) as Point[], this.coordinate);\n group.addShape('path', {\n attrs: {\n ...backgroundStyle,\n path: backgroundPath,\n },\n zIndex: -1,\n name: BACKGROUND_SHAPE,\n });\n }\n\n let path;\n if (style.radius && this.coordinate.isRect) {\n path = getRectWithCornerRadius(this.parsePoints(cfg.points), this.coordinate, style.radius);\n } else {\n path = this.parsePath(getIntervalRectPath(cfg.points as Point[], style.lineCap, this.coordinate));\n }\n\n const shape = group.addShape('path', {\n attrs: {\n ...style,\n path,\n },\n name: 'interval',\n });\n\n return backgroundCfg ? group : shape;\n },\n getMarker(markerCfg: ShapeMarkerCfg) {\n const { color, isInPolar } = markerCfg;\n if (isInPolar) {\n return {\n symbol: 'circle',\n style: {\n r: 4.5,\n fill: color,\n },\n };\n }\n\n return {\n symbol: 'square',\n style: {\n r: 4,\n fill: color,\n },\n };\n },\n});\n\nexport default IntervalShapeFactory;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinate.js","sourceRoot":"","sources":["../../src/util/coordinate.ts"],"names":[],"mappings":";;;AAEA,uCAA2C;AAC3C,mCAAqC;AACrC,+BAA8B;AAE9B;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,UAAU;IAC5C,IAAI,UAAU,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE;QAClD,kBAAkB;QAClB,OAAO,CAAC,UAAU,CAAC,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;KAC/E;IAED,QAAQ;IACR,IAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACjD,IAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/C,yCAAyC;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;A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M,GAAG,CAAC;SAC5B;KACF,CAAC;AACJ,CAAC;AAvDD,oDAuDC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,UAAsB,EAAE,MAAU;IAAV,uBAAA,EAAA,UAAU;IAC1D,IAAA,KAAK,GAAU,UAAU,MAApB,EAAE,GAAG,GAAK,UAAU,IAAf,CAAgB;IAClC,IAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC;IACpC,IAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IACtC,IAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACtC,IAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAEtC,OAAO,WAAI,CAAC,SAAS,CAAC,IAAI,GAAG,MAAM,EAAE,IAAI,GAAG,MAAM,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;AACrG,CAAC;AARD,8CAQC","sourcesContent":["import { Coordinate } from '../dependents';\nimport { Point } from '../interface';\nimport { getSectorPath } from './graphics';\nimport { isBetween } from './helper';\nimport { BBox } from './bbox';\n\n/**\n * @ignore\n * Gets x dimension length\n * @param coordinate\n * @returns x dimension length\n */\nexport function getXDimensionLength(coordinate): number {\n if (coordinate.isPolar && !coordinate.isTransposed) {\n // 极坐标系下 width 为弧长\n return (coordinate.endAngle - coordinate.startAngle) * coordinate.getRadius();\n }\n\n // 直角坐标系\n const start = coordinate.convert({ x: 0, y: 0 });\n const end = coordinate.convert({ x: 1, y: 0 });\n // 坐标系有可能发生 transpose 等变换,所有通过两点之间的距离进行计算\n return Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2));\n}\n\n/**\n * @ignore\n * Determines whether full circle is\n * @param coordinate\n * @returns true if full circle\n */\nexport function isFullCircle(coordinate: Coordinate): boolean {\n if (coordinate.isPolar) {\n const { startAngle, endAngle } = coordinate;\n return endAngle - startAngle === Math.PI * 2;\n }\n return false;\n}\n\n/**\n * @ignore\n * 获取当前点到坐标系圆心的距离\n * @param coordinate 坐标系\n * @param point 当前点\n * @returns distance to center\n */\nexport function getDistanceToCenter(coordinate: Coordinate, point: Point): number {\n const center = coordinate.getCenter() as Point;\n return Math.sqrt((point.x - center.x) ** 2 + (point.y - center.y) ** 2);\n}\n\n/**\n * @ignore\n * 坐标点是否在坐标系中\n * @param coordinate\n * @param point\n */\nexport function isPointInCoordinate(coordinate: Coordinate, point: Point) {\n let result = false;\n\n if (coordinate) {\n if (coordinate.type === 'theta') {\n const { start, end } = coordinate;\n result = isBetween(point.x, start.x, end.x) && isBetween(point.y, start.y, end.y);\n } else {\n const invertPoint = coordinate.invert(point);\n\n result = isBetween(invertPoint.x, 0, 1) && isBetween(invertPoint.y, 0, 1);\n }\n }\n\n return result;\n}\n\n/**\n * @ignore\n * 获取点到圆心的连线与水平方向的夹角\n */\nexport function getAngleByPoint(coordinate: Coordinate, point: Point): number {\n const center = coordinate.getCenter();\n return Math.atan2(point.y - center.y, point.x - center.x);\n}\n\n/**\n * @ignore\n * 获取同坐标系范围相同的剪切区域\n * @param coordinate\n * @returns\n */\nexport function getCoordinateClipCfg(coordinate: Coordinate, margin: number = 0) {\n const { start, end } = coordinate;\n const width = coordinate.getWidth();\n const height = coordinate.getHeight();\n\n if (coordinate.isPolar) {\n const { startAngle, endAngle } = coordinate;\n const center = coordinate.getCenter();\n const radius = coordinate.getRadius();\n\n return {\n type: 'path',\n startState: {\n path: getSectorPath(center.x, center.y, radius + margin, startAngle, startAngle),\n },\n endState: (ratio) => {\n const diff = (endAngle - startAngle) * ratio + startAngle;\n const path = getSectorPath(center.x, center.y, radius + margin, startAngle, diff);\n return {\n path,\n };\n },\n attrs: {\n path: getSectorPath(center.x, center.y, radius + margin, startAngle, endAngle),\n },\n };\n }\n\n let endState;\n if (coordinate.isTransposed) {\n endState = {\n height: height + margin * 2,\n };\n } else {\n endState = {\n width: width + margin * 2,\n };\n }\n\n return {\n type: 'rect',\n startState: {\n x: start.x - margin,\n y: end.y - margin,\n width: coordinate.isTransposed ? width + margin * 2 : 0,\n height: coordinate.isTransposed ? 0 : height + margin * 2,\n },\n endState,\n attrs: {\n x: start.x - margin,\n y: end.y - margin,\n width: width + margin * 2,\n height: height + margin * 2,\n },\n };\n}\n\n/**\n * 获取坐标系范围的 BBox\n * @param coordinate\n * @param margin\n */\nexport function getCoordinateBBox(coordinate: Coordinate, margin = 0) {\n const { start, end } = coordinate;\n const width = coordinate.getWidth();\n const height = coordinate.getHeight();\n const minX = Math.min(start.x, end.x);\n const minY = Math.min(start.y, end.y);\n\n return BBox.fromRange(minX - margin, minY - margin, minX + width + margin, minY + height + margin);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"coordinate.js","sourceRoot":"","sources":["../../src/util/coordinate.ts"],"names":[],"mappings":";;;AAEA,uCAA2C;AAC3C,mCAAqC;AACrC,+BAA8B;AAE9B;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,UAAU;IAC5C,IAAI,UAAU,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE;QAClD,kBAAkB;QAClB,OAAO,CAAC,UAAU,CAAC,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;KAC/E;IAED,QAAQ;IACR,IAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACjD,IAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/C,yCAAyC;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CA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,EAAE,KAAK,CAAC,CAAC,GAAG,MAAM;YACnB,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,MAAM;YACjB,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,CAAC;YACzB,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC;SAC5B;KACF,CAAC;AACJ,CAAC;AAvDD,oDAuDC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,UAAsB,EAAE,MAAU;IAAV,uBAAA,EAAA,UAAU;IAC1D,IAAA,KAAK,GAAU,UAAU,MAApB,EAAE,GAAG,GAAK,UAAU,IAAf,CAAgB;IAClC,IAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC;IACpC,IAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IACtC,IAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACtC,IAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAEtC,OAAO,WAAI,CAAC,SAAS,CAAC,IAAI,GAAG,MAAM,EAAE,IAAI,GAAG,MAAM,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;AACrG,CAAC;AARD,8CAQC","sourcesContent":["import { Coordinate } from '../dependents';\nimport { Point } from '../interface';\nimport { getSectorPath } from './graphics';\nimport { isBetween } from './helper';\nimport { BBox } from './bbox';\n\n/**\n * @ignore\n * Gets x dimension length\n * @param coordinate\n * @returns x dimension length\n */\nexport function getXDimensionLength(coordinate): number {\n if (coordinate.isPolar && !coordinate.isTransposed) {\n // 极坐标系下 width 为弧长\n return (coordinate.endAngle - coordinate.startAngle) * coordinate.getRadius();\n }\n\n // 直角坐标系\n const start = coordinate.convert({ x: 0, y: 0 });\n const end = coordinate.convert({ x: 1, y: 0 });\n // 坐标系有可能发生 transpose 等变换,所有通过两点之间的距离进行计算\n return Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2));\n}\n\n/**\n * @ignore\n * Determines whether full circle is\n * @param coordinate\n * @returns true if full circle\n */\nexport function isFullCircle(coordinate: Coordinate): boolean {\n if (coordinate.isPolar) {\n const { startAngle, endAngle } = coordinate;\n return endAngle - startAngle === Math.PI * 2;\n }\n return false;\n}\n\n/**\n * @ignore\n * 获取当前点到坐标系圆心的距离\n * @param coordinate 坐标系\n * @param point 当前点\n * @returns distance to center\n */\nexport function getDistanceToCenter(coordinate: Coordinate, point: Point): number {\n const center = coordinate.getCenter() as Point;\n return Math.sqrt((point.x - center.x) ** 2 + (point.y - center.y) ** 2);\n}\n\n/**\n * @ignore\n * 坐标点是否在坐标系中\n * @param coordinate\n * @param point\n */\nexport function isPointInCoordinate(coordinate: Coordinate, point: Point) {\n let result = false;\n\n if (coordinate) {\n if (coordinate.type === 'theta') {\n const { start, end } = coordinate;\n result = isBetween(point.x, start.x, end.x) && isBetween(point.y, start.y, end.y);\n } else {\n const invertPoint = coordinate.invert(point);\n \n result = isBetween(invertPoint.x, 0, 1) && isBetween(invertPoint.y, 0, 1);\n }\n }\n\n return result;\n}\n\n/**\n * @ignore\n * 获取点到圆心的连线与水平方向的夹角\n */\nexport function getAngleByPoint(coordinate: Coordinate, point: Point): number {\n const center = coordinate.getCenter();\n return Math.atan2(point.y - center.y, point.x - center.x);\n}\n\n/**\n * @ignore\n * 获取同坐标系范围相同的剪切区域\n * @param coordinate\n * @returns\n */\nexport function getCoordinateClipCfg(coordinate: Coordinate, margin: number = 0) {\n const { start, end } = coordinate;\n const width = coordinate.getWidth();\n const height = coordinate.getHeight();\n\n if (coordinate.isPolar) {\n const { startAngle, endAngle } = coordinate;\n const center = coordinate.getCenter();\n const radius = coordinate.getRadius();\n\n return {\n type: 'path',\n startState: {\n path: getSectorPath(center.x, center.y, radius + margin, startAngle, startAngle),\n },\n endState: (ratio) => {\n const diff = (endAngle - startAngle) * ratio + startAngle;\n const path = getSectorPath(center.x, center.y, radius + margin, startAngle, diff);\n return {\n path,\n };\n },\n attrs: {\n path: getSectorPath(center.x, center.y, radius + margin, startAngle, endAngle),\n },\n };\n }\n\n let endState;\n if (coordinate.isTransposed) {\n endState = {\n height: height + margin * 2,\n };\n } else {\n endState = {\n width: width + margin * 2,\n };\n }\n\n return {\n type: 'rect',\n startState: {\n x: start.x - margin,\n y: end.y - margin,\n width: coordinate.isTransposed ? width + margin * 2 : 0,\n height: coordinate.isTransposed ? 0 : height + margin * 2,\n },\n endState,\n attrs: {\n x: start.x - margin,\n y: end.y - margin,\n width: width + margin * 2,\n height: height + margin * 2,\n },\n };\n}\n\n/**\n * 获取坐标系范围的 BBox\n * @param coordinate\n * @param margin\n */\nexport function getCoordinateBBox(coordinate: Coordinate, margin = 0) {\n const { start, end } = coordinate;\n const width = coordinate.getWidth();\n const height = coordinate.getHeight();\n const minX = Math.min(start.x, end.x);\n const minY = Math.min(start.y, end.y);\n\n return BBox.fromRange(minX - margin, minY - margin, minX + width + margin, minY + height + margin);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import { AnimateExtraCfg } from '../interface';
|
|
|
8
8
|
import { getArcPath, getSectorPath } from '../../util/graphics';
|
|
9
9
|
|
|
10
10
|
function getAngle(startPoint: number[], arcPath: PathCommand) {
|
|
11
|
-
let { startAngle, endAngle
|
|
11
|
+
let { startAngle, endAngle } = getArcParams(startPoint, arcPath);
|
|
12
12
|
|
|
13
13
|
if (!isNumberEqual(startAngle, -Math.PI * 0.5) && startAngle < -Math.PI * 0.5) {
|
|
14
14
|
startAngle += Math.PI * 2;
|
|
@@ -26,7 +26,8 @@ function getAngle(startPoint: number[], arcPath: PathCommand) {
|
|
|
26
26
|
startAngle = Math.PI * -0.5;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
// 当 startAngle, endAngle 接近相等时,不进行 endAngle = Math.PI * 1.5 防止变化从整个圆开始
|
|
30
|
+
if (isNumberEqual(endAngle, Math.PI * -0.5) && !isNumberEqual(startAngle, endAngle)) {
|
|
30
31
|
endAngle = Math.PI * 1.5;
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -496,7 +496,7 @@ export default class Annotation extends Controller<BaseOption[]> {
|
|
|
496
496
|
if (isNil(option)) {
|
|
497
497
|
return null;
|
|
498
498
|
}
|
|
499
|
-
const { start, end, position } = option
|
|
499
|
+
const { start, end, position } = option;
|
|
500
500
|
const sp = this.parsePosition(start);
|
|
501
501
|
const ep = this.parsePosition(end);
|
|
502
502
|
const textPoint = this.parsePosition(position);
|
|
@@ -288,8 +288,8 @@ export default class Slider extends Controller<SliderOption> {
|
|
|
288
288
|
|
|
289
289
|
const xTickCount = size(xValues);
|
|
290
290
|
|
|
291
|
-
const minIndex = Math.
|
|
292
|
-
const maxIndex = Math.
|
|
291
|
+
const minIndex = Math.round(min * (xTickCount - 1));
|
|
292
|
+
const maxIndex = Math.round(max * (xTickCount - 1));
|
|
293
293
|
|
|
294
294
|
let minText = get(xValues, [minIndex]);
|
|
295
295
|
let maxText = get(xValues, [maxIndex]);
|
|
@@ -327,8 +327,8 @@ export default class Slider extends Controller<SliderOption> {
|
|
|
327
327
|
const xValues = isHorizontal ? xScaleValues : xScaleValues.reverse();
|
|
328
328
|
const xTickCount = size(xValues);
|
|
329
329
|
|
|
330
|
-
const minIndex = Math.
|
|
331
|
-
const maxIndex = Math.
|
|
330
|
+
const minIndex = Math.round(min * (xTickCount - 1));
|
|
331
|
+
const maxIndex = Math.round(max * (xTickCount - 1));
|
|
332
332
|
|
|
333
333
|
// 增加 x 轴的过滤器
|
|
334
334
|
this.view.filter(xScale.field, (value: any, datum: Datum) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { deepMix, find, get, isEqual, isFunction, mix, isString, isBoolean, flatten, isArray } from '@antv/util';
|
|
2
2
|
import { Crosshair, HtmlTooltip, IGroup } from '../../dependents';
|
|
3
3
|
import { Point, TooltipItem, TooltipOption } from '../../interface';
|
|
4
|
-
import { getAngleByPoint, getDistanceToCenter,
|
|
4
|
+
import { getAngleByPoint, getDistanceToCenter, getCoordinateClipCfg } from '../../util/coordinate';
|
|
5
5
|
import { polarToCartesian } from '../../util/graphics';
|
|
6
6
|
import { findItemsFromView } from '../../util/tooltip';
|
|
7
7
|
import { BBox } from '../../util/bbox';
|
|
@@ -492,9 +492,6 @@ export default class Tooltip extends Controller<TooltipOption> {
|
|
|
492
492
|
// 渲染 x 轴上的 tooltip 辅助线
|
|
493
493
|
private renderXCrosshairs(point: Point, tooltipCfg) {
|
|
494
494
|
const coordinate = this.getViewWithGeometry(this.view).getCoordinate();
|
|
495
|
-
if (!isPointInCoordinate(coordinate, point)) {
|
|
496
|
-
return;
|
|
497
|
-
}
|
|
498
495
|
let start;
|
|
499
496
|
let end;
|
|
500
497
|
if (coordinate.isRect) {
|
|
@@ -552,9 +549,6 @@ export default class Tooltip extends Controller<TooltipOption> {
|
|
|
552
549
|
// 渲染 y 轴上的辅助线
|
|
553
550
|
private renderYCrosshairs(point: Point, tooltipCfg) {
|
|
554
551
|
const coordinate = this.getViewWithGeometry(this.view).getCoordinate();
|
|
555
|
-
if (!isPointInCoordinate(coordinate, point)) {
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
552
|
let cfg;
|
|
559
553
|
let type;
|
|
560
554
|
if (coordinate.isRect) {
|
package/src/core.ts
CHANGED
|
@@ -22,7 +22,9 @@ registerShape('interval', 'rect', {
|
|
|
22
22
|
|
|
23
23
|
const backgroundCfg = cfg?.background;
|
|
24
24
|
if (backgroundCfg) {
|
|
25
|
-
group = container.addGroup(
|
|
25
|
+
group = container.addGroup({
|
|
26
|
+
name: 'interval-group',
|
|
27
|
+
});
|
|
26
28
|
const backgroundStyle = getBackgroundRectStyle(cfg);
|
|
27
29
|
const backgroundPath = getBackgroundRectPath(cfg, this.parsePoints(cfg.points) as Point[], this.coordinate);
|
|
28
30
|
group.addShape('path', {
|
package/src/util/coordinate.ts
CHANGED
|
@@ -64,7 +64,7 @@ export function isPointInCoordinate(coordinate: Coordinate, point: Point) {
|
|
|
64
64
|
result = isBetween(point.x, start.x, end.x) && isBetween(point.y, start.y, end.y);
|
|
65
65
|
} else {
|
|
66
66
|
const invertPoint = coordinate.invert(point);
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
result = isBetween(invertPoint.x, 0, 1) && isBetween(invertPoint.y, 0, 1);
|
|
69
69
|
}
|
|
70
70
|
}
|