@antv/g2 5.1.7 → 5.1.8-beta.1

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.
Files changed (185) hide show
  1. package/dist/g2.full.min.js +1 -1
  2. package/dist/g2.lite.min.js +1 -1
  3. package/dist/g2.min.js +1 -1
  4. package/esm/component/axis.js +1 -5
  5. package/esm/component/axis.js.map +1 -1
  6. package/esm/component/index.d.ts +0 -1
  7. package/esm/component/index.js +0 -1
  8. package/esm/component/index.js.map +1 -1
  9. package/esm/component/legendContinuous.js +1 -1
  10. package/esm/component/legendContinuous.js.map +1 -1
  11. package/esm/coordinate/index.d.ts +0 -2
  12. package/esm/coordinate/index.js +0 -1
  13. package/esm/coordinate/index.js.map +1 -1
  14. package/esm/exports.d.ts +5 -1
  15. package/esm/exports.js +3 -0
  16. package/esm/exports.js.map +1 -1
  17. package/esm/index.d.ts +114 -114
  18. package/esm/index.js +2 -2
  19. package/esm/index.js.map +1 -1
  20. package/esm/lib/builtinlib.d.ts +7 -7
  21. package/esm/lib/core.d.ts +32 -32
  22. package/esm/lib/index.d.ts +0 -1
  23. package/esm/lib/index.js +0 -1
  24. package/esm/lib/index.js.map +1 -1
  25. package/esm/lib/lite.d.ts +18 -18
  26. package/esm/lib/std.d.ts +56 -56
  27. package/esm/mark/index.d.ts +0 -3
  28. package/esm/mark/index.js +0 -3
  29. package/esm/mark/index.js.map +1 -1
  30. package/esm/mark/liquid.js +2 -1
  31. package/esm/mark/liquid.js.map +1 -1
  32. package/esm/runtime/component.js +1 -3
  33. package/esm/runtime/component.js.map +1 -1
  34. package/esm/runtime/types/component.d.ts +1 -6
  35. package/esm/shape/index.d.ts +0 -4
  36. package/esm/shape/index.js +0 -4
  37. package/esm/shape/index.js.map +1 -1
  38. package/esm/spec/coordinate.d.ts +1 -4
  39. package/esm/spec/mark.d.ts +1 -3
  40. package/esm/transform/filter.js +3 -1
  41. package/esm/transform/filter.js.map +1 -1
  42. package/esm/transform/maybeTitle.js +6 -1
  43. package/esm/transform/maybeTitle.js.map +1 -1
  44. package/esm/utils/dateFormat.d.ts +1 -0
  45. package/esm/utils/dateFormat.js +18 -0
  46. package/esm/utils/dateFormat.js.map +1 -0
  47. package/esm/utils/number.d.ts +4 -0
  48. package/esm/utils/number.js +8 -0
  49. package/esm/utils/number.js.map +1 -1
  50. package/lib/component/axis.js +3 -7
  51. package/lib/component/axis.js.map +1 -1
  52. package/lib/component/index.d.ts +0 -1
  53. package/lib/component/index.js +1 -3
  54. package/lib/component/index.js.map +1 -1
  55. package/lib/component/legendContinuous.js +1 -1
  56. package/lib/component/legendContinuous.js.map +1 -1
  57. package/lib/coordinate/index.d.ts +0 -2
  58. package/lib/coordinate/index.js +1 -3
  59. package/lib/coordinate/index.js.map +1 -1
  60. package/lib/exports.d.ts +5 -1
  61. package/lib/exports.js +7 -1
  62. package/lib/exports.js.map +1 -1
  63. package/lib/index.d.ts +114 -114
  64. package/lib/index.js +1 -2
  65. package/lib/index.js.map +1 -1
  66. package/lib/lib/builtinlib.d.ts +7 -7
  67. package/lib/lib/core.d.ts +32 -32
  68. package/lib/lib/index.d.ts +0 -1
  69. package/lib/lib/index.js +1 -3
  70. package/lib/lib/index.js.map +1 -1
  71. package/lib/lib/lite.d.ts +18 -18
  72. package/lib/lib/std.d.ts +56 -56
  73. package/lib/mark/index.d.ts +0 -3
  74. package/lib/mark/index.js +1 -7
  75. package/lib/mark/index.js.map +1 -1
  76. package/lib/mark/liquid.js +2 -1
  77. package/lib/mark/liquid.js.map +1 -1
  78. package/lib/runtime/component.js +2 -4
  79. package/lib/runtime/component.js.map +1 -1
  80. package/lib/runtime/types/component.d.ts +1 -6
  81. package/lib/shape/index.d.ts +0 -4
  82. package/lib/shape/index.js +6 -14
  83. package/lib/shape/index.js.map +1 -1
  84. package/lib/spec/coordinate.d.ts +1 -4
  85. package/lib/spec/mark.d.ts +1 -3
  86. package/lib/transform/filter.js +3 -1
  87. package/lib/transform/filter.js.map +1 -1
  88. package/lib/transform/maybeTitle.js +6 -1
  89. package/lib/transform/maybeTitle.js.map +1 -1
  90. package/lib/utils/dateFormat.d.ts +1 -0
  91. package/lib/utils/dateFormat.js +22 -0
  92. package/lib/utils/dateFormat.js.map +1 -0
  93. package/lib/utils/number.d.ts +4 -0
  94. package/lib/utils/number.js +10 -1
  95. package/lib/utils/number.js.map +1 -1
  96. package/package.json +9 -16
  97. package/src/component/axis.ts +1 -5
  98. package/src/component/index.ts +0 -1
  99. package/src/component/legendContinuous.ts +1 -1
  100. package/src/coordinate/index.ts +0 -2
  101. package/src/exports.ts +16 -2
  102. package/src/index.ts +2 -2
  103. package/src/lib/index.ts +0 -1
  104. package/src/mark/index.ts +0 -3
  105. package/src/mark/liquid.ts +2 -1
  106. package/src/runtime/component.ts +1 -4
  107. package/src/runtime/types/component.ts +2 -9
  108. package/src/shape/index.ts +0 -4
  109. package/src/spec/coordinate.ts +0 -5
  110. package/src/spec/mark.ts +0 -3
  111. package/src/transform/filter.ts +3 -1
  112. package/src/transform/maybeTitle.ts +8 -1
  113. package/src/utils/dateFormat.ts +22 -0
  114. package/src/utils/number.ts +8 -0
  115. package/CHANGELOG.md +0 -429
  116. package/esm/component/axisZ.d.ts +0 -8
  117. package/esm/component/axisZ.js +0 -14
  118. package/esm/component/axisZ.js.map +0 -1
  119. package/esm/coordinate/cartesian3D.d.ts +0 -7
  120. package/esm/coordinate/cartesian3D.js +0 -6
  121. package/esm/coordinate/cartesian3D.js.map +0 -1
  122. package/esm/lib/threed.d.ts +0 -7
  123. package/esm/lib/threed.js +0 -13
  124. package/esm/lib/threed.js.map +0 -1
  125. package/esm/mark/interval3D.d.ts +0 -8
  126. package/esm/mark/interval3D.js +0 -65
  127. package/esm/mark/interval3D.js.map +0 -1
  128. package/esm/mark/line3D.d.ts +0 -7
  129. package/esm/mark/line3D.js +0 -65
  130. package/esm/mark/line3D.js.map +0 -1
  131. package/esm/mark/point3D.d.ts +0 -9
  132. package/esm/mark/point3D.js +0 -76
  133. package/esm/mark/point3D.js.map +0 -1
  134. package/esm/shape/interval3D/cube.d.ts +0 -6
  135. package/esm/shape/interval3D/cube.js +0 -71
  136. package/esm/shape/interval3D/cube.js.map +0 -1
  137. package/esm/shape/line3D/line.d.ts +0 -3
  138. package/esm/shape/line3D/line.js +0 -30
  139. package/esm/shape/line3D/line.js.map +0 -1
  140. package/esm/shape/point3D/cube.d.ts +0 -6
  141. package/esm/shape/point3D/cube.js +0 -70
  142. package/esm/shape/point3D/cube.js.map +0 -1
  143. package/esm/shape/point3D/sphere.d.ts +0 -6
  144. package/esm/shape/point3D/sphere.js +0 -70
  145. package/esm/shape/point3D/sphere.js.map +0 -1
  146. package/lib/component/axisZ.d.ts +0 -8
  147. package/lib/component/axisZ.js +0 -19
  148. package/lib/component/axisZ.js.map +0 -1
  149. package/lib/coordinate/cartesian3D.d.ts +0 -7
  150. package/lib/coordinate/cartesian3D.js +0 -10
  151. package/lib/coordinate/cartesian3D.js.map +0 -1
  152. package/lib/lib/threed.d.ts +0 -7
  153. package/lib/lib/threed.js +0 -17
  154. package/lib/lib/threed.js.map +0 -1
  155. package/lib/mark/interval3D.d.ts +0 -8
  156. package/lib/mark/interval3D.js +0 -69
  157. package/lib/mark/interval3D.js.map +0 -1
  158. package/lib/mark/line3D.d.ts +0 -7
  159. package/lib/mark/line3D.js +0 -69
  160. package/lib/mark/line3D.js.map +0 -1
  161. package/lib/mark/point3D.d.ts +0 -9
  162. package/lib/mark/point3D.js +0 -80
  163. package/lib/mark/point3D.js.map +0 -1
  164. package/lib/shape/interval3D/cube.d.ts +0 -6
  165. package/lib/shape/interval3D/cube.js +0 -75
  166. package/lib/shape/interval3D/cube.js.map +0 -1
  167. package/lib/shape/line3D/line.d.ts +0 -3
  168. package/lib/shape/line3D/line.js +0 -34
  169. package/lib/shape/line3D/line.js.map +0 -1
  170. package/lib/shape/point3D/cube.d.ts +0 -6
  171. package/lib/shape/point3D/cube.js +0 -74
  172. package/lib/shape/point3D/cube.js.map +0 -1
  173. package/lib/shape/point3D/sphere.d.ts +0 -6
  174. package/lib/shape/point3D/sphere.js +0 -74
  175. package/lib/shape/point3D/sphere.js.map +0 -1
  176. package/src/component/axisZ.ts +0 -25
  177. package/src/coordinate/cartesian3D.ts +0 -11
  178. package/src/lib/threed.ts +0 -13
  179. package/src/mark/interval3D.ts +0 -100
  180. package/src/mark/line3D.ts +0 -81
  181. package/src/mark/point3D.ts +0 -90
  182. package/src/shape/interval3D/cube.ts +0 -69
  183. package/src/shape/line3D/line.ts +0 -29
  184. package/src/shape/point3D/cube.ts +0 -68
  185. package/src/shape/point3D/sphere.ts +0 -68
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MaybeTitle = void 0;
4
4
  const util_1 = require("@antv/util");
