@antv/component 1.0.1-beta.3 → 1.0.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 (289) hide show
  1. package/dist/component.min.js +1 -1
  2. package/esm/animation/fadeIn.d.ts +1 -1
  3. package/esm/animation/fadeOut.d.ts +1 -1
  4. package/esm/animation/utils.d.ts +3 -3
  5. package/esm/animation/utils.js +14 -10
  6. package/esm/animation/utils.js.map +1 -1
  7. package/esm/ui/axis/constant.js +2 -1
  8. package/esm/ui/axis/constant.js.map +1 -1
  9. package/esm/ui/axis/guides/labels.js +9 -11
  10. package/esm/ui/axis/guides/labels.js.map +1 -1
  11. package/esm/ui/axis/guides/line.js +2 -2
  12. package/esm/ui/axis/guides/line.js.map +1 -1
  13. package/esm/ui/axis/guides/ticks.js +1 -1
  14. package/esm/ui/axis/guides/ticks.js.map +1 -1
  15. package/esm/ui/axis/guides/title.js +9 -6
  16. package/esm/ui/axis/guides/title.js.map +1 -1
  17. package/esm/ui/axis/overlap/autoEllipsis.js +2 -1
  18. package/esm/ui/axis/overlap/autoEllipsis.js.map +1 -1
  19. package/esm/ui/axis/overlap/autoHide.js +2 -1
  20. package/esm/ui/axis/overlap/autoHide.js.map +1 -1
  21. package/esm/ui/axis/utils/bounds.d.ts +1 -3
  22. package/esm/ui/axis/utils/bounds.js +7 -4
  23. package/esm/ui/axis/utils/bounds.js.map +1 -1
  24. package/esm/ui/breadcrumb/index.js +2 -2
  25. package/esm/ui/breadcrumb/index.js.map +1 -1
  26. package/esm/ui/button/index.js +6 -8
  27. package/esm/ui/button/index.js.map +1 -1
  28. package/esm/ui/button/types.d.ts +0 -2
  29. package/esm/ui/checkbox/constant.d.ts +3 -3
  30. package/esm/ui/checkbox/constant.js +1 -1
  31. package/esm/ui/checkbox/constant.js.map +1 -1
  32. package/esm/ui/checkbox/index.js +1 -1
  33. package/esm/ui/checkbox/index.js.map +1 -1
  34. package/esm/ui/crosshair/base.js +1 -1
  35. package/esm/ui/crosshair/base.js.map +1 -1
  36. package/esm/ui/crosshair/circle.js +1 -1
  37. package/esm/ui/crosshair/circle.js.map +1 -1
  38. package/esm/ui/crosshair/polygon.js +1 -1
  39. package/esm/ui/crosshair/polygon.js.map +1 -1
  40. package/esm/ui/grid/index.js +3 -3
  41. package/esm/ui/grid/index.js.map +1 -1
  42. package/esm/ui/indicator/indicator.js +2 -3
  43. package/esm/ui/indicator/indicator.js.map +1 -1
  44. package/esm/ui/indicator/types.d.ts +0 -2
  45. package/esm/ui/layout/layout.js +1 -3
  46. package/esm/ui/layout/layout.js.map +1 -1
  47. package/esm/ui/layout/types.d.ts +0 -2
  48. package/esm/ui/legend/category/item.d.ts +0 -2
  49. package/esm/ui/legend/category/item.js +4 -10
  50. package/esm/ui/legend/category/item.js.map +1 -1
  51. package/esm/ui/legend/category/items.d.ts +0 -2
  52. package/esm/ui/legend/category/items.js.map +1 -1
  53. package/esm/ui/legend/category.js +2 -4
  54. package/esm/ui/legend/category.js.map +1 -1
  55. package/esm/ui/legend/continuous/ribbon.js +4 -4
  56. package/esm/ui/legend/continuous/ribbon.js.map +1 -1
  57. package/esm/ui/legend/continuous.d.ts +1 -0
  58. package/esm/ui/legend/continuous.js +17 -5
  59. package/esm/ui/legend/continuous.js.map +1 -1
  60. package/esm/ui/marker/index.js +4 -4
  61. package/esm/ui/marker/index.js.map +1 -1
  62. package/esm/ui/marker/types.d.ts +0 -2
  63. package/esm/ui/navigator/index.js +1 -6
  64. package/esm/ui/navigator/index.js.map +1 -1
  65. package/esm/ui/navigator/types.d.ts +0 -2
  66. package/esm/ui/scrollbar/index.js +2 -4
  67. package/esm/ui/scrollbar/index.js.map +1 -1
  68. package/esm/ui/scrollbar/types.d.ts +0 -2
  69. package/esm/ui/select/option.js +1 -1
  70. package/esm/ui/select/option.js.map +1 -1
  71. package/esm/ui/select/select.js +9 -11
  72. package/esm/ui/select/select.js.map +1 -1
  73. package/esm/ui/select/types.d.ts +0 -4
  74. package/esm/ui/slider/constant.d.ts +0 -2
  75. package/esm/ui/slider/constant.js +0 -2
  76. package/esm/ui/slider/constant.js.map +1 -1
  77. package/esm/ui/slider/handle.d.ts +0 -4
  78. package/esm/ui/slider/handle.js +17 -14
  79. package/esm/ui/slider/handle.js.map +1 -1
  80. package/esm/ui/slider/index.js +16 -17
  81. package/esm/ui/slider/index.js.map +1 -1
  82. package/esm/ui/slider/types.d.ts +0 -2
  83. package/esm/ui/sparkline/columns.d.ts +0 -2
  84. package/esm/ui/sparkline/columns.js +1 -2
  85. package/esm/ui/sparkline/columns.js.map +1 -1
  86. package/esm/ui/sparkline/index.js +4 -6
  87. package/esm/ui/sparkline/index.js.map +1 -1
  88. package/esm/ui/sparkline/lines.d.ts +0 -2
  89. package/esm/ui/sparkline/lines.js +1 -2
  90. package/esm/ui/sparkline/lines.js.map +1 -1
  91. package/esm/ui/sparkline/types.d.ts +0 -2
  92. package/esm/ui/switch/index.js +0 -1
  93. package/esm/ui/switch/index.js.map +1 -1
  94. package/esm/ui/switch/types.d.ts +0 -2
  95. package/esm/ui/tag/index.js +0 -1
  96. package/esm/ui/tag/index.js.map +1 -1
  97. package/esm/ui/tag/types.d.ts +0 -2
  98. package/esm/ui/timebar/controller.js +8 -8
  99. package/esm/ui/timebar/controller.js.map +1 -1
  100. package/esm/ui/timebar/handle.d.ts +0 -4
  101. package/esm/ui/timebar/handle.js +7 -9
  102. package/esm/ui/timebar/handle.js.map +1 -1
  103. package/esm/ui/timebar/icons.js +91 -104
  104. package/esm/ui/timebar/icons.js.map +1 -1
  105. package/esm/ui/timebar/timebar.js +6 -14
  106. package/esm/ui/timebar/timebar.js.map +1 -1
  107. package/esm/ui/timebar/types.d.ts +0 -4
  108. package/esm/ui/tooltip/types.d.ts +0 -2
  109. package/esm/util/keyframe-interpolate.d.ts +1 -1
  110. package/esm/util/offscreen.js +0 -1
  111. package/esm/util/offscreen.js.map +1 -1
  112. package/esm/util/primitive.js +3 -0
  113. package/esm/util/primitive.js.map +1 -1
  114. package/esm/util/scale-to-pixel.js +2 -3
  115. package/esm/util/scale-to-pixel.js.map +1 -1
  116. package/esm/util/text.d.ts +1 -6
  117. package/lib/animation/fadeIn.d.ts +1 -1
  118. package/lib/animation/fadeOut.d.ts +1 -1
  119. package/lib/animation/utils.d.ts +3 -3
  120. package/lib/animation/utils.js +14 -10
  121. package/lib/animation/utils.js.map +1 -1
  122. package/lib/ui/axis/constant.js +2 -1
  123. package/lib/ui/axis/constant.js.map +1 -1
  124. package/lib/ui/axis/guides/labels.js +9 -11
  125. package/lib/ui/axis/guides/labels.js.map +1 -1
  126. package/lib/ui/axis/guides/line.js +2 -2
  127. package/lib/ui/axis/guides/line.js.map +1 -1
  128. package/lib/ui/axis/guides/ticks.js +1 -1
  129. package/lib/ui/axis/guides/ticks.js.map +1 -1
  130. package/lib/ui/axis/guides/title.js +8 -5
  131. package/lib/ui/axis/guides/title.js.map +1 -1
  132. package/lib/ui/axis/overlap/autoEllipsis.js +2 -1
  133. package/lib/ui/axis/overlap/autoEllipsis.js.map +1 -1
  134. package/lib/ui/axis/overlap/autoHide.js +2 -1
  135. package/lib/ui/axis/overlap/autoHide.js.map +1 -1
  136. package/lib/ui/axis/utils/bounds.d.ts +1 -3
  137. package/lib/ui/axis/utils/bounds.js +9 -5
  138. package/lib/ui/axis/utils/bounds.js.map +1 -1
  139. package/lib/ui/breadcrumb/index.js +2 -2
  140. package/lib/ui/breadcrumb/index.js.map +1 -1
  141. package/lib/ui/button/index.js +6 -8
  142. package/lib/ui/button/index.js.map +1 -1
  143. package/lib/ui/button/types.d.ts +0 -2
  144. package/lib/ui/checkbox/constant.d.ts +3 -3
  145. package/lib/ui/checkbox/constant.js +1 -1
  146. package/lib/ui/checkbox/constant.js.map +1 -1
  147. package/lib/ui/checkbox/index.js +1 -1
  148. package/lib/ui/checkbox/index.js.map +1 -1
  149. package/lib/ui/crosshair/base.js +1 -1
  150. package/lib/ui/crosshair/base.js.map +1 -1
  151. package/lib/ui/crosshair/circle.js +1 -1
  152. package/lib/ui/crosshair/circle.js.map +1 -1
  153. package/lib/ui/crosshair/polygon.js +1 -1
  154. package/lib/ui/crosshair/polygon.js.map +1 -1
  155. package/lib/ui/grid/index.js +3 -3
  156. package/lib/ui/grid/index.js.map +1 -1
  157. package/lib/ui/indicator/indicator.js +2 -3
  158. package/lib/ui/indicator/indicator.js.map +1 -1
  159. package/lib/ui/indicator/types.d.ts +0 -2
  160. package/lib/ui/layout/layout.js +1 -3
  161. package/lib/ui/layout/layout.js.map +1 -1
  162. package/lib/ui/layout/types.d.ts +0 -2
  163. package/lib/ui/legend/category/item.d.ts +0 -2
  164. package/lib/ui/legend/category/item.js +4 -10
  165. package/lib/ui/legend/category/item.js.map +1 -1
  166. package/lib/ui/legend/category/items.d.ts +0 -2
  167. package/lib/ui/legend/category/items.js.map +1 -1
  168. package/lib/ui/legend/category.js +2 -4
  169. package/lib/ui/legend/category.js.map +1 -1
  170. package/lib/ui/legend/continuous/ribbon.js +4 -4
  171. package/lib/ui/legend/continuous/ribbon.js.map +1 -1
  172. package/lib/ui/legend/continuous.d.ts +1 -0
  173. package/lib/ui/legend/continuous.js +17 -5
  174. package/lib/ui/legend/continuous.js.map +1 -1
  175. package/lib/ui/marker/index.js +4 -4
  176. package/lib/ui/marker/index.js.map +1 -1
  177. package/lib/ui/marker/types.d.ts +0 -2
  178. package/lib/ui/navigator/index.js +1 -6
  179. package/lib/ui/navigator/index.js.map +1 -1
  180. package/lib/ui/navigator/types.d.ts +0 -2
  181. package/lib/ui/scrollbar/index.js +2 -4
  182. package/lib/ui/scrollbar/index.js.map +1 -1
  183. package/lib/ui/scrollbar/types.d.ts +0 -2
  184. package/lib/ui/select/option.js +1 -1
  185. package/lib/ui/select/option.js.map +1 -1
  186. package/lib/ui/select/select.js +9 -11
  187. package/lib/ui/select/select.js.map +1 -1
  188. package/lib/ui/select/types.d.ts +0 -4
  189. package/lib/ui/slider/constant.d.ts +0 -2
  190. package/lib/ui/slider/constant.js +0 -2
  191. package/lib/ui/slider/constant.js.map +1 -1
  192. package/lib/ui/slider/handle.d.ts +0 -4
  193. package/lib/ui/slider/handle.js +17 -14
  194. package/lib/ui/slider/handle.js.map +1 -1
  195. package/lib/ui/slider/index.js +16 -17
  196. package/lib/ui/slider/index.js.map +1 -1
  197. package/lib/ui/slider/types.d.ts +0 -2
  198. package/lib/ui/sparkline/columns.d.ts +0 -2
  199. package/lib/ui/sparkline/columns.js +1 -2
  200. package/lib/ui/sparkline/columns.js.map +1 -1
  201. package/lib/ui/sparkline/index.js +4 -6
  202. package/lib/ui/sparkline/index.js.map +1 -1
  203. package/lib/ui/sparkline/lines.d.ts +0 -2
  204. package/lib/ui/sparkline/lines.js +1 -2
  205. package/lib/ui/sparkline/lines.js.map +1 -1
  206. package/lib/ui/sparkline/types.d.ts +0 -2
  207. package/lib/ui/switch/index.js +0 -1
  208. package/lib/ui/switch/index.js.map +1 -1
  209. package/lib/ui/switch/types.d.ts +0 -2
  210. package/lib/ui/tag/index.js +0 -1
  211. package/lib/ui/tag/index.js.map +1 -1
  212. package/lib/ui/tag/types.d.ts +0 -2
  213. package/lib/ui/timebar/controller.js +8 -8
  214. package/lib/ui/timebar/controller.js.map +1 -1
  215. package/lib/ui/timebar/handle.d.ts +0 -4
  216. package/lib/ui/timebar/handle.js +7 -9
  217. package/lib/ui/timebar/handle.js.map +1 -1
  218. package/lib/ui/timebar/icons.js +91 -104
  219. package/lib/ui/timebar/icons.js.map +1 -1
  220. package/lib/ui/timebar/timebar.js +6 -14
  221. package/lib/ui/timebar/timebar.js.map +1 -1
  222. package/lib/ui/timebar/types.d.ts +0 -4
  223. package/lib/ui/tooltip/types.d.ts +0 -2
  224. package/lib/util/keyframe-interpolate.d.ts +1 -1
  225. package/lib/util/offscreen.js +0 -1
  226. package/lib/util/offscreen.js.map +1 -1
  227. package/lib/util/primitive.js +3 -0
  228. package/lib/util/primitive.js.map +1 -1
  229. package/lib/util/scale-to-pixel.js +2 -3
  230. package/lib/util/scale-to-pixel.js.map +1 -1
  231. package/lib/util/text.d.ts +1 -6
  232. package/package.json +7 -6
  233. package/src/animation/utils.ts +15 -16
  234. package/src/ui/axis/constant.ts +2 -1
  235. package/src/ui/axis/guides/labels.ts +10 -18
  236. package/src/ui/axis/guides/line.ts +2 -2
  237. package/src/ui/axis/guides/ticks.ts +1 -1
  238. package/src/ui/axis/guides/title.ts +9 -9
  239. package/src/ui/axis/overlap/autoEllipsis.ts +2 -1
  240. package/src/ui/axis/overlap/autoHide.ts +2 -1
  241. package/src/ui/axis/utils/bounds.ts +7 -4
  242. package/src/ui/breadcrumb/index.ts +3 -2
  243. package/src/ui/button/index.ts +6 -10
  244. package/src/ui/button/types.ts +0 -2
  245. package/src/ui/checkbox/constant.ts +1 -1
  246. package/src/ui/checkbox/index.ts +2 -0
  247. package/src/ui/crosshair/base.ts +1 -1
  248. package/src/ui/crosshair/circle.ts +1 -1
  249. package/src/ui/crosshair/polygon.ts +1 -1
  250. package/src/ui/grid/index.ts +3 -3
  251. package/src/ui/indicator/indicator.ts +2 -3
  252. package/src/ui/indicator/types.ts +0 -2
  253. package/src/ui/layout/layout.ts +1 -4
  254. package/src/ui/layout/types.ts +0 -2
  255. package/src/ui/legend/category/item.ts +4 -14
  256. package/src/ui/legend/category/items.ts +0 -2
  257. package/src/ui/legend/category.ts +2 -4
  258. package/src/ui/legend/continuous/ribbon.ts +4 -4
  259. package/src/ui/legend/continuous.ts +20 -5
  260. package/src/ui/marker/index.ts +4 -5
  261. package/src/ui/marker/types.ts +0 -2
  262. package/src/ui/navigator/index.ts +1 -8
  263. package/src/ui/navigator/types.ts +0 -2
  264. package/src/ui/scrollbar/index.ts +1 -5
  265. package/src/ui/scrollbar/types.ts +0 -2
  266. package/src/ui/select/option.ts +1 -1
  267. package/src/ui/select/select.ts +9 -11
  268. package/src/ui/select/types.ts +0 -4
  269. package/src/ui/slider/constant.ts +0 -2
  270. package/src/ui/slider/handle.ts +14 -26
  271. package/src/ui/slider/index.ts +12 -20
  272. package/src/ui/slider/types.ts +0 -2
  273. package/src/ui/sparkline/columns.ts +1 -4
  274. package/src/ui/sparkline/index.ts +4 -10
  275. package/src/ui/sparkline/lines.ts +1 -4
  276. package/src/ui/sparkline/types.ts +0 -2
  277. package/src/ui/switch/index.ts +0 -1
  278. package/src/ui/switch/types.ts +0 -2
  279. package/src/ui/tag/index.ts +0 -1
  280. package/src/ui/tag/types.ts +0 -2
  281. package/src/ui/timebar/controller.ts +8 -8
  282. package/src/ui/timebar/handle.ts +10 -16
  283. package/src/ui/timebar/icons.ts +87 -94
  284. package/src/ui/timebar/timebar.ts +9 -13
  285. package/src/ui/timebar/types.ts +0 -4
  286. package/src/ui/tooltip/types.ts +0 -2
  287. package/src/util/offscreen.ts +0 -1
  288. package/src/util/primitive.ts +3 -0
  289. package/src/util/scale-to-pixel.ts +1 -3
