@visactor/vgrammar-core 0.14.0-alpha.1 → 0.14.0-alpha.3

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 (259) hide show
  1. package/cjs/component/axis.d.ts +0 -2
  2. package/cjs/component/axis.js +1 -15
  3. package/cjs/component/axis.js.map +1 -1
  4. package/cjs/component/grid.d.ts +0 -2
  5. package/cjs/component/grid.js +1 -15
  6. package/cjs/component/grid.js.map +1 -1
  7. package/cjs/component/index.d.ts +2 -2
  8. package/cjs/component/index.js +1 -21
  9. package/cjs/component/index.js.map +1 -1
  10. package/cjs/core/factory.d.ts +1 -8
  11. package/cjs/core/factory.js +1 -8
  12. package/cjs/core/factory.js.map +1 -1
  13. package/cjs/glyph/boxplot.js +5 -5
  14. package/cjs/glyph/boxplot.js.map +1 -1
  15. package/cjs/glyph/link-path.js +2 -2
  16. package/cjs/glyph/link-path.js.map +1 -1
  17. package/cjs/glyph/ripple.js +2 -3
  18. package/cjs/glyph/ripple.js.map +1 -1
  19. package/cjs/glyph/tree-path.js +2 -2
  20. package/cjs/glyph/tree-path.js.map +1 -1
  21. package/cjs/glyph/violin.js +4 -4
  22. package/cjs/glyph/violin.js.map +1 -1
  23. package/cjs/glyph/wave.js +2 -3
  24. package/cjs/glyph/wave.js.map +1 -1
  25. package/cjs/graph/animation/animation/fade.js +4 -4
  26. package/cjs/graph/animation/animation/fade.js.map +1 -1
  27. package/cjs/graph/animation/animation/grow-cartesian.js +14 -14
  28. package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -1
  29. package/cjs/graph/animation/animation/grow-interval.js +9 -9
  30. package/cjs/graph/animation/animation/grow-interval.js.map +1 -1
  31. package/cjs/graph/animation/animation/grow-points.js +9 -9
  32. package/cjs/graph/animation/animation/grow-points.js.map +1 -1
  33. package/cjs/graph/animation/animation/grow-polar.js +24 -24
  34. package/cjs/graph/animation/animation/grow-polar.js.map +1 -1
  35. package/cjs/graph/animation/animation/move.js +6 -6
  36. package/cjs/graph/animation/animation/move.js.map +1 -1
  37. package/cjs/graph/animation/animation/rotate.js +5 -5
  38. package/cjs/graph/animation/animation/rotate.js.map +1 -1
  39. package/cjs/graph/animation/animation/scale.js +5 -5
  40. package/cjs/graph/animation/animation/scale.js.map +1 -1
  41. package/cjs/graph/animation/animation/update.js +2 -2
  42. package/cjs/graph/animation/animation/update.js.map +1 -1
  43. package/cjs/graph/animation/animator.js +6 -1
  44. package/cjs/graph/animation/animator.js.map +1 -1
  45. package/cjs/graph/animation/morph.d.ts +12 -2
  46. package/cjs/graph/animation/morph.js +163 -76
  47. package/cjs/graph/animation/morph.js.map +1 -1
  48. package/cjs/graph/attributes/line.d.ts +1 -0
  49. package/cjs/graph/attributes/line.js +17 -5
  50. package/cjs/graph/attributes/line.js.map +1 -1
  51. package/cjs/graph/canvas-renderer.d.ts +1 -1
  52. package/cjs/graph/canvas-renderer.js +4 -4
  53. package/cjs/graph/canvas-renderer.js.map +1 -1
  54. package/cjs/graph/constants.d.ts +1 -0
  55. package/cjs/graph/constants.js +2 -2
  56. package/cjs/graph/constants.js.map +1 -1
  57. package/cjs/graph/element.d.ts +2 -1
  58. package/cjs/graph/element.js +22 -20
  59. package/cjs/graph/element.js.map +1 -1
  60. package/cjs/graph/glyph-element.js +6 -7
  61. package/cjs/graph/glyph-element.js.map +1 -1
  62. package/cjs/graph/layout/layout.d.ts +0 -1
  63. package/cjs/graph/layout/layout.js +2 -8
  64. package/cjs/graph/layout/layout.js.map +1 -1
  65. package/cjs/graph/mark/graphic.js +8 -14
  66. package/cjs/graph/mark/graphic.js.map +1 -1
  67. package/cjs/graph/util/element.d.ts +2 -0
  68. package/cjs/graph/util/element.js +10 -0
  69. package/cjs/graph/util/element.js.map +1 -0
  70. package/cjs/graph/util/point.js +26 -10
  71. package/cjs/graph/util/point.js.map +1 -1
  72. package/cjs/index.d.ts +1 -8
  73. package/cjs/index.js +2 -66
  74. package/cjs/index.js.map +1 -1
  75. package/cjs/interactions/brush-base.js +2 -1
  76. package/cjs/interactions/brush-filter.js +1 -2
  77. package/cjs/interactions/fish-eye.js +2 -1
  78. package/cjs/interactions/index.js +1 -2
  79. package/cjs/interactions/tooltip.js +1 -1
  80. package/cjs/parse/event.d.ts +2 -0
  81. package/cjs/parse/event.js +10 -4
  82. package/cjs/parse/event.js.map +1 -1
  83. package/cjs/parse/util.js.map +1 -1
  84. package/cjs/transforms/mark/mark-overlap.js +6 -6
  85. package/cjs/transforms/mark/mark-overlap.js.map +1 -1
  86. package/cjs/types/animate.d.ts +1 -0
  87. package/cjs/types/animate.js.map +1 -1
  88. package/cjs/types/element.d.ts +5 -1
  89. package/cjs/types/element.js.map +1 -1
  90. package/cjs/types/morph.d.ts +2 -1
  91. package/cjs/types/morph.js.map +1 -1
  92. package/cjs/types/renderer.d.ts +1 -6
  93. package/cjs/types/renderer.js.map +1 -1
  94. package/cjs/view/View.d.ts +6 -3
  95. package/cjs/view/View.js +105 -52
  96. package/cjs/view/View.js.map +1 -1
  97. package/cjs/view/animate.js +1 -2
  98. package/cjs/view/animate.js.map +1 -1
  99. package/cjs/view/constants.d.ts +0 -2
  100. package/cjs/view/constants.js +2 -3
  101. package/cjs/view/constants.js.map +1 -1
  102. package/cjs/view/events.d.ts +1 -0
  103. package/cjs/view/events.js +17 -3
  104. package/cjs/view/events.js.map +1 -1
  105. package/cjs/view/glyph.d.ts +0 -4
  106. package/cjs/view/glyph.js +3 -12
  107. package/cjs/view/glyph.js.map +1 -1
  108. package/cjs/view/grammar-record.js +2 -3
  109. package/cjs/view/grammar-record.js.map +1 -1
  110. package/cjs/view/group.js +3 -3
  111. package/cjs/view/group.js.map +1 -1
  112. package/cjs/view/mark.d.ts +0 -2
  113. package/cjs/view/mark.js +28 -31
  114. package/cjs/view/mark.js.map +1 -1
  115. package/es/component/axis.d.ts +0 -2
  116. package/es/component/axis.js +0 -10
  117. package/es/component/axis.js.map +1 -1
  118. package/es/component/grid.d.ts +0 -2
  119. package/es/component/grid.js +0 -10
  120. package/es/component/grid.js.map +1 -1
  121. package/es/component/index.d.ts +2 -2
  122. package/es/component/index.js +2 -2
  123. package/es/component/index.js.map +1 -1
  124. package/es/core/factory.d.ts +1 -8
  125. package/es/core/factory.js +1 -8
  126. package/es/core/factory.js.map +1 -1
  127. package/es/glyph/boxplot.js +2 -4
  128. package/es/glyph/boxplot.js.map +1 -1
  129. package/es/glyph/link-path.js +2 -4
  130. package/es/glyph/link-path.js.map +1 -1
  131. package/es/glyph/ripple.js +1 -3
  132. package/es/glyph/ripple.js.map +1 -1
  133. package/es/glyph/tree-path.js +2 -4
  134. package/es/glyph/tree-path.js.map +1 -1
  135. package/es/glyph/violin.js +2 -4
  136. package/es/glyph/violin.js.map +1 -1
  137. package/es/glyph/wave.js +1 -3
  138. package/es/glyph/wave.js.map +1 -1
  139. package/es/graph/animation/animation/fade.js +4 -4
  140. package/es/graph/animation/animation/fade.js.map +1 -1
  141. package/es/graph/animation/animation/grow-cartesian.js +14 -14
  142. package/es/graph/animation/animation/grow-cartesian.js.map +1 -1
  143. package/es/graph/animation/animation/grow-interval.js +9 -9
  144. package/es/graph/animation/animation/grow-interval.js.map +1 -1
  145. package/es/graph/animation/animation/grow-points.js +9 -9
  146. package/es/graph/animation/animation/grow-points.js.map +1 -1
  147. package/es/graph/animation/animation/grow-polar.js +24 -24
  148. package/es/graph/animation/animation/grow-polar.js.map +1 -1
  149. package/es/graph/animation/animation/move.js +6 -6
  150. package/es/graph/animation/animation/move.js.map +1 -1
  151. package/es/graph/animation/animation/rotate.js +4 -4
  152. package/es/graph/animation/animation/rotate.js.map +1 -1
  153. package/es/graph/animation/animation/scale.js +5 -5
  154. package/es/graph/animation/animation/scale.js.map +1 -1
  155. package/es/graph/animation/animation/update.js +3 -1
  156. package/es/graph/animation/animation/update.js.map +1 -1
  157. package/es/graph/animation/animator.js +6 -1
  158. package/es/graph/animation/animator.js.map +1 -1
  159. package/es/graph/animation/morph.d.ts +12 -2
  160. package/es/graph/animation/morph.js +159 -72
  161. package/es/graph/animation/morph.js.map +1 -1
  162. package/es/graph/attributes/line.d.ts +1 -0
  163. package/es/graph/attributes/line.js +14 -3
  164. package/es/graph/attributes/line.js.map +1 -1
  165. package/es/graph/canvas-renderer.d.ts +1 -1
  166. package/es/graph/canvas-renderer.js +5 -5
  167. package/es/graph/canvas-renderer.js.map +1 -1
  168. package/es/graph/constants.d.ts +1 -0
  169. package/es/graph/constants.js +2 -0
  170. package/es/graph/constants.js.map +1 -1
  171. package/es/graph/element.d.ts +2 -1
  172. package/es/graph/element.js +24 -20
  173. package/es/graph/element.js.map +1 -1
  174. package/es/graph/glyph-element.js +8 -6
  175. package/es/graph/glyph-element.js.map +1 -1
  176. package/es/graph/layout/layout.d.ts +0 -1
  177. package/es/graph/layout/layout.js +0 -6
  178. package/es/graph/layout/layout.js.map +1 -1
  179. package/es/graph/mark/graphic.js +7 -13
  180. package/es/graph/mark/graphic.js.map +1 -1
  181. package/es/graph/util/element.d.ts +2 -0
  182. package/es/graph/util/element.js +8 -0
  183. package/es/graph/util/element.js.map +1 -0
  184. package/es/graph/util/point.js +26 -10
  185. package/es/graph/util/point.js.map +1 -1
  186. package/es/index.d.ts +1 -8
  187. package/es/index.js +1 -29
  188. package/es/index.js.map +1 -1
  189. package/es/interactions/element-active.js +2 -1
  190. package/es/interactions/element-highlight-by-group.js +1 -2
  191. package/es/interactions/fish-eye.js +1 -1
  192. package/es/parse/event.d.ts +2 -0
  193. package/es/parse/event.js +7 -3
  194. package/es/parse/event.js.map +1 -1
  195. package/es/parse/option.js +2 -1
  196. package/es/parse/scale.js +1 -2
  197. package/es/parse/util.js.map +1 -1
  198. package/es/transforms/mark/mark-overlap.js +6 -6
  199. package/es/transforms/mark/mark-overlap.js.map +1 -1
  200. package/es/types/animate.d.ts +1 -0
  201. package/es/types/animate.js.map +1 -1
  202. package/es/types/element.d.ts +5 -1
  203. package/es/types/element.js.map +1 -1
  204. package/es/types/morph.d.ts +2 -1
  205. package/es/types/morph.js.map +1 -1
  206. package/es/types/renderer.d.ts +1 -6
  207. package/es/types/renderer.js.map +1 -1
  208. package/es/view/View.d.ts +6 -3
  209. package/es/view/View.js +114 -53
  210. package/es/view/View.js.map +1 -1
  211. package/es/view/animate.js +1 -2
  212. package/es/view/animate.js.map +1 -1
  213. package/es/view/constants.d.ts +0 -2
  214. package/es/view/constants.js +0 -4
  215. package/es/view/constants.js.map +1 -1
  216. package/es/view/events.d.ts +1 -0
  217. package/es/view/events.js +15 -1
  218. package/es/view/events.js.map +1 -1
  219. package/es/view/glyph.d.ts +0 -4
  220. package/es/view/glyph.js +0 -11
  221. package/es/view/glyph.js.map +1 -1
  222. package/es/view/grammar-record.js +2 -3
  223. package/es/view/grammar-record.js.map +1 -1
  224. package/es/view/group.js +4 -2
  225. package/es/view/group.js.map +1 -1
  226. package/es/view/mark.d.ts +0 -2
  227. package/es/view/mark.js +30 -32
  228. package/es/view/mark.js.map +1 -1
  229. package/package.json +9 -9
  230. package/cjs/graph/view-diff.d.ts +0 -8
  231. package/cjs/graph/view-diff.js +0 -93
  232. package/cjs/graph/view-diff.js.map +0 -1
  233. package/cjs/view/mark-animate-mixin.d.ts +0 -1
  234. package/cjs/view/mark-animate-mixin.js +0 -29
  235. package/cjs/view/mark-animate-mixin.js.map +0 -1
  236. package/cjs/view/view-animate-mixin.d.ts +0 -1
  237. package/cjs/view/view-animate-mixin.js +0 -26
  238. package/cjs/view/view-animate-mixin.js.map +0 -1
  239. package/cjs/view/view-event-mixin.d.ts +0 -1
  240. package/cjs/view/view-event-mixin.js +0 -92
  241. package/cjs/view/view-event-mixin.js.map +0 -1
  242. package/cjs/view/view-morph-mixin.d.ts +0 -1
  243. package/cjs/view/view-morph-mixin.js +0 -32
  244. package/cjs/view/view-morph-mixin.js.map +0 -1
  245. package/es/graph/view-diff.d.ts +0 -8
  246. package/es/graph/view-diff.js +0 -89
  247. package/es/graph/view-diff.js.map +0 -1
  248. package/es/view/mark-animate-mixin.d.ts +0 -1
  249. package/es/view/mark-animate-mixin.js +0 -25
  250. package/es/view/mark-animate-mixin.js.map +0 -1
  251. package/es/view/view-animate-mixin.d.ts +0 -1
  252. package/es/view/view-animate-mixin.js +0 -16
  253. package/es/view/view-animate-mixin.js.map +0 -1
  254. package/es/view/view-event-mixin.d.ts +0 -1
  255. package/es/view/view-event-mixin.js +0 -90
  256. package/es/view/view-event-mixin.js.map +0 -1
  257. package/es/view/view-morph-mixin.d.ts +0 -1
  258. package/es/view/view-morph-mixin.js +0 -22
  259. package/es/view/view-morph-mixin.js.map +0 -1