5
5
  const helper_1 = require("../utils/helper");
6
+ const dateFormat_1 = require("../utils/dateFormat");
6
7
  const helper_2 = require("./utils/helper");
7
8
  /**
8
9
  * Infer title channel from x-position channel.
@@ -27,7 +28,11 @@ const MaybeTitle = (options = {}) => {
27
28
  return [I, mark];
28
29
  const T = [];
29
30
  for (const i of I) {
30
- T[i] = { value: titles.map((t) => t[i]).join(', ') };
31
+ T[i] = {
32
+ value: titles
33
+ .map((t) => t[i] instanceof Date ? (0, dateFormat_1.dynamicFormatDateTime)(t[i]) : t[i])
34
+ .join(', '),
35
+ };
31
36
  }
32
37
  return [
33
38
  I,
@@ -1 +1 @@
1
- {"version":3,"file":"maybeTitle.js","sourceRoot":"src/","sources":["transform/maybeTitle.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,4CAA0C;AAE1C,2CAA0C;AAM1C;;GAEG;AACI,MAAM,UAAU,GAA0B,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE;IAChE,MAAM,EAAE,OAAO,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC;IAClC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;QACjB,MAAM,EAAE,MAAM,EAAE,GAAG,IA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AC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,CAAC,GAAG,EAAE,CAAC;QACb,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;YACjB,CAAC,CAAC,CAAC,CAAC,GAAG;gBACL,KAAK,EAAE,MAAM;qBACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACT,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC,IAAA,kCAAqB,EAAC,CAAC,CAAC,CAAC,CAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAClE;qBACA,IAAI,CAAC,IAAI,CAAC;aACd,CAAC;SACH;QACD,OAAO;YACL,CAAC;YACD,IAAA,cAAO,EAAC,EAAE,EAAE,IAAI,EAAE;gBAChB,OAAO,EAAE;oBACP,KAAK,EAAE,CAAC;iBACT;aACF,CAAC;SACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAlCW,QAAA,UAAU,cAkCrB;AAEF,kBAAU,CAAC,KAAK,GAAG,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function dynamicFormatDateTime(date: Date): string;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dynamicFormatDateTime = void 0;
4
+ function fillZero(digit) {
5
+ if (Math.abs(digit) > 10)
6
+ return String(digit);
7
+ return digit.toString().padStart(2, '0');
8
+ }
9
+ function dynamicFormatDateTime(date) {
10
+ const year = date.getFullYear();
11
+ const month = fillZero(date.getMonth() + 1);
12
+ const day = fillZero(date.getDate());
13
+ const yyyyMMDD = `${year}-${month}-${day}`;
14
+ const hour = date.getHours();
15
+ const minutes = date.getMinutes();
16
+ const seconds = date.getSeconds();
17
+ if (hour || minutes || seconds)
18
+ return `${yyyyMMDD} ${fillZero(hour)}:${fillZero(minutes)}:${fillZero(seconds)}`;
19
+ return yyyyMMDD;
20
+ }
21
+ exports.dynamicFormatDateTime = dynamicFormatDateTime;
22
+ //# sourceMappingURL=dateFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateFormat.js","sourceRoot":"src/","sources":["utils/dateFormat.ts"],"names":[],"mappings":";;;AAAA,SAAS,QAAQ,CAAC,KAAa;IAC7B,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,SAAgB,qBAAqB,CAAC,IAAU;IAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAErC,MAAM,QAAQ,GAAG,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;IAE3C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IAElC,IAAI,IAAI,IAAI,OAAO,IAAI,OAAO;QAC5B,OAAO,GAAG,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,IAAI,QAAQ,CACnE,OAAO,CACR,EAAE,CAAC;IACN,OAAO,QAAQ,CAAC;AAClB,CAAC;AAhBD,sDAgBC"}
@@ -2,3 +2,7 @@
2
2
  * Clamp number within the inclusive range within the lower and upper bounds.
3
3
  */