@@ -42,8 +42,6 @@ export type CategoryItemStyleProps = GroupStyleProps &
42
42
  valueText?: ExtendDisplayObject;
43
43
  // if width and height not specific, set it to actual space occurred
44
44
  width?: number;
45
- x?: number;
46
- y?: number;
47
45
  };
48
46
 
49
47
  export type CategoryItemOptions = ComponentOptions<CategoryItemStyleProps>;
@@ -198,8 +196,7 @@ export class CategoryItem extends Component<CategoryItemStyleProps> {
198
196
 
199
197
  // record the scale of marker
200
198
  this.markerGroup.node().scale(1 / this.markerGroup.node().getScale()[0]);
201
- const scale = scaleToPixel(this.markerGroup.node(), this.scaleSize, true);
202
- this.markerGroup.node().style._transform = `scale(${scale})`;
199
+ scaleToPixel(this.markerGroup.node(), this.scaleSize, true);
203
200
  });
204
201
  }
205
202
 
@@ -234,25 +231,18 @@ export class CategoryItem extends Component<CategoryItemStyleProps> {
234
231
  },
235
232
  } = this;
236
233
  const halfHeight = height / 2;
237
-
238
- // console.log(this.markerGroup.node().style._transform);
239
-
240
- this.markerGroup.styles({
241
- transform: `translate(${markerX}, ${halfHeight})${this.markerGroup.node().style._transform}`,
242
- });
243
- this.labelGroup.styles({ transform: `translate(${labelX}, ${halfHeight})` });
234
+ this.markerGroup.styles({ x: markerX, y: halfHeight });
235
+ this.labelGroup.styles({ x: labelX, y: halfHeight });
244
236
 