@@ -24,5 +24,3 @@ export declare class Axis extends ScaleComponent implements IAxis {
24
24
  private _getAxisComponentType;
25
25
  }
26
26
  export declare const registerAxis: () => void;
27
- export declare const registerLineAxis: () => void;
28
- export declare const registerCircleAxis: () => void;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.registerCircleAxis = exports.registerLineAxis = exports.registerAxis = exports.Axis = exports.generateCoordinateAxisAttribute = exports.generateCircleAxisAttributes = exports.generateLineAxisAttributes = void 0;
5
+ }), exports.registerAxis = exports.Axis = exports.generateCoordinateAxisAttribute = exports.generateCircleAxisAttributes = exports.generateLineAxisAttributes = void 0;
6
6
 
7
7
  const vutils_1 = require("@visactor/vutils"), vrender_components_1 = require("@visactor/vrender-components"), enums_1 = require("../graph/enums"), scale_1 = require("./scale"), encode_1 = require("../graph/mark/encode"), util_1 = require("../parse/util"), factory_1 = require("../core/factory"), generateLineAxisAttributes = (scale, theme, addition, tickCount) => {
8
8
  var _a, _b, _c, _d;
@@ -165,18 +165,4 @@ const registerAxis = () => {
165
165
  };
166
166
 
167
167
  exports.registerAxis = registerAxis;
168
-
169
- const registerLineAxis = () => {
170
- factory_1.Factory.registerGraphicComponent(enums_1.AxisEnum.lineAxis, ((attrs, options) => new vrender_components_1.LineAxis(attrs, options))),
171
- factory_1.Factory.registerComponent(enums_1.ComponentEnum.axis, Axis);
172
- };
173
-
174
- exports.registerLineAxis = registerLineAxis;
175
-
176
- const registerCircleAxis = () => {
177
- factory_1.Factory.registerGraphicComponent(enums_1.AxisEnum.circleAxis, (attrs => new vrender_components_1.CircleAxis(attrs))),
178
- factory_1.Factory.registerComponent(enums_1.ComponentEnum.axis, Axis);
179
- };
180
-
181
- exports.registerCircleAxis = registerCircleAxis;
182
168
  //# sourceMappingURL=axis.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/axis.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAI1D,qEAAgH;AAgBhH,0CAAyD;AAEzD,mCAAyC;AACzC,iDAAqD;AACrD,wCAAmD;AAEnD,6CAA0C;AAEnC,MAAM,0BAA0B,GAAG,CACxC,KAAiB,EACjB,KAAc,EACd,QAA+C,EAC/C,SAAkB,EACE,EAAE;;IACtB,MAAM,SAAS,GAAG,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,IAAI,mCAAI,EAAE,CAAC;IAChD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,IAAA,cAAK,EAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC,CAAC;KAC7C;IACD,MAAM,QAAQ,GAAG,MAAA,MAAA,KAAK,CAAC,QAAQ,sDAAG,SAAS,CAAC,mCAAI,EAAE,CAAC;IAEnD,MAAM,KAAK,GAAG;QACZ,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACpB,EAAE,EAAE,IAAI,CAAC,KAAK;YACd,KAAK,EAAE,IAAI,CAAC,IAAI;YAChB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,IAAI;SACpB,CAAC,CAAC;KACJ,CAAC;IACF,OAAO,IAAA,cAAK,EAAC,EAAE,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ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EAAE,EAAE,CACxD,IAAI,6BAAiB,CAAC,KAAK,EAAE,OAAO,CAAwB,CAC/D,CAAC;IAEF,iBAAO,CAAC,iBAAiB,CAAC,qBAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC,CAAC;AARW,QAAA,gBAAgB,oBAQ3B;AAEK,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,iBAAO,CAAC,wBAAwB,CAC9B,gBAAQ,CAAC,UAAU,EACnB,CAAC,KAA2B,EAAE,EAAE,CAAC,IAAI,+BAAmB,CAAC,KAAK,CAAwB,CACvF,CAAC;IAEF,iBAAO,CAAC,iBAAiB,CAAC,qBAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC,CAAC;AAPW,QAAA,kBAAkB,sBAO7B","file":"axis.js","sourcesContent":["import { isNil, isString, merge } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport type { CircleAxisAttributes, LineAxisAttributes, ComponentOptions } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { CircleAxis as CircleAxisComponent, LineAxis as LineAxisComponent } from '@visactor/vrender-components';\nimport type { IBaseScale } from '@visactor/vscale';\nimport type {\n BaseSingleEncodeSpec,\n IElement,\n IGroupMark,\n IScale,\n ITheme,\n IView,\n MarkFunctionType,\n MarkRelativeItemSpec,\n Nil,\n RecursivePartial,\n SimpleSignalType,\n StateEncodeSpec\n} from '../types';\nimport { AxisEnum, ComponentEnum } from '../graph/enums';\nimport type { AxisSpec, AxisType, IAxis } from '../types/component';\nimport { ScaleComponent } from './scale';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport type { IPolarCoordinate, IBaseCoordinate } from '@visactor/vgrammar-coordinate';\nimport { Factory } from '../core/factory';\n\nexport const generateLineAxisAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<LineAxisAttributes>,\n tickCount?: number\n): LineAxisAttributes => {\n const axisTheme = theme?.components?.axis ?? {};\n if (!scale) {\n return merge({}, axisTheme, addition ?? {});\n }\n const tickData = scale.tickData?.(tickCount) ?? [];\n\n const items = [\n tickData.map(tick => ({\n id: tick.index,\n label: tick.tick,\n value: tick.value,\n rawValue: tick.tick\n }))\n ];\n return merge({}, axisTheme, { items }, addition ?? {});\n};\n\nexport const generateCircleAxisAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<CircleAxisAttributes>,\n tickCount?: number\n): CircleAxisAttributes => {\n const axisTheme = theme?.components?.circleAxis ?? {};\n if (!scale) {\n return merge({}, axisTheme, addition ?? {});\n }\n const tickData = scale.tickData?.(tickCount) ?? [];\n const items = [\n tickData.map(tick => ({\n id: tick.index,\n label: tick.tick,\n value: tick.value,\n rawValue: tick.tick\n }))\n ];\n return merge({}, axisTheme, { items }, addition ?? {});\n};\n\nexport const generateCoordinateAxisAttribute = (\n scale: IScale,\n coordinate: IBaseCoordinate,\n inside: boolean,\n baseValue: number,\n layout: MarkRelativeItemSpec,\n isGrid?: boolean\n) => {\n const axisPosition = scale.getCoordinateAxisPosition();\n if (layout && layout.position === 'auto') {\n // FIXME: too hack\n layout.position = inside ? 'content' : axisPosition;\n }\n\n const axisPoints = scale.getCoordinateAxisPoints(baseValue);\n\n if (axisPoints) {\n const start = axisPoints[0];\n const end = axisPoints[1];\n const res: any = {\n start,\n end,\n verticalFactor:\n (axisPosition === 'top' || axisPosition === 'left' ? -1 : 1) *\n (inside ? -1 : 1) *\n (scale.getSpec().range?.reversed ? -1 : 1)\n };\n\n if (isGrid && coordinate.type === 'polar') {\n const angle = (coordinate as IPolarCoordinate).angle();\n\n res.center = (coordinate as IPolarCoordinate).origin();\n res.startAngle = angle[0];\n res.endAngle = angle[1];\n }\n\n return res;\n }\n\n const radius = (coordinate as IPolarCoordinate).radius();\n const angle = (coordinate as IPolarCoordinate).angle();\n return {\n center: (coordinate as IPolarCoordinate).origin(),\n radius: radius[1],\n innerRadius: radius[0],\n inside: inside,\n startAngle: angle[0],\n endAngle: angle[1]\n };\n};\n\nexport class Axis extends ScaleComponent implements IAxis {\n static readonly componentType: string = ComponentEnum.axis;\n\n protected declare spec: AxisSpec;\n\n private _axisComponentType: keyof typeof AxisEnum;\n\n constructor(view: IView, group?: IGroupMark, mode?: '2d' | '3d') {\n super(view, ComponentEnum.axis, group);\n this.spec.componentType = ComponentEnum.axis;\n this.mode = mode;\n }\n\n protected parseAddition(spec: AxisSpec) {\n super.parseAddition(spec);\n\n this.axisType(spec.axisType);\n this.tickCount(spec.tickCount);\n this.inside(spec.inside);\n this.baseValue(spec.baseValue);\n\n return this;\n }\n\n scale(scale?: IScale | string | Nil) {\n super.scale(scale);\n this._axisComponentType = null;\n return this;\n }\n\n axisType(axisType: AxisType | Nil) {\n this.spec.axisType = axisType;\n this._axisComponentType = null;\n this._prepareRejoin();\n this.commit();\n return this;\n }\n\n addGraphicItem(attrs: any, groupKey?: string) {\n const defaultAttributes = { x: 0, y: 0, start: { x: 0, y: 0 }, end: { x: 0, y: 0 } };\n const initialAttributes = merge(defaultAttributes, attrs);\n const graphicItem = Factory.createGraphicComponent(this._getAxisComponentType(), initialAttributes, {\n mode: this.mode,\n skipDefault: this.spec.skipTheme\n });\n return super.addGraphicItem(initialAttributes, groupKey, graphicItem);\n }\n\n tickCount(tickCount: SimpleSignalType<number> | Nil) {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n\n if (scaleGrammar) {\n scaleGrammar.tickCount(tickCount);\n }\n\n return this.setFunctionSpec(tickCount, 'tickCount');\n }\n\n inside(inside: MarkFunctionType<boolean> | Nil) {\n return this.setFunctionSpec(inside, 'inside');\n }\n\n baseValue(baseValue: MarkFunctionType<number> | Nil) {\n return this.setFunctionSpec(baseValue, 'baseValue');\n }\n\n getAxisComponentType() {\n return this._axisComponentType;\n }\n\n protected _updateComponentEncoders() {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const theme = this.spec.skipTheme ? null : this.view.getCurrentTheme();\n let addition = invokeEncoder(encoder as BaseSingleEncodeSpec, datum, element, parameters);\n const inside = invokeFunctionType(this.spec.inside, parameters, datum, element);\n const baseValue = invokeFunctionType(this.spec.baseValue, parameters, datum, element);\n\n const coordinate = scaleGrammar?.getCoordinate?.();\n if (coordinate) {\n addition = Object.assign(\n generateCoordinateAxisAttribute(\n scaleGrammar,\n coordinate,\n inside,\n baseValue,\n this.spec.layout as MarkRelativeItemSpec\n ),\n addition\n );\n }\n\n const scale = scaleGrammar?.getScale?.();\n const tickCount = invokeFunctionType(this.spec.tickCount, parameters, datum, element);\n\n switch (this._getAxisComponentType()) {\n case AxisEnum.lineAxis:\n return generateLineAxisAttributes(scale, theme, addition, tickCount);\n case AxisEnum.circleAxis:\n return generateCircleAxisAttributes(scale, theme, addition, tickCount);\n }\n return addition;\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n\n private _getAxisComponentType() {\n if (this._axisComponentType) {\n return this._axisComponentType;\n }\n\n let type = this.spec.axisType;\n\n if (isNil(type)) {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n\n type = scaleGrammar?.getCoordinate?.() ? (scaleGrammar.getCoordinateAxisPoints() ? 'line' : 'circle') : 'line';\n }\n\n this._axisComponentType = type === 'circle' ? AxisEnum.circleAxis : AxisEnum.lineAxis;\n\n return this._axisComponentType;\n }\n}\n\nexport const registerAxis = () => {\n Factory.registerGraphicComponent(\n AxisEnum.lineAxis,\n (attrs: LineAxisAttributes, options?: ComponentOptions) =>\n new LineAxisComponent(attrs, options) as unknown as IGraphic\n );\n Factory.registerGraphicComponent(\n AxisEnum.circleAxis,\n (attrs: CircleAxisAttributes) => new CircleAxisComponent(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.axis, Axis);\n};\n\nexport const registerLineAxis = () => {\n Factory.registerGraphicComponent(\n AxisEnum.lineAxis,\n (attrs: LineAxisAttributes, options?: ComponentOptions) =>\n new LineAxisComponent(attrs, options) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.axis, Axis);\n};\n\nexport const registerCircleAxis = () => {\n Factory.registerGraphicComponent(\n AxisEnum.circleAxis,\n (attrs: CircleAxisAttributes) => new CircleAxisComponent(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.axis, Axis);\n};\n"]}
1
+ {"version":3,"sources":["../src/component/axis.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAI1D,qEAAgH;AAgBhH,0CAAyD;AAEzD,mCAAyC;AACzC,iDAAqD;AACrD,wCAAmD;AAEnD,6CAA0C;AAEnC,MAAM,0BAA0B,GAAG,CACxC,KAAiB,EACjB,KAAc,EACd,QAA+C,EAC/C,SAAkB,EACE,EAAE;;IACtB,MAAM,SAAS,GAAG,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,IAAI,mCAAI,EAAE,CAAC;IAChD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,IAAA,cAAK,EAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC,CAAC;KAC7C;IACD,MAAM,QAAQ,GAAG,MAAA,MAAA,KAAK,CAAC,QAAQ,sDAAG,SAAS,CAAC,mCAAI,EAAE,CAAC;IAEnD,MAAM,KAAK,GAAG;QACZ,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACpB,EAAE,EAAE,IAAI,CAAC,KAAK;YACd,KAAK,EAAE,IAAI,CAAC,IAAI;YAChB,KAAK,EAAE,IAAI,CAAC,KAAK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CAAC;AACtD,CAAC,CAAC;AAZW,QAAA,YAAY,gBAYvB","file":"axis.js","sourcesContent":["import { isNil, isString, merge } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport type { CircleAxisAttributes, LineAxisAttributes, ComponentOptions } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { CircleAxis as CircleAxisComponent, LineAxis as LineAxisComponent } from '@visactor/vrender-components';\nimport type { IBaseScale } from '@visactor/vscale';\nimport type {\n BaseSingleEncodeSpec,\n IElement,\n IGroupMark,\n IScale,\n ITheme,\n IView,\n MarkFunctionType,\n MarkRelativeItemSpec,\n Nil,\n RecursivePartial,\n SimpleSignalType,\n StateEncodeSpec\n} from '../types';\nimport { AxisEnum, ComponentEnum } from '../graph/enums';\nimport type { AxisSpec, AxisType, IAxis } from '../types/component';\nimport { ScaleComponent } from './scale';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport type { IPolarCoordinate, IBaseCoordinate } from '@visactor/vgrammar-coordinate';\nimport { Factory } from '../core/factory';\n\nexport const generateLineAxisAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<LineAxisAttributes>,\n tickCount?: number\n): LineAxisAttributes => {\n const axisTheme = theme?.components?.axis ?? {};\n if (!scale) {\n return merge({}, axisTheme, addition ?? {});\n }\n const tickData = scale.tickData?.(tickCount) ?? [];\n\n const items = [\n tickData.map(tick => ({\n id: tick.index,\n label: tick.tick,\n value: tick.value,\n rawValue: tick.tick\n }))\n ];\n return merge({}, axisTheme, { items }, addition ?? {});\n};\n\nexport const generateCircleAxisAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<CircleAxisAttributes>,\n tickCount?: number\n): CircleAxisAttributes => {\n const axisTheme = theme?.components?.circleAxis ?? {};\n if (!scale) {\n return merge({}, axisTheme, addition ?? {});\n }\n const tickData = scale.tickData?.(tickCount) ?? [];\n const items = [\n tickData.map(tick => ({\n id: tick.index,\n label: tick.tick,\n value: tick.value,\n rawValue: tick.tick\n }))\n ];\n return merge({}, axisTheme, { items }, addition ?? {});\n};\n\nexport const generateCoordinateAxisAttribute = (\n scale: IScale,\n coordinate: IBaseCoordinate,\n inside: boolean,\n baseValue: number,\n layout: MarkRelativeItemSpec,\n isGrid?: boolean\n) => {\n const axisPosition = scale.getCoordinateAxisPosition();\n if (layout && layout.position === 'auto') {\n // FIXME: too hack\n layout.position = inside ? 'content' : axisPosition;\n }\n\n const axisPoints = scale.getCoordinateAxisPoints(baseValue);\n\n if (axisPoints) {\n const start = axisPoints[0];\n const end = axisPoints[1];\n const res: any = {\n start,\n end,\n verticalFactor:\n (axisPosition === 'top' || axisPosition === 'left' ? -1 : 1) *\n (inside ? -1 : 1) *\n (scale.getSpec().range?.reversed ? -1 : 1)\n };\n\n if (isGrid && coordinate.type === 'polar') {\n const angle = (coordinate as IPolarCoordinate).angle();\n\n res.center = (coordinate as IPolarCoordinate).origin();\n res.startAngle = angle[0];\n res.endAngle = angle[1];\n }\n\n return res;\n }\n\n const radius = (coordinate as IPolarCoordinate).radius();\n const angle = (coordinate as IPolarCoordinate).angle();\n return {\n center: (coordinate as IPolarCoordinate).origin(),\n radius: radius[1],\n innerRadius: radius[0],\n inside: inside,\n startAngle: angle[0],\n endAngle: angle[1]\n };\n};\n\nexport class Axis extends ScaleComponent implements IAxis {\n static readonly componentType: string = ComponentEnum.axis;\n\n protected declare spec: AxisSpec;\n\n private _axisComponentType: keyof typeof AxisEnum;\n\n constructor(view: IView, group?: IGroupMark, mode?: '2d' | '3d') {\n super(view, ComponentEnum.axis, group);\n this.spec.componentType = ComponentEnum.axis;\n this.mode = mode;\n }\n\n protected parseAddition(spec: AxisSpec) {\n super.parseAddition(spec);\n\n this.axisType(spec.axisType);\n this.tickCount(spec.tickCount);\n this.inside(spec.inside);\n this.baseValue(spec.baseValue);\n\n return this;\n }\n\n scale(scale?: IScale | string | Nil) {\n super.scale(scale);\n this._axisComponentType = null;\n return this;\n }\n\n axisType(axisType: AxisType | Nil) {\n this.spec.axisType = axisType;\n this._axisComponentType = null;\n this._prepareRejoin();\n this.commit();\n return this;\n }\n\n addGraphicItem(attrs: any, groupKey?: string) {\n const defaultAttributes = { x: 0, y: 0, start: { x: 0, y: 0 }, end: { x: 0, y: 0 } };\n const initialAttributes = merge(defaultAttributes, attrs);\n const graphicItem = Factory.createGraphicComponent(this._getAxisComponentType(), initialAttributes, {\n mode: this.mode,\n skipDefault: this.spec.skipTheme\n });\n return super.addGraphicItem(initialAttributes, groupKey, graphicItem);\n }\n\n tickCount(tickCount: SimpleSignalType<number> | Nil) {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n\n if (scaleGrammar) {\n scaleGrammar.tickCount(tickCount);\n }\n\n return this.setFunctionSpec(tickCount, 'tickCount');\n }\n\n inside(inside: MarkFunctionType<boolean> | Nil) {\n return this.setFunctionSpec(inside, 'inside');\n }\n\n baseValue(baseValue: MarkFunctionType<number> | Nil) {\n return this.setFunctionSpec(baseValue, 'baseValue');\n }\n\n getAxisComponentType() {\n return this._axisComponentType;\n }\n\n protected _updateComponentEncoders() {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const theme = this.spec.skipTheme ? null : this.view.getCurrentTheme();\n let addition = invokeEncoder(encoder as BaseSingleEncodeSpec, datum, element, parameters);\n const inside = invokeFunctionType(this.spec.inside, parameters, datum, element);\n const baseValue = invokeFunctionType(this.spec.baseValue, parameters, datum, element);\n\n const coordinate = scaleGrammar?.getCoordinate?.();\n if (coordinate) {\n addition = Object.assign(\n generateCoordinateAxisAttribute(\n scaleGrammar,\n coordinate,\n inside,\n baseValue,\n this.spec.layout as MarkRelativeItemSpec\n ),\n addition\n );\n }\n\n const scale = scaleGrammar?.getScale?.();\n const tickCount = invokeFunctionType(this.spec.tickCount, parameters, datum, element);\n\n switch (this._getAxisComponentType()) {\n case AxisEnum.lineAxis:\n return generateLineAxisAttributes(scale, theme, addition, tickCount);\n case AxisEnum.circleAxis:\n return generateCircleAxisAttributes(scale, theme, addition, tickCount);\n }\n return addition;\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n\n private _getAxisComponentType() {\n if (this._axisComponentType) {\n return this._axisComponentType;\n }\n\n let type = this.spec.axisType;\n\n if (isNil(type)) {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n\n type = scaleGrammar?.getCoordinate?.() ? (scaleGrammar.getCoordinateAxisPoints() ? 'line' : 'circle') : 'line';\n }\n\n this._axisComponentType = type === 'circle' ? AxisEnum.circleAxis : AxisEnum.lineAxis;\n\n return this._axisComponentType;\n }\n}\n\nexport const registerAxis = () => {\n Factory.registerGraphicComponent(\n AxisEnum.lineAxis,\n (attrs: LineAxisAttributes, options?: ComponentOptions) =>\n new LineAxisComponent(attrs, options) as unknown as IGraphic\n );\n Factory.registerGraphicComponent(\n AxisEnum.circleAxis,\n (attrs: CircleAxisAttributes) => new CircleAxisComponent(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.axis, Axis);\n};\n"]}
@@ -25,5 +25,3 @@ export declare class Grid extends ScaleComponent implements IGrid {
25
25
  private _getGridComponentType;
26
26
  }
27
27
  export declare const registerGrid: () => void;
28
- export declare const registerLineGrid: () => void;
29
- export declare const registerCircleGrid: () => void;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.registerCircleGrid = exports.registerLineGrid = exports.registerGrid = exports.Grid = exports.generateCircleAxisGridAttributes = exports.generateLineAxisGridAttributes = void 0;
5
+ }), exports.registerGrid = exports.Grid = exports.generateCircleAxisGridAttributes = exports.generateLineAxisGridAttributes = void 0;
6
6
 