4
4
  export declare function clamp(v: number, lower: number, upper: number): number;
5
+ /**
6
+ * Precision conversion
7
+ */
8
+ export declare function prettyNumber(n: number, precision?: number): number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clamp = void 0;
3
+ exports.prettyNumber = exports.clamp = void 0;
4
4
  /**
5
5
  * Clamp number within the inclusive range within the lower and upper bounds.
6
6
  */
@@ -8,4 +8,13 @@ function clamp(v, lower, upper) {
8
8
  return Math.max(lower, Math.min(v, upper));
9
9
  }
10
10
  exports.clamp = clamp;
11
+ /**
12
+ * Precision conversion
13
+ */
14
+ function prettyNumber(n, precision = 10) {
15
+ if (typeof n !== 'number')
16
+ return n;
17
+ return Math.abs(n) < 1e-15 ? n : parseFloat(n.toFixed(precision));
18
+ }
19
+ exports.prettyNumber = prettyNumber;
11
20
  //# sourceMappingURL=number.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"number.js","sourceRoot":"src/","sources":["utils/number.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,KAAK,CAAC,CAAS,EAAE,KAAa,EAAE,KAAa;IAC3D,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC;AAFD,sBAEC"}
1
+ {"version":3,"file":"number.js","sourceRoot":"src/","sources":["utils/number.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,KAAK,CAAC,CAAS,EAAE,KAAa,EAAE,KAAa;IAC3D,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC;AAFD,sBAEC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,CAAS,EAAE,SAAS,GAAG,EAAE;IACpD,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AACpE,CAAC;AAHD,oCAGC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g2",
3
- "version": "5.1.7",
3
+ "version": "5.1.8-beta.1",
4
4
  "description": "the Grammar of Graphics in Javascript",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -23,16 +23,16 @@
23
23
  "dist"
24
24
  ],
25
25
  "scripts": {
26
- "dev": "vite",
26
+ "dev": "TZ=Asia/Shanghai vite",
27
27
  "dev:link": "cross-env LINK=1 vite",
28
28
  "clean": "rimraf lib esm dist",
29
29
  "lint-staged": "lint-staged",
30
30
  "size": "limit-size",
31
31
  "lint": "eslint ./src ./__tests__ && prettier ./src ./__tests__ --check ",
32
32
  "fix": "eslint ./src ./__tests__ --fix && prettier ./src ./__tests__ --write ",
33
- "test": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/ --coverage -i --logHeapUsage",
34
- "test:unit": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/unit/ --coverage -i --logHeapUsage",
35
- "test:integration": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/integration/ --coverage -i --logHeapUsage",
33
+ "test": "TZ=Asia/Shanghai node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__ --logHeapUsage",
34
+ "test:unit": "TZ=Asia/Shanghai node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/unit/ --coverage --logHeapUsage",
35
+ "test:integration": "TZ=Asia/Shanghai node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/integration/ --coverage --logHeapUsage",
36
36
  "preview": "vite preview",
37
37
  "build:umd": "rimraf ./dist && node --expose-gc --max-old-space-size=4096 node_modules/rollup/dist/bin/rollup -c && npm run size",
38
38
  "build:cjs": "rimraf ./lib && tsc --module commonjs --outDir lib",
@@ -40,7 +40,6 @@
40
40
  "build": "run-p build:*",
41
41
  "bundle-vis": "cross-env BUNDLE_VIS=1 run-p build:umd",
42
42
  "ci": "run-s lint test build",
43
- "prepublishOnly": "npm run ci",
44
43
  "prepare": "husky install",
45
44
  "upload": "node scripts/upload/snapshot.js",
46
45
  "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
@@ -61,9 +60,7 @@
61
60
  "@antv/event-emitter": "^0.1.3",
62
61
  "@antv/g": "^5.18.6",
63
62
  "@antv/g-canvas": "^1.11.5",
64
- "@antv/g-plugin-3d": "^1.9.14",
65
- "@antv/g-plugin-dragndrop": "^1.8.3",
66
- "@antv/component": "^1.0.0-beta.1",
63
+ "@antv/component": "^1.0.0-beta.2",
67
64
  "@antv/path-util": "^3.0.1",
68
65
  "@antv/scale": "^0.4.7",
69
66
  "@antv/util": "^3.3.2",
@@ -83,13 +80,11 @@
83
80
  },
84
81
  "devDependencies": {
85
82
  "@antv/data-set": "^0.11.8",
86
- "@antv/g-plugin-3d": "^1.9.5",
87
- "@antv/g-plugin-control": "^1.9.5",
88
83
  "@antv/g-plugin-rough-canvas-renderer": "^1.7.9",
89
84
  "@antv/g-plugin-rough-svg-renderer": "^1.7.9",
90
- "@antv/g-svg": "^1.10.7",
91
- "@antv/g-webgl": "^1.9.8",
85
+ "@antv/g-svg": "^1.10.20",
92
86
  "@antv/g2-extension-ava": "^0.1.1",
87
+ "@antv/g2-extension-3d": "^0.1.0",
93
88
  "@antv/translator": "^1.0.0",
94
89
  "@commitlint/cli": "^11.0.0",
95
90
  "@commitlint/config-conventional": "^17.4.4",
@@ -101,14 +96,12 @@
101
96
  "@types/d3-array": "3.0.5",
102
97
  "@types/d3-path": "^3.0.0",
103
98
  "@types/d3-shape": "^3.0.2",
99
+ "@types/diff": "^5.0.0",
104
100
  "@types/jest": "^26.0.20",
105
101
  "@types/pixelmatch": "^5.2.4",
106
102
  "@types/pngjs": "^6.0.1",
107
103
  "@typescript-eslint/eslint-plugin": "^4.18.0",
108
104
  "@typescript-eslint/parser": "^4.18.0",
109
- "ali-oss": "^6.17.1",
110
- "archiver": "^5.3.1",
111
- "canvas": "2.11.0",
112
105
  "conventional-changelog-cli": "^2.2.2",
113
106
  "cross-env": "^7.0.3",
114
107
  "d3-dsv": "^3.0.1",
@@ -25,6 +25,7 @@ import {
25
25
  isTranspose,
26
26
  radiusOf,
27
27
  } from '../utils/coordinate';
28
+ import { prettyNumber } from '../utils/number';
28
29
  import { capitalizeFirst } from '../utils/helper';
29
30
  import { adaptor, isVertical, titleContent } from './utils';
30
31
 
@@ -116,11 +117,6 @@ function ticksOf(
116
117
  return tickMethod(min, max, tickCount);
117
118
  }
118
119
 
119
- function prettyNumber(n: number) {
120
- if (typeof n !== 'number') return n;
121
- return Math.abs(n) < 1e-15 ? n : parseFloat(n.toFixed(15));
122
- }
123
-
124
120
  // Set inset for axis.
125
121
  function createInset(position, coordinate) {
126
122
  if (isPolar(coordinate)) return (d) => d;
@@ -1,7 +1,6 @@
1
1
  export { LinearAxis as AxisLinear, ArcAxis as AxisArc } from './axis';
2
2
  export { AxisX } from './axisX';
3
3
  export { AxisY } from './axisY';
4
- export { AxisZ } from './axisZ';
5
4
  export { AxisRadar } from './axisRadar';
6
5
  export { LegendCategory } from './legendCategory';
7
6
  export { LegendContinuous } from './legendContinuous';
@@ -161,7 +161,7 @@ function getLinearConfig(
161
161
  data: scale.getTicks().map((value) => ({ value })),
162
162
  color: new Array(Math.floor(length)).fill(0).map((d, i) => {
163
163
  const value = ((max - min) / (length - 1)) * i + min;
164
- const color = scale.map(value);
164
+ const color = scale.map(value) || defaultColor;
165
165
  const opacity = opacityScale ? opacityScale.map(value) : 1;
166
166
  return color.replace(
167
167
  /rgb[a]*\(([\d]{1,3}) *, *([\d]{1,3}) *, *([\d]{1,3})[\S\s]*\)/,
@@ -1,5 +1,4 @@
1
1
  export { Cartesian } from './cartesian';
2
- export { Cartesian3D } from './cartesian3D';
3
2
  export { Polar, getPolarOptions } from './polar';
4
3
  export { Helix } from './helix';
5
4
  export { Transpose } from './transpose';
@@ -10,7 +9,6 @@ export { Fisheye } from './fisheye';
10
9
  export { Radar } from './radar';
11
10
 
12
11
  export type { CartesianOptions } from './cartesian';
13
- export type { Cartesian3DOptions } from './cartesian3D';
14
12
  export type { PolarOptions } from './polar';
15
13
  export type { HelixOptions } from './helix';
16
14
  export type { TransposeOptions } from './transpose';
package/src/exports.ts CHANGED
@@ -27,8 +27,22 @@ export {
27
27
 
28
28
  export { ChartEvent } from './utils/event';
29
29
 
30
- export type { G2Context } from './runtime';
31
-
32
30
  export * from './spec';
33
31
 
32
+ export type {
33
+ G2Context,
34
+ ShapeComponent,
35
+ MarkComponent,
36
+ GuideComponentComponent,
37
+ SingleMark,
38
+ G2BaseComponent,
39
+ Vector2,
40
+ Vector3,
41
+ Channel,
42
+ } from './runtime';
43
+ export { select, Selection } from './utils/selection';
44
+ export * from './transform';
45
+ export { LinearAxis } from './component/axis';
46
+ export type { AxisOptions } from './component/axis';
47
+
34
48
  export { Light, Dark, Academy, Classic, ClassicDark } from './theme';
package/src/index.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { corelib, plotlib, graphlib, geolib, stdlib, threedlib } from './lib';
1
+ import { corelib, plotlib, graphlib, geolib, stdlib } from './lib';
2
2
  import { extend, Runtime } from './api';
3
3
  import { API, CompositionAPI } from './api/extend';
4
4
  import { G2Spec } from './spec';
5
5
 
6
- export { corelib, plotlib, graphlib, geolib, stdlib, threedlib };
6
+ export { corelib, plotlib, graphlib, geolib, stdlib };
7
7
 
8
8
  export * from './exports';
9
9
 
package/src/lib/index.ts CHANGED
@@ -2,6 +2,5 @@ export { corelib } from './core';
2
2
  export { geolib } from './geo';
3
3
  export { graphlib } from './graph';
4
4
  export { plotlib } from './plot';
5
- export { threedlib } from './threed';
6
5
  export { stdlib } from './std';
7
6
  export { litelib } from './lite';
package/src/mark/index.ts CHANGED
@@ -1,10 +1,7 @@
1
1
  export { Interval } from './interval';
2
2
  export { Rect } from './rect';
3
3
  export { Line } from './line';
4
- export { Line3D } from './line3D';
5
4
  export { Point } from './point';
6
- export { Point3D } from './point3D';
7
- export { Interval3D } from './interval3D';
8
5
  export { Text } from './text';
9
6
  export { Cell } from './cell';
10
7
  export { Area } from './area';
@@ -1,5 +1,6 @@
1
1
  import { deepMix, isNumber } from '@antv/util';
2
2
  import { subObject } from '../utils/helper';
3
+ import { prettyNumber } from '../utils/number';
3
4
  import { CompositeMarkComponent as CC } from '../runtime';
4
5
  import { LiquidMark } from '../spec';
5
6
  import { LiquidShape } from '../shape';
@@ -89,7 +90,7 @@ export const Liquid: CC<LiquidOptions> = (options) => {
89
90
  }),
90
91
  deepMix({}, DEFAULT_TEXT_OPTIONS, {
91
92
  style: {
92
- text: `${percent * 100} %`,
93
+ text: `${prettyNumber(percent * 100)} %`,
93
94
  ...textStyle,
94
95
  },
95
96
  animate,
@@ -13,6 +13,7 @@ import {
13
13
  type RadialOptions,
14
14
  } from '../coordinate';
15
15
  import { combine } from '../utils/array';
16
+ import { prettyNumber } from '../utils/number';
16
17
  import { capitalizeFirst, defined, subObject } from '../utils/helper';
17
18
  import { LEGEND_INFER_STRATEGIES } from '../component/constant';
18
19
  import {
@@ -1115,7 +1116,3 @@ function normalizeLabel(d: string | DisplayObject): DisplayObject {
1115
1116
  if (d instanceof DisplayObject) return d;
1116
1117
  return new Text({ style: { text: `${d}` } });
1117
1118
  }
1118
-
1119
- function prettyNumber(n: number) {
1120
- return Math.abs(n) < 1e-15 ? n : parseFloat(n.toFixed(15));
1121
- }
@@ -1,4 +1,4 @@
1
- import { Coordinate, Transformation, Transformation3D } from '@antv/coord';
1
+ import { Coordinate, Transformation } from '@antv/coord';
2
2
  import EventEmitter from '@antv/event-emitter';
3
3
  import { DisplayObject, IAnimation as GAnimation, IDocument } from '@antv/g';
4
4
  import {
@@ -14,7 +14,7 @@ import {
14
14
  import { DataComponent } from './data';
15
15
  import { Encode, EncodeComponent } from './encode';
16
16
  import { Mark, MarkComponent } from './mark';
17
- import { G2ViewTree, G2Library, G2Mark, G2Context } from './options';
17
+ import { G2ViewTree, G2Library, G2Mark } from './options';
18
18
  import { Transform, TransformComponent } from './transform';
19
19
 
20
20
  export type G2ComponentNamespaces =
@@ -116,13 +116,6 @@ export type CoordinateComponent<O = Record<string, unknown>> = G2BaseComponent<
116
116
  CoordinateProps
117
117
  >;
118
118
 
119
- export type Coordinate3DTransform = Transformation3D[];
120
- export type Coordinate3DProps = {
121
- transform?: boolean;
122
- };
123
- export type Coordinate3DComponent<O = Record<string, unknown>> =
124
- G2BaseComponent<Coordinate3DTransform, O, Coordinate3DProps>;
125
-
126
119
  export type Palette = string[];
127
120
  export type PaletteComponent<O = Record<string, unknown>> = G2BaseComponent<
128
121
  Palette,
@@ -10,7 +10,6 @@ export { HV as LineHV } from './line/hv';
10
10
  export { VH as LineVH } from './line/vh';
11
11
  export { HVH as LineHVH } from './line/hvh';
12
12
  export { Trail as LineTrail } from './line/trail';
13
- export { Line as Line3DShape } from './line3D/line';
14
13
  export { HollowBowtie as PointHollowBowtie } from './point/hollowBowtie';
15
14
  export { HollowDiamond as PointHollowDiamond } from './point/hollowDiamond';
16
15
  export { HollowHexagon as PointHollowHexagon } from './point/hollowHexagon';
@@ -30,9 +29,6 @@ export { Square as PointSquare } from './point/square';
30
29
  export { Tick as PointTick } from './point/tick';
31
30
  export { Triangle as PointTriangle } from './point/triangle';
32
31
  export { TriangleDown as PointTriangleDown } from './point/triangleDown';
33
- export { Sphere } from './point3D/sphere';
34
- export { Cube } from './point3D/cube';
35
- export { Cube as IntervalCube } from './interval3D/cube';
36
32
  export { Vector as VectorShape } from './vector/vector';
37
33
  export { Text as TextShape } from './text/text';
38
34
  export { Badge as TextBadge } from './text/badge';
@@ -7,7 +7,6 @@ export type Coordinate =
7
7
  | ThetaCoordinate
8
8
  | CustomCoordinate
9
9
  | CartesianCoordinate
10
- | Cartesian3DCoordinate
11
10
  | ParallelCoordinate
12
11
  | RadialCoordinate
13
12
  | RadarCoordinate
@@ -72,10 +71,6 @@ export type CartesianCoordinate = BaseCoordinate<{
72
71
  type?: 'cartesian';
73
72
  }>;
74
73
 
75
- export type Cartesian3DCoordinate = BaseCoordinate<{
76
- type?: 'cartesian3D';
77
- }>;
78
-
79
74
  export type ParallelCoordinate = BaseCoordinate<{
80
75
  type?: 'parallel';
81
76
  }>;
package/src/spec/mark.ts CHANGED
@@ -1,4 +1,3 @@
1
- import type { AdviseParams } from '@antv/ava';
2
1
  import { MarkComponent } from '../runtime';
3
2
  import { Encode } from './encode';
4
3
  import { Transform } from './transform';
@@ -19,7 +18,6 @@ import {
19
18
  import { Closeable, Literal2Object, Padding } from './utils';
20
19
 
21
20
  export type Mark =
22
- | AutoMark
23
21
  | IntervalMark
24
22
  | RectMark
25
23
  | LineMark
@@ -394,4 +392,3 @@ export type HeatmapMark = BaseMark<'heatmap'>;
394
392
  export type LiquidMark = BaseMark<'liquid'>;
395
393
 
396
394
  export type CustomMark = BaseMark<MarkComponent, ChannelTypes>;
397
- export type AutoMark = BaseMark<'auto'> & AdviseParams;
@@ -48,7 +48,9 @@ export const Filter: TC<FilterOptions> = (options = {}) => {
48
48
  key,
49
49
  {
50
50
  ...encode,
51
- value: newIndex.map((i) => encode.value[FI[i]]),
51
+ value: newIndex
52
+ .map((i) => encode.value[FI[i]])
53
+ .filter((v) => v !== undefined),
52
54
  },
53
55
  ];
54
56
  });
@@ -1,6 +1,7 @@
1
1
  import { deepMix } from '@antv/util';
2
2
  import { isUnset } from '../utils/helper';
3
3
  import { TransformComponent as TC } from '../runtime';
4
+ import { dynamicFormatDateTime } from '../utils/dateFormat';
4
5
  import { columnOf } from './utils/helper';
5
6
 
6
7
  export type MaybeTitleOptions = {
@@ -27,7 +28,13 @@ export const MaybeTitle: TC<MaybeTitleOptions> = (options = {}) => {
27
28
  if (titles.length === 0) return [I, mark];
28
29
  const T = [];
29
30
  for (const i of I) {
30
- T[i] = { value: titles.map((t) => t[i]).join(', ') };
31
+ T[i] = {
32
+ value: titles
33
+ .map((t) =>
34
+ t[i] instanceof Date ? dynamicFormatDateTime(t[i] as Date) : t[i],
35
+ )
36
+ .join(', '),
37
+ };
31
38
  }
32
39
  return [
33
40
  I,
@@ -0,0 +1,22 @@
1
+ function fillZero(digit: number) {
2
+ if (Math.abs(digit) > 10) return String(digit);
3
+ return digit.toString().padStart(2, '0');
4
+ }
5
+
6
+ export function dynamicFormatDateTime(date: Date) {
7
+ const year = date.getFullYear();
8
+ const month = fillZero(date.getMonth() + 1);
9
+ const day = fillZero(date.getDate());
10
+
11
+ const yyyyMMDD = `${year}-${month}-${day}`;
12
+
13
+ const hour = date.getHours();
14
+ const minutes = date.getMinutes();
15
+ const seconds = date.getSeconds();
16
+
17
+ if (hour || minutes || seconds)
18
+ return `${yyyyMMDD} ${fillZero(hour)}:${fillZero(minutes)}:${fillZero(
19
+ seconds,
20
+ )}`;
21
+ return yyyyMMDD;
22
+ }
@@ -4,3 +4,11 @@
4
4
  export function clamp(v: number, lower: number, upper: number): number {
5
5
  return Math.max(lower, Math.min(v, upper));
6
6
  }
7
+
8
+ /**
9
+ * Precision conversion
10
+ */
11
+ export function prettyNumber(n: number, precision = 10) {
12
+ if (typeof n !== 'number') return n;
13
+ return Math.abs(n) < 1e-15 ? n : parseFloat(n.toFixed(precision));
14
+ }