245
237
  ellipsisIt(this.labelGroup.select(CLASS_NAMES.label.class).node(), Math.ceil(labelWidth));
246
238
  if (this.showValue) {
247
- this.valueGroup.styles({ transform: `translate(${valueX}, ${halfHeight})` });
239
+ this.valueGroup.styles({ x: valueX, y: halfHeight });
248
240
  ellipsisIt(this.valueGroup.select(CLASS_NAMES.value.class).node(), Math.ceil(valueWidth));
249
241
  }
250
242
  }
251
243
 
252
244
  public render(attributes: CategoryItemStyleProps, container: Group) {
253
245
  const ctn = select(container);
254
- const { x = 0, y = 0 } = attributes;
255
- ctn.styles({ transform: `translate(${x}, ${y})` });
256
246
  this.renderMarker(ctn);
257
247
  this.renderLabel(ctn);
258
248
  this.renderValue(ctn);
@@ -36,8 +36,6 @@ export type CategoryItemsStyleProps = GroupStyleProps &
36
36
  data: CategoryItemsDatum[];
37
37
  orientation?: 'horizontal' | 'vertical';
38
38
  layout?: 'flex' | 'grid';
39
- x?: number;
40
- y?: number;
41
39
  width?: number;
42
40
  height?: number;
43
41
  gridRow?: number;
@@ -66,8 +66,7 @@ export class Category extends Component<CategoryStyleProps> {
66
66
  const { showTitle } = this.attributes;
67
67
  if (showTitle) {
68
68
  const { x, y } = this.title.node<Title>().getAvailableSpace();
69
- this.itemsGroup.node().style.transform = `translate(${x}, ${y})`;
70
- // this.itemsGroup.node().setLocalPosition(x, y);
69
+ this.itemsGroup.node().setLocalPosition(x, y);
71
70
  }
72
71
  }
73
72
 
@@ -85,9 +84,8 @@ export class Category extends Component<CategoryStyleProps> {
85
84
  }
86
85
 
87
86
  render(attributes: Required<CategoryStyleProps>, container: Group) {
88
- const { width, height, x = 0, y = 0 } = this.attributes;
87
+ const { width, height } = attributes;
89
88
  const ctn = select(container);
90
- container.style.transform = `translate(${x}, ${y})`;
91
89
 
92
90
  this.renderTitle(ctn, width!, height!);
93
91
 
@@ -93,7 +93,7 @@ function getClipPath(attr: RequiredRibbonStyleProps): any[] {
93
93
 
94
94
  function renderTrack(container: Selection, attr: RequiredRibbonStyleProps) {
95
95
  const style = subStyleProps(attr, 'track');
96
- container.maybeAppendByClassName(CLASS_NAMES.track, 'path').styles({ d: getTrackPath(attr), ...style });
96
+ container.maybeAppendByClassName(CLASS_NAMES.track, 'path').styles({ path: getTrackPath(attr), ...style });
97
97
  }
98
98
 
99
99
  function renderSelection(container: Selection, attr: RequiredRibbonStyleProps) {
@@ -102,12 +102,12 @@ function renderSelection(container: Selection, attr: RequiredRibbonStyleProps) {
102
102
 
103
103
  const ribbon = container
104
104
  .maybeAppendByClassName(CLASS_NAMES.selection, 'path')
105
- .styles({ d: getSelectionPath(attr), fill, ...style });
105
+ .styles({ path: getSelectionPath(attr), fill, ...style });
106
106
  const clipPath = ribbon
107
107
  .maybeAppendByClassName(CLASS_NAMES.clipPath, 'path')
108
- .styles({ d: getClipPath(attr) })
108
+ .styles({ path: getClipPath(attr) })
109
109
  .node();
110
- ribbon.style('clipPath', clipPath);
110
+ ribbon.style('clip-path', clipPath);
111
111
  }
112
112
 
113
113
  export class Ribbon extends Component<RibbonStyleProps> {
@@ -92,9 +92,7 @@ export class Continuous extends Component<ContinuousStyleProps> {
92
92
  /** label */
93
93
 
94
94
  /** content */
95
- const contentGroup = select(container)
96
- .maybeAppendByClassName(CLASS_NAMES.contentGroup, 'g')
97
- .styles({ transform: `translate(${x}, ${y})` });
95
+ const contentGroup = select(container).maybeAppendByClassName(CLASS_NAMES.contentGroup, 'g').styles({ x, y });
98
96
 
99
97
  const labelGroup = contentGroup.maybeAppendByClassName(CLASS_NAMES.labelGroup, 'g').styles({ zIndex: 1 });
100
98
  ifShow(!!showLabel, labelGroup, (group) => {
@@ -270,7 +268,8 @@ export class Continuous extends Component<ContinuousStyleProps> {
270
268
  const { length, size } = this.ribbonShape;
271
269
  const style: Required<RibbonStyleProps> = deepAssign(
272
270
  {
273
- transform: `translate(${x}, ${y})`,
271
+ x,
272
+ y,
274
273
  length,
275
274
  size,
276
275
  type,
@@ -345,6 +344,22 @@ export class Continuous extends Component<ContinuousStyleProps> {
345
344
  this.setHandlePosition('end', max);
346
345
  }
347
346
 
347
+ private adjustTitle() {
348
+ const { titlePosition, orientation } = this.attributes;
349
+ const [title] = this.getElementsByClassName(CLASS_NAMES.title.name);
350
+ const handle: Handle = this.handlesGroup.select(`.${this.getHandleClassName('start')}`).node();
351
+ if (!title || !handle) return;
352
+ if (titlePosition !== 'top-left' || orientation !== 'horizontal') return;
353
+ const {
354
+ min: [handleX],
355
+ } = handle.getLocalBounds();
356
+ const {
357
+ min: [titleX],
358
+ } = title.getLocalBounds();
359
+ const diffX = handleX - titleX;
360
+ title.style.x = +(this.style.x || 0) + diffX;
361
+ }
362
+
348
363
  private cacheHandleBBox: DOMRect | null = null;
349
364
 
350
365
  private get handleBBox() {
@@ -376,7 +391,7 @@ export class Continuous extends Component<ContinuousStyleProps> {
376
391
  [ribbonX + ribbonSize * this.handleOffsetRatio, ribbonY + offset]
377
392
  );
378
393
  const handle: Handle = this.handlesGroup.select(`.${this.getHandleClassName(type)}`).node();
379
- handle?.update({ transform: `translate(${x}, ${y})`, formatter: handleFormatter });
394
+ handle?.update({ x, y, formatter: handleFormatter });
380
395
  }
381
396
 
382
397
  private renderIndicator(container: Selection) {
@@ -44,8 +44,7 @@ function getType(symbol: MarkerStyleProps['symbol']): string | null {
44
44
 
45
45
  export class Marker extends Component<MarkerStyleProps> {
46
46
  public render(attributes: Required<MarkerStyleProps>, container: Group) {
47
- const { symbol, size = 16, x = 0, y = 0, transform, transformOrigin, ...style } = attributes;
48
-
47
+ const { symbol, size = 16, ...style } = attributes;
49
48
  const type = getType(symbol);
50
49
  ifShow(!!type, select(container), (group) => {
51
50
  group
@@ -59,13 +58,13 @@ export class Marker extends Component<MarkerStyleProps> {
59
58
  img: symbol,
60
59
  width: r,
61
60
  height: r,
62
- x: x - size,
63
- y: y - size,
61
+ x: -size,
62
+ y: -size,
64
63
  });
65
64
  } else {
66
65
  const r = (size as number) / 2;
67
66
  const symbolFn = isFunction(symbol) ? symbol : Marker.getSymbol(symbol);
68
- selection.styles({ d: symbolFn?.(x, y, r), ...style });
67
+ selection.styles({ path: symbolFn?.(0, 0, r), ...style });
69
68
  }
70
69
  });
71
70
  });
@@ -4,8 +4,6 @@ import type { BaseCustomElementStyleProps } from '../../shapes';
4
4
  export type FunctionalSymbol = (x: number, y: number, r: number) => any;
5
5
 
6
6
  export type MarkerStyleProps = BaseCustomElementStyleProps & {
7
- x?: number;
8
- y?: number;
9
7
  size?: number;
10
8
  symbol: string | FunctionalSymbol;
11
9
  };
@@ -41,8 +41,6 @@ const CLASS_NAMES = classNames(
41
41
  export class Navigator extends Component<NavigatorStyleProps> {
42
42
  constructor(options: NavigatorOptions) {
43
43
  super(options, {
44
- x: 0,
45
- y: 0,
46
44
  animate: {
47
45
  easing: 'linear',
48
46
  duration: 200,
@@ -50,7 +48,7 @@ export class Navigator extends Component<NavigatorStyleProps> {
50
48
  },
51
49
  buttonCursor: 'pointer',
52
50
  buttonFill: 'black',
53
- buttonD: button(0, 0, 6),
51
+ buttonPath: button(0, 0, 6),
54
52
  buttonSize: 12,
55
53
  controllerPadding: 5,
56
54
  controllerSpacing: 5,
@@ -307,8 +305,6 @@ export class Navigator extends Component<NavigatorStyleProps> {
307
305
 
308
306
  this.updatePageInfo();
309
307
 
310
- // group.node().style.transform = `translate(${pageWidth + spacing}, ${pageHeight / 2})`;
311
-
312
308
  // put it on the right side of the container
313
309
  group.node().setLocalPosition(pageWidth + spacing, pageHeight / 2);
314
310
  if (whetherToAddEventListener) {
@@ -322,9 +318,6 @@ export class Navigator extends Component<NavigatorStyleProps> {
322
318
  }
323
319
 
324
320
  render(attributes: NavigatorStyleProps, container: Group) {
325
- const { x = 0, y = 0 } = attributes;
326
- this.attr('transform', `translate(${x}, ${y})`);
327
-
328
321
  /**
329
322
  * container
330
323
  * |- contentGroup (with clip path)
@@ -6,8 +6,6 @@ import type { PrefixObject } from '../../types';
6
6
  export type NavigatorStyleProps = Omit<RectStyleProps, 'width' | 'height'> &
7
7
  PrefixObject<PathStyleProps & { size?: number }, 'button'> &
8
8
  PrefixObject<TextStyleProps, 'pageNum'> & {
9
- x?: number;
10
- y?: number;
11
9
  animate?: GenericAnimation;
12
10
  /** padding between buttons and page number */
13
11
  controllerPadding?: number;
@@ -23,8 +23,6 @@ export class Scrollbar extends Component<ScrollbarStyleProps> {
23
23
 
24
24
  constructor(options: ScrollbarOptions) {
25
25
  super(options, {
26
- x: 0,
27
- y: 0,
28
26
  isRound: true,
29
27
  orientation: 'vertical',
30
28
  padding: [2, 2, 2, 2],
@@ -92,13 +90,11 @@ export class Scrollbar extends Component<ScrollbarStyleProps> {
92
90
  }
93
91
 
94
92
  private renderSlider(container: Group) {
95
- const { x, y, orientation, trackSize, padding, slidable } = this.attributes;
93
+ const { orientation, trackSize, padding, slidable } = this.attributes;
96
94
  const trackStyle = subStyleProps<RectStyleProps>(this.attributes, 'track');
97
95
  const selectionStyle = subStyleProps<RectStyleProps>(this.attributes, 'thumb');
98
96
 
99
97
  const style: SliderStyleProps = {
100
- x,
101
- y,
102
98
  brushable: false,
103
99
  orientation,
104
100
  padding,
@@ -8,8 +8,6 @@ import type { SliderStyleProps } from '../slider';
8
8
  export type ScrollbarStyleProps = GroupStyleProps &
9
9
  PrefixObject<RectStyleProps, 'track'> &
10
10
  PrefixObject<RectStyleProps, 'thumb'> & {
11
- x?: number;
12
- y?: number;
13
11
  /** 滑条朝向 */
14
12
  orientation?: Required<SliderStyleProps>['orientation'];
15
13
 
@@ -52,7 +52,7 @@ export class Option extends Component<OptionStyleProps> {
52
52
  fill: selected ? this.selectedColor : '#fff',
53
53
  });
54
54
  // place label
55
- this.label.attr({ transform: `translate(${left}, ${(backgroundHeight - labelHeight) / 2})` });
55
+ this.label.attr({ x: left, y: (backgroundHeight - labelHeight) / 2 });
56
56
  }
57
57
 
58
58
  constructor(options: OptionOptions) {
@@ -9,8 +9,6 @@ import type { SelectOptions, SelectStyleProps } from './types';
9
9
  export class Select extends Component<SelectStyleProps> {
10
10
  static defaultOptions: SelectOptions = {
11
11
  style: {
12
- x: 0,
13
- y: 0,
14
12
  width: 140,
15
13
  height: 32,
16
14
  options: [],
@@ -76,10 +74,10 @@ export class Select extends Component<SelectStyleProps> {
76
74
  );
77
75
 
78
76
  private renderSelect() {
79
- const { x, y, width, height, bordered, showDropdownIcon } = this.style;
77
+ const { width, height, bordered, showDropdownIcon } = this.style;
80
78
  const selectStyle = subStyleProps(this.attributes, 'select');
81
79
  const placeholderStyle = subStyleProps(this.attributes, 'placeholder');
82
- this.select.attr({ x, y, width, height, ...selectStyle, fill: '#fff', strokeWidth: bordered ? 1 : 0 });
80
+ this.select.attr({ width, height, ...selectStyle, fill: '#fff', strokeWidth: bordered ? 1 : 0 });
83
81
  const padding = this.dropdownPadding;
84
82
  // dropdown icon
85
83
  const iconSize = 10;
@@ -87,7 +85,7 @@ export class Select extends Component<SelectStyleProps> {
87
85
  select(this.select)
88
86
  .maybeAppend('.dropdown-icon', 'path')
89
87
  .style('d', 'M-5,-3.5 L0,3.5 L5,-3.5')
90
- .style('transform', `translate(${x + width - iconSize - padding[1] - padding[3]}, ${y + height / 2})`)
88
+ .style('transform', `translate(${width - iconSize - padding[1] - padding[3]}, ${height / 2})`)
91
89
  .style('lineWidth', 1)
92
90
  .style('stroke', this.select.style.stroke);
93
91
  }
@@ -95,7 +93,7 @@ export class Select extends Component<SelectStyleProps> {
95
93
  const currentOption = this.style.options?.find((option) => option.value === this.currentValue);
96
94
  // placeholder
97
95
  const finalPlaceholderStyle = {
98
- x: x + padding[3],
96
+ x: padding[3],
99
97
  ...placeholderStyle,
100
98
  };
101
99
  select(this.select)
@@ -109,7 +107,7 @@ export class Select extends Component<SelectStyleProps> {
109
107
  .styles(finalPlaceholderStyle)
110
108
  .style('y', function () {
111
109
  const bbox = this.getBBox();
112
- return y + (height - bbox.height) / 2;
110
+ return (height - bbox.height) / 2;
113
111
  }),
114
112
  (update) => update.styles(finalPlaceholderStyle),
115
113
  (exit) => exit.remove()
@@ -118,7 +116,7 @@ export class Select extends Component<SelectStyleProps> {
118
116
  // value
119
117
  const labelStyle = subStyleProps(this.attributes, 'optionLabel');
120
118
  const finalValueStyle = {
121
- x: x + padding[3],
119
+ x: padding[3],
122
120
  ...labelStyle,
123
121
  };
124
122
 
@@ -133,7 +131,7 @@ export class Select extends Component<SelectStyleProps> {
133
131
  .styles(finalValueStyle)
134
132
  .style('y', function () {
135
133
  const bbox = this.getBBox();
136
- return y + (height - bbox.height) / 2;
134
+ return (height - bbox.height) / 2;
137
135
  }),
138
136
  (update) => update.styles(finalValueStyle),
139
137
  (exit) => exit.remove()
@@ -141,7 +139,7 @@ export class Select extends Component<SelectStyleProps> {
141
139
  }
142
140
 
143
141
  private renderDropdown() {
144
- const { x, y, width, height, options, onSelect, open } = this.style;
142
+ const { width, height, options, onSelect, open } = this.style;
145
143
  const dropdownStyle = subStyleProps(this.attributes, 'dropdown');
146
144
  const optionStyle = subStyleProps(this.attributes, 'option');
147
145
  const padding = this.dropdownPadding;
@@ -195,7 +193,7 @@ export class Select extends Component<SelectStyleProps> {
195
193
  const { spacing } = dropdownStyle;
196
194
 
197
195
  this.dropdown.attr({
198
- transform: `translate(${x}, ${y + height + spacing})`,
196
+ y: height + spacing,
199
197
  width: bbox.width + padding[1] + padding[3],
200
198
  height: bbox.height + padding[0] + padding[2],
201
199
  ...dropdownStyle,
@@ -28,10 +28,6 @@ export type SelectStyleProps = GroupStyleProps &
28
28
  PrefixObject<Omit<RectStyleProps, 'width' | 'height'>, 'dropdown'> &
29
29
  PrefixObject<TextStyleProps, 'option'> &
30
30
  PrefixObject<Omit<OptionStyleProps, 'value' | 'label' | 'selected' | 'onClick'>, 'option'> & {
31
- /** 左上角 X 坐标 */
32
- x?: number;
33
- /** 左上角 Y 坐标 */
34
- y?: number;
35
31
  /** 宽度 */
36
32
  width?: number;
37
33
  /** 高度 */
@@ -20,8 +20,6 @@ export const HANDLE_LABEL_DEFAULT_CFG = {
20
20
  } as const;
21
21
 
22
22
  export const HANDLE_DEFAULT_CFG = {
23
- x: 0,
24
- y: 0,
25
23
  orientation: 'horizontal',
26
24
  showLabel: true,
27
25
  type: 'start',
@@ -8,8 +8,6 @@ import { HANDLE_DEFAULT_CFG, HANDLE_ICON_DEFAULT_CFG, HANDLE_LABEL_DEFAULT_CFG }
8
8
  export type HandleType = 'start' | 'end';
9
9
 
10
10
  export type IconStyleProps = PathStyleProps & {
11
- x?: number;
12
- y?: number;
13
11
  size?: number;
14
12
  radius?: number;
15
13
  shape?: string | ((type: HandleType) => DisplayObject);
@@ -21,8 +19,6 @@ export type LabelStyleProps = Partial<TextStyleProps>;
21
19
  export type HandleStyleProps = GroupStyleProps &
22
20
  PrefixStyleProps<LabelStyleProps, 'label'> &
23
21
  PrefixStyleProps<IconStyleProps, 'icon'> & {
24
- x?: number;
25
- y?: number;
26
22
  orientation?: IconStyleProps['orientation'];
27
23
  showLabel?: boolean;
28
24
  spacing?: number;
@@ -45,7 +41,7 @@ const CLASS_NAMES = classNames(
45
41
 
46
42
  class HandleIcon extends Component<IconStyleProps> {
47
43
  render(attributes: Required<IconStyleProps>, container: DisplayObject) {
48
- const { x, y, size = 10, radius = size / 4, orientation, ...iconStyle } = attributes;
44
+ const { size = 10, radius = size / 4, orientation, ...iconStyle } = attributes;
49
45
  // 默认手柄
50
46
  const width = size!;
51
47
  const height = width * 2.4;
@@ -57,20 +53,21 @@ class HandleIcon extends Component<IconStyleProps> {
57
53
  width,
58
54
  height,
59
55
  radius,
60
- x: x - width / 2,
61
- y: y - height / 2,
62
- transformOrigin: 'center',
56
+ x: -width / 2,
57
+ y: -height / 2,
63
58
  });
64
59
 
65
- const x1 = x + (1 / 3) * width - width / 2;
66
- const x2 = x + (2 / 3) * width - width / 2;
67
- const y1 = y + (1 / 4) * height - height / 2;
68
- const y2 = y + (3 / 4) * height - height / 2;
60
+ const x1 = (1 / 3) * width;
61
+ const x2 = (2 / 3) * width;
62
+ const y1 = (1 / 4) * height;
63
+ const y2 = (3 / 4) * height;
69
64
 
70
65
  rect.maybeAppendByClassName(`${CLASS_NAMES.iconLine}-1`, 'line').styles({ x1, x2: x1, y1, y2, ...iconStyle });
71
66
  rect.maybeAppendByClassName(`${CLASS_NAMES.iconLine}-2`, 'line').styles({ x1: x2, x2, y1, y2, ...iconStyle });
72
67
 
73
- if (orientation === 'vertical') rect.node().style.transform = 'rotate(90)';
68
+ rect.node().setOrigin(width / 2, height / 2);
69
+ if (orientation === 'vertical') container.setLocalEulerAngles(90);
70
+ else container.setLocalEulerAngles(0);
74
71
  }
75
72
  }
76
73
 
@@ -84,14 +81,8 @@ export class Handle extends Component<HandleStyleProps> {
84
81
  }
85
82
 
86
83
  private renderLabel(container: Group) {
87
- const { x, y, showLabel } = this.attributes;
88
- const {
89
- x: labelX = 0,
90
- y: labelY = 0,
91
- transform,
92
- transformOrigin,
93
- ...style
94
- } = subStyleProps(this.attributes, 'label');
84
+ const { showLabel } = this.attributes;
85
+ const { transform, ...style } = subStyleProps(this.attributes, 'label');
95
86
  const [labelStyle, groupStyle] = splitStyle(style, []);
96
87
 
97
88
  const labelGroup = select(container).maybeAppendByClassName(CLASS_NAMES.labelGroup, 'g').styles(groupStyle);
@@ -101,10 +92,7 @@ export class Handle extends Component<HandleStyleProps> {
101
92
  ifShow(!!showLabel, labelGroup, (group) => {
102
93
  this.label = group.maybeAppendByClassName(CLASS_NAMES.label, 'text').styles({
103
94
  ...rest,
104
- x: x + labelX,
105
- y: y + labelY,
106
95
  transform,
107
- transformOrigin,
108
96
  text: `${text}`,
109
97
  });
110
98
 
@@ -119,8 +107,8 @@ export class Handle extends Component<HandleStyleProps> {
119
107
  }
120
108
 
121
109
  private renderIcon(container: Group) {
122
- const { x, y, orientation, type } = this.attributes;
123
- const iconStyle = { x, y, orientation, ...HANDLE_ICON_DEFAULT_CFG, ...subStyleProps(this.attributes, 'icon') };
110
+ const { orientation, type } = this.attributes;
111
+ const iconStyle = { orientation, ...HANDLE_ICON_DEFAULT_CFG, ...subStyleProps(this.attributes, 'icon') };
124
112
  const { iconShape = () => new HandleIcon({ style: iconStyle }) } = this.attributes;
125
113
  const iconGroup = select(container).maybeAppendByClassName(CLASS_NAMES.iconGroup, 'g');
126
114
  iconGroup
@@ -83,7 +83,7 @@ export class Slider extends Component<SliderStyleProps> {
83
83
  }
84
84
 
85
85
  private get availableSpace() {
86
- const { x, y, padding } = this.attributes;
86
+ const { padding } = this.attributes;
87
87
  const [top, right, bottom, left] = parseSeriesAttr(padding!);
88
88
  const { width, height } = this.shape;
89
89
  return {
@@ -96,8 +96,6 @@ export class Slider extends Component<SliderStyleProps> {
96
96
 
97
97
  constructor(options: SliderOptions) {
98
98
  super(options, {
99
- x: 0,
100
- y: 0,
101
99
  animate: { duration: 100, fill: 'both' },
102
100
  brushable: true,
103
101
  formatter: (val: any) => val.toString(),
@@ -169,21 +167,18 @@ export class Slider extends Component<SliderStyleProps> {
169
167
  }
170
168
 
171
169
  private renderTrack(container: Group) {
172
- const { x, y } = this.attributes;
173
170
  const style = subStyleProps(this.attributes, 'track');
174
171
 
175
172
  this.trackShape = select(container)
176
173
  .maybeAppendByClassName(CLASS_NAMES.track, 'rect')
177
- .styles({ x, y, ...this.shape, ...style });
174
+ .styles({ ...this.shape, ...style });
178
175
  }
179
176
 
180
177
  private renderBrushArea(container: Group) {
181
- const { x, y, brushable } = this.attributes;
178
+ const { brushable } = this.attributes;
182
179
  this.brushArea = select(container)
183
180
  .maybeAppendByClassName(CLASS_NAMES.brushArea, 'rect')
184
181
  .styles({
185
- x,
186
- y,
187
182
  fill: 'transparent',
188
183
  cursor: brushable ? 'crosshair' : 'default',
189
184
  ...this.shape,
@@ -191,11 +186,11 @@ export class Slider extends Component<SliderStyleProps> {
191
186
  }
192
187
 
193
188
  private renderSparkline(container: Group) {
194
- const { x, y, orientation } = this.attributes;
189
+ const { orientation } = this.attributes;
195
190
  const sparklineGroup = select(container).maybeAppendByClassName(CLASS_NAMES.sparklineGroup, 'g');
196
191
 
197
192
  ifShow(orientation === 'horizontal', sparklineGroup, (group) => {
198
- const style = { ...this.sparklineStyle!, x, y };
193
+ const style = this.sparklineStyle!;
199
194
  group.maybeAppendByClassName(CLASS_NAMES.sparkline, () => new Sparkline({ style })).update(style);
200
195
  });
201
196
  }
@@ -237,7 +232,7 @@ export class Slider extends Component<SliderStyleProps> {
237
232
  }
238
233
 
239
234
  private renderSelection(container: Group) {
240
- const { x, y, type, selectionType } = this.attributes;
235
+ const { type, selectionType } = this.attributes;
241
236
  this.foregroundGroup = select(container).maybeAppendByClassName(CLASS_NAMES.foreground, 'g');
242
237
 
243
238
  // value 类型的 slider 不渲染选区
@@ -250,10 +245,7 @@ export class Slider extends Component<SliderStyleProps> {
250
245
  if (selectionType === 'invert') return 'crosshair';
251
246
  return 'default';
252
247
  })
253
- .styles({
254
- ...selectionStyle,
255
- transform: `translate(${x}, ${y})`,
256
- });
248
+ .styles(selectionStyle);
257
249
  };
258
250
 
259
251
  const that = this;
@@ -389,8 +381,8 @@ export class Slider extends Component<SliderStyleProps> {
389
381
  private inferTextStyle(handleType: HandleType): Record<string, any> {
390
382
  const { orientation } = this.attributes;
391
383
  if (orientation === 'horizontal') return {};
392
- if (handleType === 'start') return { transformOrigin: 'left center', transform: 'rotate(90)', textAlign: 'start' };
393
- if (handleType === 'end') return { transformOrigin: 'right center', transform: 'rotate(90)', textAlign: 'end' };
384
+ if (handleType === 'start') return { transform: 'rotate(90)', textAlign: 'start' };
385
+ if (handleType === 'end') return { transform: 'rotate(90)', textAlign: 'end' };
394
386
  return {};
395
387
  }
396
388
 
@@ -478,8 +470,8 @@ export class Slider extends Component<SliderStyleProps> {
478
470
  }
479
471
 
480
472
  private getHandleStyle(handleType: HandleType): HandleStyleProps {
481
- const { x: ox, y: oy, showLabel, showLabelOnInteraction, orientation } = this.attributes;
482
- const { x, y } = this.calcHandlePosition(handleType);
473
+ const { showLabel, showLabelOnInteraction, orientation } = this.attributes;
474
+ const handlePosition = this.calcHandlePosition(handleType);
483
475
  const textStyle = this.calcHandleText(handleType);
484
476
 
485
477
  let internalShowLabel = showLabel;
@@ -491,7 +483,7 @@ export class Slider extends Component<SliderStyleProps> {
491
483
  return {
492
484
  ...superStyleProps(this.getHandleIconStyle(), 'icon'),
493
485
  ...superStyleProps({ ...this.getHandleLabelStyle(handleType), ...textStyle }, 'label'),
494
- transform: `translate(${x + ox}, ${y + oy})`,
486
+ ...handlePosition,
495
487
  orientation,
496
488
  showLabel: internalShowLabel,
497
489
  type: handleType,
@@ -21,8 +21,6 @@ export type SliderStyleProps = GroupStyleProps &
21
21
  PrefixObject<RectStyleProps, 'selection'> &
22
22
  HandleStyleProps &
23
23
  Partial<PrefixStyleProps<Omit<SparklineStyleProps, 'width' | 'height'>, 'sparkline'>> & {
24
- x?: number;
25
- y?: number;
26
24
  /** 动画配置 */
27
25
  animate?: GenericAnimation;
28
26
 
@@ -5,8 +5,6 @@ import { deepAssign, select } from '../../util';
5
5
  export type ColumnStyleProps = GroupStyleProps;
6
6
 
7
7
  export interface ColumnsStyleProps extends BaseStyleProps {
8
- x?: number;
9
- y?: number;
10
8
  columns: ColumnStyleProps[][];
11
9
  }
12
10
 
@@ -21,8 +19,7 @@ export class Columns extends DisplayObject<ColumnsStyleProps> {
21
19
  }
22
20
 
23
21
  public render(): void {
24
- const { columns, x, y } = this.attributes;
25
- this.columnsGroup.style.transform = `translate(${x}, ${y})`;
22
+ const { columns } = this.attributes;
26
23
 
27
24
  select(this.columnsGroup)
28
25
  .selectAll('.column')
@@ -90,13 +90,13 @@ export class Sparkline extends Component<SparklineStyleProps> {
90
90
  lines: lines.map((line, idx) => {
91
91
  return {
92
92
  stroke: this.getColor(idx),
93
- d: smooth ? lineToCurvePath(line) : lineToLinePath(line),
93
+ path: smooth ? lineToCurvePath(line) : lineToLinePath(line),
94
94
  ...lineStyle,
95
95
  };
96
96
  }) as any,
97
97
  areas: areas.map((path, idx) => {
98
98
  return {
99
- d: path,
99
+ path,
100
100
  fill: this.getColor(idx),
101
101
  ...areaStyle,
102
102
  };
@@ -155,8 +155,6 @@ export class Sparkline extends Component<SparklineStyleProps> {
155
155
  constructor(options: SparklineOptions) {
156
156
  super(options, {
157
157
  type: 'line',
158
- x: 0,
159
- y: 0,
160
158
  width: 200,
161
159
  height: 20,
162
160
  isStack: false,
@@ -175,13 +173,9 @@ export class Sparkline extends Component<SparklineStyleProps> {
175
173
  public render(attributes: Required<SparklineStyleProps>, container: Group) {
176
174
  maybeAppend(container, '.container', 'rect').attr('className', 'container').node();
177
175
 
178
- const { type, x, y } = attributes;
176
+ const { type } = attributes;
179
177
  const className = `spark${type}`;
180
- const style: any = {
181
- x,
182
- y,
183
- ...(type === 'line' ? this.linesStyle : this.columnsStyle),
184
- };
178
+ const style: any = type === 'line' ? this.linesStyle : this.columnsStyle;
185
179
 
186
180
  select(container)
187
181
  .selectAll('.spark')