7
7
  const vutils_1 = require("@visactor/vutils"), vrender_components_1 = require("@visactor/vrender-components"), enums_1 = require("../graph/enums"), scale_1 = require("./scale"), encode_1 = require("../graph/mark/encode"), util_1 = require("../parse/util"), axis_1 = require("./axis"), factory_1 = require("../core/factory"), generateLineAxisGridAttributes = (scale, theme, addition, tickCount) => {
8
8
  var _a, _b, _c, _d;
@@ -191,18 +191,4 @@ const registerGrid = () => {
191
191
  };
192
192
 
193
193
  exports.registerGrid = registerGrid;
194
-
195
- const registerLineGrid = () => {
196
- factory_1.Factory.registerGraphicComponent(enums_1.GridEnum.lineAxisGrid, ((attrs, options) => new vrender_components_1.LineAxisGrid(attrs, options))),
197
- factory_1.Factory.registerComponent(enums_1.ComponentEnum.grid, Grid);
198
- };
199
-
200
- exports.registerLineGrid = registerLineGrid;
201
-
202
- const registerCircleGrid = () => {
203
- factory_1.Factory.registerGraphicComponent(enums_1.GridEnum.circleAxisGrid, ((attrs, options) => new vrender_components_1.CircleAxisGrid(attrs, options))),
204
- factory_1.Factory.registerComponent(enums_1.ComponentEnum.grid, Grid);
205
- };
206
-
207
- exports.registerCircleGrid = registerCircleGrid;
208
194
  //# sourceMappingURL=grid.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/grid.ts"],"names":[],"mappings":";;;AAAA,6CAAmD;AAInD,qEAA4E;AAgB5E,0CAAmE;AAEnE,mCAAyC;AACzC,iDAAqD;AACrD,wCAAmD;AACnD,iCAAyD;AACzD,6CAA0C;AAEnC,MAAM,8BAA8B,GAAG,CAC5C,KAAiB,EACjB,KAAc,EACd,QAAmD,EACnD,SAAkB,EACM,EAAE;;IAC1B,MAAM,SAAS,GAAG,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,IAAI,mCAAI,EAAE,CAAC;IAChD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,IAAA,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I,CAAC,CAAC;AACtD,CAAC,CAAC;AARW,QAAA,gBAAgB,oBAQ3B;AAEK,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,iBAAO,CAAC,wBAAwB,CAC9B,gBAAQ,CAAC,cAAc,EACvB,CAAC,KAA+B,EAAE,OAA0B,EAAE,EAAE,CAC9D,IAAI,mCAAc,CAAC,KAAK,EAAE,OAAO,CAAwB,CAC5D,CAAC;IAEF,iBAAO,CAAC,iBAAiB,CAAC,qBAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC,CAAC;AARW,QAAA,kBAAkB,sBAQ7B","file":"grid.js","sourcesContent":["import { isString, merge } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport type { CircleAxisGridAttributes, ComponentOptions, LineAxisGridAttributes } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { CircleAxisGrid, LineAxisGrid } from '@visactor/vrender-components';\nimport type { IBaseScale } from '@visactor/vscale';\nimport type {\n BaseSingleEncodeSpec,\n IElement,\n IGroupMark,\n IScale,\n ITheme,\n IView,\n MarkFunctionType,\n MarkRelativeItemSpec,\n Nil,\n RecursivePartial,\n SimpleSignalType,\n StateEncodeSpec\n} from '../types';\nimport { AxisEnum, ComponentEnum, GridEnum } from '../graph/enums';\nimport type { GridShape, GridSpec, AxisType, IAxis, IGrid } from '../types/component';\nimport { ScaleComponent } from './scale';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport { generateCoordinateAxisAttribute } from './axis';\nimport { Factory } from '../core/factory';\n\nexport const generateLineAxisGridAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<LineAxisGridAttributes>,\n tickCount?: number\n): LineAxisGridAttributes => {\n const gridTheme = theme?.components?.grid ?? {};\n if (!scale) {\n return merge({}, gridTheme, addition ?? {});\n }\n const tickData = scale.tickData?.(tickCount) ?? [];\n const items = tickData.map(tick => ({\n id: tick.index,\n label: tick.tick,\n value: tick.value,\n rawValue: tick.tick\n }));\n return merge({}, gridTheme, { items }, addition ?? {});\n};\n\nexport const generateCircleAxisGridAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<CircleAxisGridAttributes>,\n tickCount?: number\n): CircleAxisGridAttributes => {\n const gridTheme = theme?.components?.circleGrid ?? {};\n if (!scale) {\n return merge({}, gridTheme, addition ?? {});\n }\n const tickData = scale.tickData?.(tickCount) ?? [];\n const items = tickData.map(tick => ({\n id: tick.index,\n label: tick.tick,\n value: tick.value,\n rawValue: tick.tick\n }));\n return merge({}, gridTheme, { items }, addition ?? {});\n};\n\nexport class Grid extends ScaleComponent implements IGrid {\n static readonly componentType: string = ComponentEnum.grid;\n protected declare spec: GridSpec;\n\n protected mode?: '2d' | '3d';\n\n private _gridComponentType: keyof typeof GridEnum;\n private _targetAxis: IAxis;\n\n constructor(view: IView, group?: IGroupMark, mode?: '2d' | '3d') {\n super(view, ComponentEnum.grid, group);\n this.spec.componentType = ComponentEnum.grid;\n this.mode = mode;\n }\n\n protected parseAddition(spec: GridSpec) {\n super.parseAddition(spec);\n this.target(spec.target);\n this.gridType(spec.gridType);\n this.gridShape(spec.gridShape);\n return this;\n }\n\n scale(scale?: IScale | string | Nil) {\n super.scale(scale);\n this._gridComponentType = null;\n return this;\n }\n\n gridType(gridType: AxisType | Nil) {\n this.spec.gridType = gridType;\n this._gridComponentType = null;\n this._prepareRejoin();\n this.commit();\n return this;\n }\n\n gridShape(gridShape: GridShape | Nil) {\n this.spec.gridShape = gridShape;\n // no need to rejoin when gridShape is updated\n // this._gridComponentType = null;\n // this._prepareRejoin();\n this.commit();\n return this;\n }\n\n target(axis: IAxis | string | Nil) {\n if (this.spec.target) {\n const prevAxis = isString(this.spec.target)\n ? (this.view.getMarkById(this.spec.target) as IAxis)\n : this.spec.target;\n this.detach(prevAxis);\n }\n this.spec.target = axis;\n const nextAxis = isString(axis) ? (this.view.getMarkById(axis) as IAxis) : axis;\n this.attach(nextAxis);\n this._targetAxis = nextAxis;\n\n // clear grid type when target is updated\n this._gridComponentType = null;\n this._updateComponentEncoders();\n\n this.commit();\n return this;\n }\n\n tickCount(tickCount: SimpleSignalType<number> | Nil) {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n\n if (scaleGrammar) {\n scaleGrammar.tickCount(tickCount);\n }\n\n return this.setFunctionSpec(tickCount, 'tickCount');\n }\n\n inside(inside: MarkFunctionType<boolean> | Nil) {\n return this.setFunctionSpec(inside, 'inside');\n }\n\n baseValue(baseValue: MarkFunctionType<number> | Nil) {\n return this.setFunctionSpec(baseValue, 'baseValue');\n }\n\n addGraphicItem(attrs: any, groupKey?: string) {\n const defaultAttributes = { x: 0, y: 0, start: { x: 0, y: 0 }, end: { x: 0, y: 0 } };\n const initialAttributes = merge(defaultAttributes, attrs);\n const graphicItem = Factory.createGraphicComponent(this._getGridComponentType(), initialAttributes, {\n mode: this.mode,\n skipDefault: this.spec.skipTheme\n });\n return super.addGraphicItem(initialAttributes, groupKey, graphicItem);\n }\n\n protected _updateComponentEncoders() {\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const theme = this.spec.skipTheme ? null : this.view.getCurrentTheme();\n let addition = invokeEncoder(encoder as BaseSingleEncodeSpec, datum, element, parameters);\n let scaleGrammar: IScale;\n const baseValue = invokeFunctionType(this.spec.baseValue, parameters, datum, element);\n\n // get attributes from target axis\n if (this._targetAxis) {\n const targetScale = this._targetAxis.getSpec()?.scale as IScale | string | Nil;\n scaleGrammar = isString(targetScale) ? this.view.getScaleById(targetScale) : targetScale;\n\n const targetElement = this._targetAxis.elements[0];\n if (targetElement) {\n switch (this._getGridComponentType()) {\n case GridEnum.lineAxisGrid:\n addition = Object.assign(\n {\n x: targetElement.getGraphicAttribute('x'),\n y: targetElement.getGraphicAttribute('y'),\n start: targetElement.getGraphicAttribute('start'),\n end: targetElement.getGraphicAttribute('end'),\n verticalFactor: targetElement.getGraphicAttribute('verticalFactor') ?? 1\n },\n addition\n );\n break;\n case GridEnum.circleAxisGrid:\n addition = Object.assign(\n {\n x: targetElement.getGraphicAttribute('x'),\n y: targetElement.getGraphicAttribute('y'),\n center: targetElement.getGraphicAttribute('center'),\n radius: targetElement.getGraphicAttribute('radius'),\n innerRadius: targetElement.getGraphicAttribute('innerRadius'),\n inside: targetElement.getGraphicAttribute('inside'),\n startAngle: targetElement.getGraphicAttribute('startAngle'),\n endAngle: targetElement.getGraphicAttribute('endAngle')\n },\n addition\n );\n break;\n }\n }\n }\n // compute attribute by spec\n else {\n scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n const inside = invokeFunctionType(this.spec.inside, parameters, datum, element);\n\n const coordinate = scaleGrammar?.getCoordinate?.();\n if (coordinate) {\n addition = Object.assign(\n generateCoordinateAxisAttribute(\n scaleGrammar,\n coordinate,\n inside,\n baseValue,\n this.spec.layout as MarkRelativeItemSpec,\n true\n ),\n addition\n );\n }\n }\n\n // compute addition shape attributes for line grid\n if (this._getGridComponentType() === GridEnum.lineAxisGrid) {\n if (this.spec.gridShape === 'line' || !this.spec.gridShape) {\n // set axis type\n addition = Object.assign({}, addition, { type: 'line' });\n } else {\n // set addition length & axis type\n addition = Object.assign(\n {\n center: addition.start,\n closed: true\n },\n addition,\n { type: this.spec.gridShape }\n );\n }\n }\n\n const scale = scaleGrammar?.getScale?.();\n const tickCount = invokeFunctionType(this.spec.tickCount, parameters, datum, element);\n switch (this._getGridComponentType()) {\n case GridEnum.lineAxisGrid:\n return generateLineAxisGridAttributes(scale, theme, addition, tickCount);\n case GridEnum.circleAxisGrid:\n return generateCircleAxisGridAttributes(scale, theme, addition, tickCount);\n }\n return addition;\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n\n private _getGridComponentType() {\n if (this._gridComponentType) {\n return this._gridComponentType;\n }\n\n if (this.spec.gridType) {\n switch (this.spec.gridType) {\n case 'circle':\n this._gridComponentType = GridEnum.circleAxisGrid;\n break;\n case 'line':\n default:\n this._gridComponentType = GridEnum.lineAxisGrid;\n }\n } else if (this._targetAxis) {\n const axisComponentType = this._targetAxis.getAxisComponentType();\n switch (axisComponentType) {\n case AxisEnum.circleAxis:\n this._gridComponentType = GridEnum.circleAxisGrid;\n break;\n case AxisEnum.lineAxis:\n default:\n this._gridComponentType = GridEnum.lineAxisGrid;\n }\n } else if (this.spec.scale) {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n this._gridComponentType = scaleGrammar?.getCoordinate?.()\n ? scaleGrammar.getCoordinateAxisPoints()\n ? GridEnum.lineAxisGrid\n : GridEnum.circleAxisGrid\n : GridEnum.lineAxisGrid;\n } else {\n this._gridComponentType = GridEnum.lineAxisGrid;\n }\n\n return this._gridComponentType;\n }\n}\n\nexport const registerGrid = () => {\n Factory.registerGraphicComponent(\n GridEnum.lineAxisGrid,\n (attrs: LineAxisGridAttributes, options?: ComponentOptions) =>\n new LineAxisGrid(attrs, options) as unknown as IGraphic\n );\n\n Factory.registerGraphicComponent(\n GridEnum.circleAxisGrid,\n (attrs: CircleAxisGridAttributes, options?: ComponentOptions) =>\n new CircleAxisGrid(attrs, options) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.grid, Grid);\n};\n\nexport const registerLineGrid = () => {\n Factory.registerGraphicComponent(\n GridEnum.lineAxisGrid,\n (attrs: LineAxisGridAttributes, options?: ComponentOptions) =>\n new LineAxisGrid(attrs, options) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.grid, Grid);\n};\n\nexport const registerCircleGrid = () => {\n Factory.registerGraphicComponent(\n GridEnum.circleAxisGrid,\n (attrs: CircleAxisGridAttributes, options?: ComponentOptions) =>\n new CircleAxisGrid(attrs, options) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.grid, Grid);\n};\n"]}
1
+ {"version":3,"sources":["../src/component/grid.ts"],"names":[],"mappings":";;;AAAA,6CAAmD;AAInD,qEAA4E;AAgB5E,0CAAmE;AAEnE,mCAAyC;AACzC,iDAAqD;AACrD,wCAAmD;AACnD,iCAAyD;AACzD,6CAA0C;AAEnC,MAAM,8BAA8B,GAAG,CAC5C,KAAiB,EACjB,KAAc,EACd,QAAmD,EACnD,SAAkB,EACM,EAAE;;IAC1B,MAAM,SAAS,GAAG,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,IAAI,mCAAI,EAAE,CAAC;IAChD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,IAAA,cAAK,EAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC,CAAC;KAC7C;IACD,MAAM,QAAQ,GAAG,MAAA,MAAA,KAAK,CAAC,QAAQ,sDAAG,SAAS,CAAC,mCAAI,EAAE,CAAC;IACnD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClC,EAAE,EAAE,IAAI,CAAC,KAAK;QACd,KAAK,EAAE,IAAI,CAAC,IAAI;QAChB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE,IAAI,CAAC,IAAI;KACpB,CAAC,CAAC,CAAC;IACJ,OAAO,IAAA,cAAK,EAAC,EAAE,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC,CAAC;AACzD,CAAC,CAAC;AAlBW,QAAA,8BAA8B,kCAkBzC;AAEK,MAAM,gCAAgC,GAAG,CAC9C,KAAiB,EACjB,KAAc,EACd,QAAqD,EACrD,SAAkB,EACQ,EAAE;;IAC5B,MAAM,SAAS,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B,CAAC,KAA+B,EAAE,OAA0B,EAAE,EAAE,CAC9D,IAAI,mCAAc,CAAC,KAAK,EAAE,OAAO,CAAwB,CAC5D,CAAC;IAEF,iBAAO,CAAC,iBAAiB,CAAC,qBAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC,CAAC;AAdW,QAAA,YAAY,gBAcvB","file":"grid.js","sourcesContent":["import { isString, merge } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport type { CircleAxisGridAttributes, ComponentOptions, LineAxisGridAttributes } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { CircleAxisGrid, LineAxisGrid } from '@visactor/vrender-components';\nimport type { IBaseScale } from '@visactor/vscale';\nimport type {\n BaseSingleEncodeSpec,\n IElement,\n IGroupMark,\n IScale,\n ITheme,\n IView,\n MarkFunctionType,\n MarkRelativeItemSpec,\n Nil,\n RecursivePartial,\n SimpleSignalType,\n StateEncodeSpec\n} from '../types';\nimport { AxisEnum, ComponentEnum, GridEnum } from '../graph/enums';\nimport type { GridShape, GridSpec, AxisType, IAxis, IGrid } from '../types/component';\nimport { ScaleComponent } from './scale';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport { generateCoordinateAxisAttribute } from './axis';\nimport { Factory } from '../core/factory';\n\nexport const generateLineAxisGridAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<LineAxisGridAttributes>,\n tickCount?: number\n): LineAxisGridAttributes => {\n const gridTheme = theme?.components?.grid ?? {};\n if (!scale) {\n return merge({}, gridTheme, addition ?? {});\n }\n const tickData = scale.tickData?.(tickCount) ?? [];\n const items = tickData.map(tick => ({\n id: tick.index,\n label: tick.tick,\n value: tick.value,\n rawValue: tick.tick\n }));\n return merge({}, gridTheme, { items }, addition ?? {});\n};\n\nexport const generateCircleAxisGridAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<CircleAxisGridAttributes>,\n tickCount?: number\n): CircleAxisGridAttributes => {\n const gridTheme = theme?.components?.circleGrid ?? {};\n if (!scale) {\n return merge({}, gridTheme, addition ?? {});\n }\n const tickData = scale.tickData?.(tickCount) ?? [];\n const items = tickData.map(tick => ({\n id: tick.index,\n label: tick.tick,\n value: tick.value,\n rawValue: tick.tick\n }));\n return merge({}, gridTheme, { items }, addition ?? {});\n};\n\nexport class Grid extends ScaleComponent implements IGrid {\n static readonly componentType: string = ComponentEnum.grid;\n protected declare spec: GridSpec;\n\n protected mode?: '2d' | '3d';\n\n private _gridComponentType: keyof typeof GridEnum;\n private _targetAxis: IAxis;\n\n constructor(view: IView, group?: IGroupMark, mode?: '2d' | '3d') {\n super(view, ComponentEnum.grid, group);\n this.spec.componentType = ComponentEnum.grid;\n this.mode = mode;\n }\n\n protected parseAddition(spec: GridSpec) {\n super.parseAddition(spec);\n this.target(spec.target);\n this.gridType(spec.gridType);\n this.gridShape(spec.gridShape);\n return this;\n }\n\n scale(scale?: IScale | string | Nil) {\n super.scale(scale);\n this._gridComponentType = null;\n return this;\n }\n\n gridType(gridType: AxisType | Nil) {\n this.spec.gridType = gridType;\n this._gridComponentType = null;\n this._prepareRejoin();\n this.commit();\n return this;\n }\n\n gridShape(gridShape: GridShape | Nil) {\n this.spec.gridShape = gridShape;\n // no need to rejoin when gridShape is updated\n // this._gridComponentType = null;\n // this._prepareRejoin();\n this.commit();\n return this;\n }\n\n target(axis: IAxis | string | Nil) {\n if (this.spec.target) {\n const prevAxis = isString(this.spec.target)\n ? (this.view.getMarkById(this.spec.target) as IAxis)\n : this.spec.target;\n this.detach(prevAxis);\n }\n this.spec.target = axis;\n const nextAxis = isString(axis) ? (this.view.getMarkById(axis) as IAxis) : axis;\n this.attach(nextAxis);\n this._targetAxis = nextAxis;\n\n // clear grid type when target is updated\n this._gridComponentType = null;\n this._updateComponentEncoders();\n\n this.commit();\n return this;\n }\n\n tickCount(tickCount: SimpleSignalType<number> | Nil) {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n\n if (scaleGrammar) {\n scaleGrammar.tickCount(tickCount);\n }\n\n return this.setFunctionSpec(tickCount, 'tickCount');\n }\n\n inside(inside: MarkFunctionType<boolean> | Nil) {\n return this.setFunctionSpec(inside, 'inside');\n }\n\n baseValue(baseValue: MarkFunctionType<number> | Nil) {\n return this.setFunctionSpec(baseValue, 'baseValue');\n }\n\n addGraphicItem(attrs: any, groupKey?: string) {\n const defaultAttributes = { x: 0, y: 0, start: { x: 0, y: 0 }, end: { x: 0, y: 0 } };\n const initialAttributes = merge(defaultAttributes, attrs);\n const graphicItem = Factory.createGraphicComponent(this._getGridComponentType(), initialAttributes, {\n mode: this.mode,\n skipDefault: this.spec.skipTheme\n });\n return super.addGraphicItem(initialAttributes, groupKey, graphicItem);\n }\n\n protected _updateComponentEncoders() {\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const theme = this.spec.skipTheme ? null : this.view.getCurrentTheme();\n let addition = invokeEncoder(encoder as BaseSingleEncodeSpec, datum, element, parameters);\n let scaleGrammar: IScale;\n const baseValue = invokeFunctionType(this.spec.baseValue, parameters, datum, element);\n\n // get attributes from target axis\n if (this._targetAxis) {\n const targetScale = this._targetAxis.getSpec()?.scale as IScale | string | Nil;\n scaleGrammar = isString(targetScale) ? this.view.getScaleById(targetScale) : targetScale;\n\n const targetElement = this._targetAxis.elements[0];\n if (targetElement) {\n switch (this._getGridComponentType()) {\n case GridEnum.lineAxisGrid:\n addition = Object.assign(\n {\n x: targetElement.getGraphicAttribute('x'),\n y: targetElement.getGraphicAttribute('y'),\n start: targetElement.getGraphicAttribute('start'),\n end: targetElement.getGraphicAttribute('end'),\n verticalFactor: targetElement.getGraphicAttribute('verticalFactor') ?? 1\n },\n addition\n );\n break;\n case GridEnum.circleAxisGrid:\n addition = Object.assign(\n {\n x: targetElement.getGraphicAttribute('x'),\n y: targetElement.getGraphicAttribute('y'),\n center: targetElement.getGraphicAttribute('center'),\n radius: targetElement.getGraphicAttribute('radius'),\n innerRadius: targetElement.getGraphicAttribute('innerRadius'),\n inside: targetElement.getGraphicAttribute('inside'),\n startAngle: targetElement.getGraphicAttribute('startAngle'),\n endAngle: targetElement.getGraphicAttribute('endAngle')\n },\n addition\n );\n break;\n }\n }\n }\n // compute attribute by spec\n else {\n scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n const inside = invokeFunctionType(this.spec.inside, parameters, datum, element);\n\n const coordinate = scaleGrammar?.getCoordinate?.();\n if (coordinate) {\n addition = Object.assign(\n generateCoordinateAxisAttribute(\n scaleGrammar,\n coordinate,\n inside,\n baseValue,\n this.spec.layout as MarkRelativeItemSpec,\n true\n ),\n addition\n );\n }\n }\n\n // compute addition shape attributes for line grid\n if (this._getGridComponentType() === GridEnum.lineAxisGrid) {\n if (this.spec.gridShape === 'line' || !this.spec.gridShape) {\n // set axis type\n addition = Object.assign({}, addition, { type: 'line' });\n } else {\n // set addition length & axis type\n addition = Object.assign(\n {\n center: addition.start,\n closed: true\n },\n addition,\n { type: this.spec.gridShape }\n );\n }\n }\n\n const scale = scaleGrammar?.getScale?.();\n const tickCount = invokeFunctionType(this.spec.tickCount, parameters, datum, element);\n switch (this._getGridComponentType()) {\n case GridEnum.lineAxisGrid:\n return generateLineAxisGridAttributes(scale, theme, addition, tickCount);\n case GridEnum.circleAxisGrid:\n return generateCircleAxisGridAttributes(scale, theme, addition, tickCount);\n }\n return addition;\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n\n private _getGridComponentType() {\n if (this._gridComponentType) {\n return this._gridComponentType;\n }\n\n if (this.spec.gridType) {\n switch (this.spec.gridType) {\n case 'circle':\n this._gridComponentType = GridEnum.circleAxisGrid;\n break;\n case 'line':\n default:\n this._gridComponentType = GridEnum.lineAxisGrid;\n }\n } else if (this._targetAxis) {\n const axisComponentType = this._targetAxis.getAxisComponentType();\n switch (axisComponentType) {\n case AxisEnum.circleAxis:\n this._gridComponentType = GridEnum.circleAxisGrid;\n break;\n case AxisEnum.lineAxis:\n default:\n this._gridComponentType = GridEnum.lineAxisGrid;\n }\n } else if (this.spec.scale) {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n this._gridComponentType = scaleGrammar?.getCoordinate?.()\n ? scaleGrammar.getCoordinateAxisPoints()\n ? GridEnum.lineAxisGrid\n : GridEnum.circleAxisGrid\n : GridEnum.lineAxisGrid;\n } else {\n this._gridComponentType = GridEnum.lineAxisGrid;\n }\n\n return this._gridComponentType;\n }\n}\n\nexport const registerGrid = () => {\n Factory.registerGraphicComponent(\n GridEnum.lineAxisGrid,\n (attrs: LineAxisGridAttributes, options?: ComponentOptions) =>\n new LineAxisGrid(attrs, options) as unknown as IGraphic\n );\n\n Factory.registerGraphicComponent(\n GridEnum.circleAxisGrid,\n (attrs: CircleAxisGridAttributes, options?: ComponentOptions) =>\n new CircleAxisGrid(attrs, options) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.grid, Grid);\n};\n"]}
@@ -1,9 +1,9 @@
1
- export { registerAxis, registerCircleAxis, registerLineAxis } from './axis';
1
+ export { registerAxis } from './axis';
2
2
  export { registerLegend } from './legend';
3
3
  export { registerSlider } from './slider';
4
4
  export { registerLabel } from './label';
5
5
  export { registerDataZoom } from './datazoom';
6
6
  export { registerPlayer } from './player';
7
7
  export { registerTitle } from './title';
8
- export { registerGrid, registerCircleGrid, registerLineGrid } from './grid';
8
+ export { registerGrid } from './grid';
9
9
  export { registerScrollbar } from './scrollbar';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.registerScrollbar = exports.registerLineGrid = exports.registerCircleGrid = exports.registerGrid = exports.registerTitle = exports.registerPlayer = exports.registerDataZoom = exports.registerLabel = exports.registerSlider = exports.registerLegend = exports.registerLineAxis = exports.registerCircleAxis = exports.registerAxis = void 0;
5
+ }), exports.registerScrollbar = exports.registerGrid = exports.registerTitle = exports.registerPlayer = exports.registerDataZoom = exports.registerLabel = exports.registerSlider = exports.registerLegend = exports.registerAxis = void 0;
6
6
 
7
7
  var axis_1 = require("./axis");
8
8
 
@@ -11,16 +11,6 @@ Object.defineProperty(exports, "registerAxis", {
11
11
  get: function() {
12
12
  return axis_1.registerAxis;
13
13
  }
14
- }), Object.defineProperty(exports, "registerCircleAxis", {
15
- enumerable: !0,
16
- get: function() {
17
- return axis_1.registerCircleAxis;
18
- }
19
- }), Object.defineProperty(exports, "registerLineAxis", {
20
- enumerable: !0,
21
- get: function() {
22
- return axis_1.registerLineAxis;
23
- }
24
14
  });
25
15
 
26
16
  var legend_1 = require("./legend");
@@ -84,16 +74,6 @@ Object.defineProperty(exports, "registerGrid", {
84
74
  get: function() {
85
75
  return grid_1.registerGrid;
86
76
  }
87
- }), Object.defineProperty(exports, "registerCircleGrid", {
88
- enumerable: !0,
89
- get: function() {
90
- return grid_1.registerCircleGrid;
91
- }
92
- }), Object.defineProperty(exports, "registerLineGrid", {
93
- enumerable: !0,
94
- get: function() {
95
- return grid_1.registerLineGrid;
96
- }
97
77
  });
98
78
 
99
79
  var scrollbar_1 = require("./scrollbar");
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/index.ts"],"names":[],"mappings":";;;AAAA,+BAA4E;AAAnE,oGAAA,YAAY,OAAA;AAAE,0GAAA,kBAAkB,OAAA;AAAE,wGAAA,gBAAgB,OAAA;AAC3D,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AACtB,uCAA8C;AAArC,4GAAA,gBAAgB,OAAA;AACzB,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AACtB,+BAA4E;AAAnE,oGAAA,YAAY,OAAA;AAAE,0GAAA,kBAAkB,OAAA;AAAE,wGAAA,gBAAgB,OAAA;AAC3D,yCAAgD;AAAvC,8GAAA,iBAAiB,OAAA","file":"index.js","sourcesContent":["export { registerAxis, registerCircleAxis, registerLineAxis } from './axis';\nexport { registerLegend } from './legend';\nexport { registerSlider } from './slider';\nexport { registerLabel } from './label';\nexport { registerDataZoom } from './datazoom';\nexport { registerPlayer } from './player';\nexport { registerTitle } from './title';\nexport { registerGrid, registerCircleGrid, registerLineGrid } from './grid';\nexport { registerScrollbar } from './scrollbar';\n"]}
1
+ {"version":3,"sources":["../src/component/index.ts"],"names":[],"mappings":";;;AAAA,+BAAsC;AAA7B,oGAAA,YAAY,OAAA;AACrB,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AACtB,uCAA8C;AAArC,4GAAA,gBAAgB,OAAA;AACzB,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AACtB,+BAAsC;AAA7B,oGAAA,YAAY,OAAA;AACrB,yCAAgD;AAAvC,8GAAA,iBAAiB,OAAA","file":"index.js","sourcesContent":["export { registerAxis } from './axis';\nexport { registerLegend } from './legend';\nexport { registerSlider } from './slider';\nexport { registerLabel } from './label';\nexport { registerDataZoom } from './datazoom';\nexport { registerPlayer } from './player';\nexport { registerTitle } from './title';\nexport { registerGrid } from './grid';\nexport { registerScrollbar } from './scrollbar';\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { IGraphic, IGraphicAttribute } from '@visactor/vrender-core';
2
- import type { GlyphChannelEncoder, GlyphDefaultEncoder, IComponentConstructor, IElement, IGlyphElement, IGlyphMeta, IGrammarBaseConstructor, IGroupMark, IInteractionConstructor, ILayoutOptions, IMark, IMarkConstructor, IPlotMarkConstructor, ISemanticMark, IStageEventPlugin, ITransform, IView, MarkType, TypeAnimation } from '../types';
2
+ import type { GlyphChannelEncoder, GlyphDefaultEncoder, IComponentConstructor, IElement, IGlyphElement, IGlyphMeta, IGrammarBaseConstructor, IGroupMark, IInteractionConstructor, IMark, IMarkConstructor, IPlotMarkConstructor, ISemanticMark, ITransform, IView, MarkType, TypeAnimation } from '../types';
3
3
  import type { ComponentOptions } from '@visactor/vrender-components';
4
4
  export declare class Factory {
5
5
  private static _plotMarks;
@@ -12,14 +12,11 @@ export declare class Factory {
12
12
  private static _animations;
13
13
  private static _interactions;
14
14
  private static _graphics;
15
- private static defaultLayout;
16
- private static _stageEventPlugins;
17
15
  static registerPlotMarks(key: string, mark: IPlotMarkConstructor): void;
18
16
  static createPlotMark(type: string, id?: string): ISemanticMark<any, any> | null;
19
17
  static registerMark(key: string, mark: IMarkConstructor): void;
20
18
  static createMark(type: string, view: IView, group?: IGroupMark): IMark | null;
21
19
  static hasMark(type: string): boolean;
22
- static getMark(type: string): IMarkConstructor;
23
20
  static registerComponent(key: string, component: IComponentConstructor): void;
24
21
  static createComponent(componentType: string, view: IView, group?: IGroupMark, mode?: '2d' | '3d'): import("../types").IComponent;
25
22
  static hasComponent(componentType: string): boolean;
@@ -48,8 +45,4 @@ export declare class Factory {
48
45
  static registerGraphic: (graphicType: string, creator: (attributes: IGraphicAttribute) => IGraphic) => void;
49
46
  static getGraphicType: (graphicType: string) => (attributes: IGraphicAttribute) => IGraphic;
50
47
  static createGraphic: (graphicType: string, attributes?: IGraphicAttribute) => IGraphic<Partial<IGraphicAttribute>>;
51
- static registerDefaultLayout: (layout: (marks: IMark[], options: ILayoutOptions, view: IView) => void) => void;
52
- static getDefaultLayout: () => (marks: IMark[], options: ILayoutOptions, view: IView) => void;
53
- static registerStageEventPlugin: (type: string, Plugin: IStageEventPlugin<any>) => void;
54
- static getStageEventPlugin: (type: string) => IStageEventPlugin<any>;
55
48
  }
@@ -24,9 +24,6 @@ class Factory {
24
24
  static hasMark(type) {
25
25
  return !!Factory._marks[type];
26
26
  }
27
- static getMark(type) {
28
- return Factory._marks[type];
29
- }
30
27
  static registerComponent(key, component) {
31
28
  Factory._components[key] = component;
32
29
  }
@@ -98,9 +95,5 @@ Factory.registerInteraction = (interactionType, interaction) => {
98
95
  }, Factory.getGraphicType = graphicType => Factory._graphics[graphicType], Factory.createGraphic = (graphicType, attributes) => {
99
96
  const creator = Factory._graphics[graphicType];
100
97
  return creator ? creator(attributes) : null;
101
- }, Factory.registerDefaultLayout = layout => {
102
- Factory.defaultLayout = layout;
103
- }, Factory.getDefaultLayout = () => Factory.defaultLayout, Factory.registerStageEventPlugin = (type, Plugin) => {
104
- Factory._stageEventPlugins[type] = Plugin;
105
- }, Factory.getStageEventPlugin = type => Factory._stageEventPlugins[type];
98
+ };
106
99
  //# sourceMappingURL=factory.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/factory.ts"],"names":[],"mappings":";;;AAsBA,mDAA+C;AAG/C,MAAa,OAAO;IAclB,MAAM,CAAC,iBAAiB,CAAC,GAAW,EAAE,IAA0B;QAC9D,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,IAAY,EAAE,EAAW;QAC7C,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YAC7B,OAAO,IAAI,CAAC;SACb;QACD,MAAM,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACjD,OAAO,IAAI,eAAe,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,GAAW,EAAE,IAAsB;QACrD,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,IAAY,EAAE,IAAW,EAAE,KAA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AAC;AAC5C,CAAC,CAAC;AAEK,2BAAmB,GAAG,CAAC,IAAY,EAAE,EAAE;IAC5C,OAAO,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC,CAAC","file":"factory.js","sourcesContent":["import type { IGraphic, IGraphicAttribute } from '@visactor/vrender-core';\nimport type {\n GlyphChannelEncoder,\n GlyphDefaultEncoder,\n IComponentConstructor,\n IElement,\n IGlyphElement,\n IGlyphMeta,\n IGrammarBaseConstructor,\n IGroupMark,\n IInteractionConstructor,\n ILayoutOptions,\n IMark,\n IMarkConstructor,\n IPlotMarkConstructor,\n ISemanticMark,\n IStageEventPlugin,\n ITransform,\n IView,\n MarkType,\n TypeAnimation\n} from '../types';\nimport { GlyphMeta } from '../view/glyph-meta';\nimport type { ComponentOptions } from '@visactor/vrender-components';\n\nexport class Factory {\n private static _plotMarks: Record<string, IPlotMarkConstructor> = {};\n private static _marks: Record<string, IMarkConstructor> = {};\n private static _components: Record<string, IComponentConstructor> = {};\n private static _graphicComponents: Record<string, (attrs: any, options?: ComponentOptions) => IGraphic> = {};\n private static _transforms: Record<string, ITransform> = {};\n private static _grammars: Record<string, { grammarClass: IGrammarBaseConstructor; specKey: string }> = {};\n private static _glyphs: Record<string, IGlyphMeta<any, any>> = {};\n private static _animations: Record<string, TypeAnimation<IGlyphElement> | TypeAnimation<IElement>> = {};\n private static _interactions: Record<string, IInteractionConstructor> = {};\n private static _graphics: Record<string, (attributes: IGraphicAttribute) => IGraphic> = {};\n private static defaultLayout: (marks: IMark[], options: ILayoutOptions, view: IView) => void;\n private static _stageEventPlugins: Record<string, IStageEventPlugin<any>>;\n\n static registerPlotMarks(key: string, mark: IPlotMarkConstructor) {\n Factory._plotMarks[key] = mark;\n }\n\n static createPlotMark(type: string, id?: string): ISemanticMark<any, any> | null {\n if (!Factory._plotMarks[type]) {\n return null;\n }\n const MarkConstructor = Factory._plotMarks[type];\n return new MarkConstructor(id);\n }\n\n static registerMark(key: string, mark: IMarkConstructor) {\n Factory._marks[key] = mark;\n }\n\n static createMark(type: string, view: IView, group?: IGroupMark): IMark | null {\n if (!Factory._marks[type]) {\n return null;\n }\n const MarkConstructor = Factory._marks[type];\n return new MarkConstructor(view, type, group);\n }\n\n static hasMark(type: string) {\n return !!Factory._marks[type];\n }\n\n static getMark(type: string) {\n return Factory._marks[type];\n }\n\n static registerComponent(key: string, component: IComponentConstructor) {\n Factory._components[key] = component;\n }\n\n static createComponent(componentType: string, view: IView, group?: IGroupMark, mode?: '2d' | '3d') {\n const Ctor = Factory._components[componentType];\n if (!Ctor) {\n return null;\n }\n\n return new Ctor(view, group, mode);\n }\n\n static hasComponent(componentType: string) {\n return !!Factory._components[componentType];\n }\n\n static registerGraphicComponent(key: string, creator: (attrs: any, options?: ComponentOptions) => IGraphic) {\n Factory._graphicComponents[key] = creator;\n }\n\n static createGraphicComponent(componentType: string, attrs: any, options?: ComponentOptions) {\n const compCreator = Factory._graphicComponents[componentType];\n\n if (!compCreator) {\n return null;\n }\n\n return compCreator(attrs, options);\n }\n\n static registerTransform(type: string, transform: Omit<ITransform, 'type'>, isBuiltIn?: boolean) {\n Factory._transforms[type] = Object.assign(transform, { type, isBuiltIn: !!isBuiltIn });\n }\n\n static getTransform(type: string) {\n return Factory._transforms[type];\n }\n\n static unregisterRuntimeTransforms() {\n Object.keys(Factory._transforms).forEach(type => {\n if (Factory._transforms[type] && !Factory._transforms[type].isBuiltIn) {\n Factory._transforms[type] = null;\n }\n });\n }\n\n static registerGrammar(type: string, grammarClass: IGrammarBaseConstructor, specKey?: string) {\n Factory._grammars[type] = {\n grammarClass: grammarClass,\n specKey: specKey ?? type\n };\n }\n\n static createGrammar(type: string, view: IView, grammarType: string) {\n const Ctor = Factory._grammars[type]?.grammarClass;\n\n if (!Ctor) {\n return null;\n }\n\n return new Ctor(view, grammarType);\n }\n\n static getGrammars() {\n return this._grammars;\n }\n\n static registerGlyph = <EncodeValuesType = any, GlyphConfigType = any>(\n glyphType: string,\n marks: { [markName: string]: MarkType },\n encoders?: { [markName: string]: GlyphChannelEncoder<any, EncodeValuesType, GlyphConfigType> },\n defaultEncoder?: GlyphDefaultEncoder,\n progressiveChannels?: string | string[]\n ): IGlyphMeta<EncodeValuesType, GlyphConfigType> => {\n Factory._glyphs[glyphType] = new GlyphMeta<EncodeValuesType, GlyphConfigType>(\n marks,\n encoders,\n defaultEncoder,\n progressiveChannels\n );\n return Factory._glyphs[glyphType];\n };\n\n static getGlyph(glyphType: string): IGlyphMeta {\n return Factory._glyphs[glyphType];\n }\n\n static registerAnimationType = (\n animationType: string,\n animation: TypeAnimation<IGlyphElement> | TypeAnimation<IElement>\n ): void => {\n Factory._animations[animationType] = animation;\n };\n\n static getAnimationType = (animationType: string) => {\n return Factory._animations[animationType];\n };\n\n static registerInteraction = (interactionType: string, interaction: IInteractionConstructor) => {\n Factory._interactions[interactionType] = interaction;\n };\n\n static createInteraction(interactionType: string, view: IView, options?: any) {\n const Ctor = Factory._interactions[interactionType];\n if (!Ctor) {\n return null;\n }\n\n return new Ctor(view, options);\n }\n\n static hasInteraction(interactionType: string) {\n return !!Factory._interactions[interactionType];\n }\n\n static registerGraphic = (graphicType: string, creator: (attributes: IGraphicAttribute) => IGraphic) => {\n Factory._graphics[graphicType] = creator;\n };\n\n static getGraphicType = (graphicType: string) => {\n return Factory._graphics[graphicType];\n };\n\n static createGraphic = (graphicType: string, attributes?: IGraphicAttribute) => {\n const creator = Factory._graphics[graphicType];\n if (!creator) {\n return null;\n }\n return creator(attributes);\n };\n\n static registerDefaultLayout = (layout: (marks: IMark[], options: ILayoutOptions, view: IView) => void) => {\n Factory.defaultLayout = layout;\n };\n\n static getDefaultLayout = () => {\n return Factory.defaultLayout;\n };\n\n static registerStageEventPlugin = (type: string, Plugin: IStageEventPlugin<any>) => {\n Factory._stageEventPlugins[type] = Plugin;\n };\n\n static getStageEventPlugin = (type: string) => {\n return Factory._stageEventPlugins[type];\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/core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B,EAAE,UAA8B,EAAE,EAAE;IAC7E,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,IAAI,CAAC;KACb;IACD,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC,CAAC","file":"factory.js","sourcesContent":["import type { IGraphic, IGraphicAttribute } from '@visactor/vrender-core';\nimport type {\n GlyphChannelEncoder,\n GlyphDefaultEncoder,\n IComponentConstructor,\n IElement,\n IGlyphElement,\n IGlyphMeta,\n IGrammarBaseConstructor,\n IGroupMark,\n IInteractionConstructor,\n IMark,\n IMarkConstructor,\n IPlotMarkConstructor,\n ISemanticMark,\n ITransform,\n IView,\n MarkType,\n TypeAnimation\n} from '../types';\nimport { GlyphMeta } from '../view/glyph-meta';\nimport type { ComponentOptions } from '@visactor/vrender-components';\n\nexport class Factory {\n private static _plotMarks: Record<string, IPlotMarkConstructor> = {};\n private static _marks: Record<string, IMarkConstructor> = {};\n private static _components: Record<string, IComponentConstructor> = {};\n private static _graphicComponents: Record<string, (attrs: any, options?: ComponentOptions) => IGraphic> = {};\n private static _transforms: Record<string, ITransform> = {};\n private static _grammars: Record<string, { grammarClass: IGrammarBaseConstructor; specKey: string }> = {};\n private static _glyphs: Record<string, IGlyphMeta<any, any>> = {};\n private static _animations: Record<string, TypeAnimation<IGlyphElement> | TypeAnimation<IElement>> = {};\n private static _interactions: Record<string, IInteractionConstructor> = {};\n private static _graphics: Record<string, (attributes: IGraphicAttribute) => IGraphic> = {};\n\n static registerPlotMarks(key: string, mark: IPlotMarkConstructor) {\n Factory._plotMarks[key] = mark;\n }\n\n static createPlotMark(type: string, id?: string): ISemanticMark<any, any> | null {\n if (!Factory._plotMarks[type]) {\n return null;\n }\n const MarkConstructor = Factory._plotMarks[type];\n return new MarkConstructor(id);\n }\n\n static registerMark(key: string, mark: IMarkConstructor) {\n Factory._marks[key] = mark;\n }\n\n static createMark(type: string, view: IView, group?: IGroupMark): IMark | null {\n if (!Factory._marks[type]) {\n return null;\n }\n const MarkConstructor = Factory._marks[type];\n return new MarkConstructor(view, type, group);\n }\n\n static hasMark(type: string) {\n return !!Factory._marks[type];\n }\n\n static registerComponent(key: string, component: IComponentConstructor) {\n Factory._components[key] = component;\n }\n\n static createComponent(componentType: string, view: IView, group?: IGroupMark, mode?: '2d' | '3d') {\n const Ctor = Factory._components[componentType];\n if (!Ctor) {\n return null;\n }\n\n return new Ctor(view, group, mode);\n }\n\n static hasComponent(componentType: string) {\n return !!Factory._components[componentType];\n }\n\n static registerGraphicComponent(key: string, creator: (attrs: any, options?: ComponentOptions) => IGraphic) {\n Factory._graphicComponents[key] = creator;\n }\n\n static createGraphicComponent(componentType: string, attrs: any, options?: ComponentOptions) {\n const compCreator = Factory._graphicComponents[componentType];\n\n if (!compCreator) {\n return null;\n }\n\n return compCreator(attrs, options);\n }\n\n static registerTransform(type: string, transform: Omit<ITransform, 'type'>, isBuiltIn?: boolean) {\n Factory._transforms[type] = Object.assign(transform, { type, isBuiltIn: !!isBuiltIn });\n }\n\n static getTransform(type: string) {\n return Factory._transforms[type];\n }\n\n static unregisterRuntimeTransforms() {\n Object.keys(Factory._transforms).forEach(type => {\n if (Factory._transforms[type] && !Factory._transforms[type].isBuiltIn) {\n Factory._transforms[type] = null;\n }\n });\n }\n\n static registerGrammar(type: string, grammarClass: IGrammarBaseConstructor, specKey?: string) {\n Factory._grammars[type] = {\n grammarClass: grammarClass,\n specKey: specKey ?? type\n };\n }\n\n static createGrammar(type: string, view: IView, grammarType: string) {\n const Ctor = Factory._grammars[type]?.grammarClass;\n\n if (!Ctor) {\n return null;\n }\n\n return new Ctor(view, grammarType);\n }\n\n static getGrammars() {\n return this._grammars;\n }\n\n static registerGlyph = <EncodeValuesType = any, GlyphConfigType = any>(\n glyphType: string,\n marks: { [markName: string]: MarkType },\n encoders?: { [markName: string]: GlyphChannelEncoder<any, EncodeValuesType, GlyphConfigType> },\n defaultEncoder?: GlyphDefaultEncoder,\n progressiveChannels?: string | string[]\n ): IGlyphMeta<EncodeValuesType, GlyphConfigType> => {\n Factory._glyphs[glyphType] = new GlyphMeta<EncodeValuesType, GlyphConfigType>(\n marks,\n encoders,\n defaultEncoder,\n progressiveChannels\n );\n return Factory._glyphs[glyphType];\n };\n\n static getGlyph(glyphType: string): IGlyphMeta {\n return Factory._glyphs[glyphType];\n }\n\n static registerAnimationType = (\n animationType: string,\n animation: TypeAnimation<IGlyphElement> | TypeAnimation<IElement>\n ): void => {\n Factory._animations[animationType] = animation;\n };\n\n static getAnimationType = (animationType: string) => {\n return Factory._animations[animationType];\n };\n\n static registerInteraction = (interactionType: string, interaction: IInteractionConstructor) => {\n Factory._interactions[interactionType] = interaction;\n };\n\n static createInteraction(interactionType: string, view: IView, options?: any) {\n const Ctor = Factory._interactions[interactionType];\n if (!Ctor) {\n return null;\n }\n\n return new Ctor(view, options);\n }\n\n static hasInteraction(interactionType: string) {\n return !!Factory._interactions[interactionType];\n }\n\n static registerGraphic = (graphicType: string, creator: (attributes: IGraphicAttribute) => IGraphic) => {\n Factory._graphics[graphicType] = creator;\n };\n\n static getGraphicType = (graphicType: string) => {\n return Factory._graphics[graphicType];\n };\n\n static createGraphic = (graphicType: string, attributes?: IGraphicAttribute) => {\n const creator = Factory._graphics[graphicType];\n if (!creator) {\n return null;\n }\n return creator(attributes);\n };\n}\n"]}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.registerBarBoxplotGlyph = exports.barBoxplotScaleOut = exports.barBoxplotScaleIn = exports.registerBoxplotGlyph = exports.boxplotScaleOut = exports.boxplotScaleIn = void 0;
6
6
 
7
- const vutils_1 = require("@visactor/vutils"), factory_1 = require("../core/factory"), graphic_1 = require("../graph/mark/graphic"), vgrammar_util_1 = require("@visactor/vgrammar-util"), glyph_1 = require("../view/glyph"), scaleIn = computeCenter => (element, options, animationParameters) => {
7
+ const vutils_1 = require("@visactor/vutils"), factory_1 = require("../core/factory"), graphic_1 = require("../graph/mark/graphic"), vgrammar_util_1 = require("@visactor/vgrammar-util"), scaleIn = computeCenter => (element, options, animationParameters) => {
8
8
  var _a, _b, _c;
9
9
  const direction = null !== (_c = null !== (_a = element.getGraphicAttribute("direction", !1)) && void 0 !== _a ? _a : null === (_b = element.mark.getGlyphConfig()) || void 0 === _b ? void 0 : _b.direction) && void 0 !== _c ? _c : "vertical", center = computeCenter(element, direction, options);
10
10
  if (!(0, vutils_1.isValidNumber)(center)) return {};
@@ -250,8 +250,8 @@ function registerBoxplotGlyph() {
250
250
  }
251
251
  }))), factory_1.Factory.registerAnimationType("boxplotScaleIn", exports.boxplotScaleIn),
252
252
  factory_1.Factory.registerAnimationType("boxplotScaleOut", exports.boxplotScaleOut),
253
- (0, glyph_1.registerGlyphMark)(), (0, graphic_1.registerGlyphGraphic)(), (0, graphic_1.registerRectGraphic)(),
254
- (0, graphic_1.registerRuleGraphic)();
253
+ (0, graphic_1.registerGlyphGraphic)(), (0, graphic_1.registerRectGraphic)(), (0,
254
+ graphic_1.registerRuleGraphic)();
255
255
  }
256
256
 
257
257
  exports.boxplotScaleIn = scaleIn(computeBoxplotCenter), exports.boxplotScaleOut = scaleOut(computeBoxplotCenter),
@@ -425,8 +425,8 @@ function registerBarBoxplotGlyph() {
425
425
  }
426
426
  }))), factory_1.Factory.registerAnimationType("barBoxplotScaleIn", exports.barBoxplotScaleIn),
427
427
  factory_1.Factory.registerAnimationType("barBoxplotScaleOut", exports.barBoxplotScaleOut),
428
- (0, glyph_1.registerGlyphMark)(), (0, graphic_1.registerGlyphGraphic)(), (0, graphic_1.registerRectGraphic)(),
429
- (0, graphic_1.registerRuleGraphic)();
428
+ (0, graphic_1.registerGlyphGraphic)(), (0, graphic_1.registerRectGraphic)(), (0,
429
+ graphic_1.registerRuleGraphic)();
430
430
  }
431
431
 
432
432
  exports.barBoxplotScaleIn = scaleIn(computeBarBoxplotCenter), exports.barBoxplotScaleOut = scaleOut(computeBarBoxplotCenter),