@orbcharts/plugins-basic 3.0.0-beta.9 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/dist/lib/plugins-basic-types.d.ts +1 -0
  2. package/dist/orbcharts-plugins-basic.es.js +12358 -10836
  3. package/dist/orbcharts-plugins-basic.umd.js +273 -110
  4. package/dist/{orbcharts-plugins-basic/src → src}/base/BaseBars.d.ts +3 -3
  5. package/dist/{orbcharts-plugins-basic/src → src}/base/BaseBarsTriangle.d.ts +3 -3
  6. package/dist/{orbcharts-plugins-basic/src → src}/base/BaseDots.d.ts +3 -3
  7. package/dist/{orbcharts-plugins-basic/src → src}/base/BaseLineAreas.d.ts +3 -3
  8. package/dist/{orbcharts-plugins-basic/src → src}/base/BaseLines.d.ts +3 -3
  9. package/dist/src/base/BaseRacingBars.d.ts +23 -0
  10. package/dist/src/base/BaseRacingLabels.d.ts +20 -0
  11. package/dist/src/base/BaseRacingValueLabels.d.ts +20 -0
  12. package/dist/{orbcharts-plugins-basic/src/base/BaseStackedBar.d.ts → src/base/BaseStackedBars.d.ts} +7 -7
  13. package/dist/{orbcharts-plugins-basic/src → src}/base/BaseValueAxis.d.ts +4 -7
  14. package/dist/src/base/BaseXAxis.d.ts +20 -0
  15. package/dist/src/base/BaseYAxis.d.ts +18 -0
  16. package/dist/{orbcharts-plugins-basic/src → src}/grid/defaults.d.ts +3 -3
  17. package/dist/{orbcharts-plugins-basic/src → src}/grid/gridObservables.d.ts +8 -1
  18. package/dist/{orbcharts-plugins-basic/src → src}/grid/index.d.ts +2 -2
  19. package/dist/src/grid/plugins/Bars.d.ts +1 -0
  20. package/dist/src/grid/plugins/BarsPN.d.ts +1 -0
  21. package/dist/src/grid/plugins/BarsTriangle.d.ts +1 -0
  22. package/dist/src/grid/plugins/Dots.d.ts +1 -0
  23. package/dist/src/grid/plugins/GridLegend.d.ts +1 -0
  24. package/dist/src/grid/plugins/GridTooltip.d.ts +1 -0
  25. package/dist/src/grid/plugins/GroupAux.d.ts +3 -0
  26. package/dist/src/grid/plugins/GroupAxis.d.ts +1 -0
  27. package/dist/src/grid/plugins/GroupZoom.d.ts +1 -0
  28. package/dist/src/grid/plugins/LineAreas.d.ts +1 -0
  29. package/dist/src/grid/plugins/Lines.d.ts +1 -0
  30. package/dist/src/grid/plugins/StackedBars.d.ts +1 -0
  31. package/dist/src/grid/plugins/StackedValueAxis.d.ts +1 -0
  32. package/dist/src/grid/plugins/ValueAxis.d.ts +1 -0
  33. package/dist/src/index.d.ts +7 -1
  34. package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/defaults.d.ts +2 -2
  35. package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/index.d.ts +1 -1
  36. package/dist/src/multiGrid/plugins/MultiBars.d.ts +1 -0
  37. package/dist/src/multiGrid/plugins/MultiBarsTriangle.d.ts +1 -0
  38. package/dist/src/multiGrid/plugins/MultiDots.d.ts +1 -0
  39. package/dist/src/multiGrid/plugins/MultiGridLegend.d.ts +1 -0
  40. package/dist/src/multiGrid/plugins/MultiGridTooltip.d.ts +1 -0
  41. package/dist/src/multiGrid/plugins/MultiGroupAxis.d.ts +1 -0
  42. package/dist/src/multiGrid/plugins/MultiLineAreas.d.ts +1 -0
  43. package/dist/src/multiGrid/plugins/MultiLines.d.ts +1 -0
  44. package/dist/src/multiGrid/plugins/MultiStackedBars.d.ts +1 -0
  45. package/dist/src/multiGrid/plugins/MultiStackedValueAxis.d.ts +1 -0
  46. package/dist/src/multiGrid/plugins/MultiValueAxis.d.ts +1 -0
  47. package/dist/src/multiGrid/plugins/OverlappingStackedValueAxes.d.ts +1 -0
  48. package/dist/src/multiGrid/plugins/OverlappingValueAxes.d.ts +1 -0
  49. package/dist/src/multiValue/defaults.d.ts +13 -0
  50. package/dist/{orbcharts-plugins-basic/src → src}/multiValue/index.d.ts +5 -1
  51. package/dist/src/multiValue/multiValueObservables.d.ts +56 -0
  52. package/dist/src/multiValue/plugins/MultiValueLegend.d.ts +1 -0
  53. package/dist/src/multiValue/plugins/MultiValueTooltip.d.ts +1 -0
  54. package/dist/src/multiValue/plugins/RacingBars.d.ts +1 -0
  55. package/dist/src/multiValue/plugins/RacingCounterTexts.d.ts +3 -0
  56. package/dist/src/multiValue/plugins/RacingValueAxis.d.ts +1 -0
  57. package/dist/src/multiValue/plugins/Scatter.d.ts +3 -0
  58. package/dist/src/multiValue/plugins/ScatterBubbles.d.ts +3 -0
  59. package/dist/src/multiValue/plugins/XAxis.d.ts +1 -0
  60. package/dist/src/multiValue/plugins/XYAux.d.ts +3 -0
  61. package/dist/src/multiValue/plugins/XYAxes.d.ts +1 -0
  62. package/dist/src/multiValue/plugins/XYAxes_legacy.d.ts +3 -0
  63. package/dist/src/multiValue/plugins/XZoom.d.ts +1 -0
  64. package/dist/src/relationship/plugins/ForceDirected.d.ts +3 -0
  65. package/dist/src/relationship/plugins/ForceDirectedBubbles.d.ts +3 -0
  66. package/dist/src/relationship/plugins/RelationshipLegend.d.ts +1 -0
  67. package/dist/src/relationship/plugins/RelationshipTooltip.d.ts +1 -0
  68. package/dist/src/series/plugins/Bubbles.d.ts +3 -0
  69. package/dist/src/series/plugins/Pie.d.ts +3 -0
  70. package/dist/src/series/plugins/PieEventTexts.d.ts +3 -0
  71. package/dist/src/series/plugins/PieLabels.d.ts +3 -0
  72. package/dist/{orbcharts-plugins-basic/src → src}/series/plugins/Rose.d.ts +1 -1
  73. package/dist/src/series/plugins/RoseLabels.d.ts +3 -0
  74. package/dist/src/series/plugins/SeriesLegend.d.ts +1 -0
  75. package/dist/src/series/plugins/SeriesTooltip.d.ts +1 -0
  76. package/dist/src/tree/plugins/TreeLegend.d.ts +1 -0
  77. package/dist/src/tree/plugins/TreeMap.d.ts +3 -0
  78. package/dist/src/tree/plugins/TreeTooltip.d.ts +1 -0
  79. package/dist/{orbcharts-plugins-basic/src → src}/utils/commonUtils.d.ts +1 -0
  80. package/dist/{orbcharts-plugins-basic/src → src}/utils/d3Graphics.d.ts +2 -1
  81. package/dist/{orbcharts-plugins-basic/src → src}/utils/d3Utils.d.ts +1 -0
  82. package/lib/core.ts +1 -1
  83. package/lib/plugins-basic-types.ts +2 -2
  84. package/package.json +4 -4
  85. package/src/base/BaseBars.ts +15 -15
  86. package/src/base/BaseBarsTriangle.ts +15 -15
  87. package/src/base/BaseDots.ts +14 -14
  88. package/src/base/BaseGroupAxis.ts +18 -6
  89. package/src/base/BaseLineAreas.ts +12 -12
  90. package/src/base/BaseLines.ts +11 -11
  91. package/src/base/BaseRacingBars.ts +552 -0
  92. package/src/base/BaseRacingLabels.ts +396 -0
  93. package/src/base/BaseRacingValueLabels.ts +403 -0
  94. package/src/base/{BaseStackedBar.ts → BaseStackedBars.ts} +26 -26
  95. package/src/base/BaseTooltip.ts +2 -1
  96. package/src/base/BaseValueAxis.ts +70 -53
  97. package/src/base/BaseXAxis.ts +427 -0
  98. package/src/base/BaseYAxis.ts +389 -0
  99. package/src/grid/defaults.ts +44 -77
  100. package/src/grid/gridObservables.ts +58 -0
  101. package/src/grid/index.ts +2 -2
  102. package/src/grid/plugins/Bars.ts +2 -2
  103. package/src/grid/plugins/BarsPN.ts +2 -2
  104. package/src/grid/plugins/BarsTriangle.ts +2 -2
  105. package/src/grid/plugins/Dots.ts +2 -2
  106. package/src/grid/plugins/GridLegend.ts +7 -7
  107. package/src/grid/plugins/GroupAux.ts +41 -24
  108. package/src/grid/plugins/GroupAxis.ts +0 -24
  109. package/src/grid/plugins/{GridZoom.ts → GroupZoom.ts} +5 -5
  110. package/src/grid/plugins/LineAreas.ts +2 -2
  111. package/src/grid/plugins/Lines.ts +2 -2
  112. package/src/grid/plugins/{StackedBar.ts → StackedBars.ts} +9 -9
  113. package/src/multiGrid/defaults.ts +44 -24
  114. package/src/multiGrid/index.ts +1 -1
  115. package/src/multiGrid/multiGridObservables.ts +1 -0
  116. package/src/multiGrid/plugins/MultiBars.ts +3 -3
  117. package/src/multiGrid/plugins/MultiBarsTriangle.ts +3 -3
  118. package/src/multiGrid/plugins/MultiDots.ts +3 -3
  119. package/src/multiGrid/plugins/MultiGridLegend.ts +20 -10
  120. package/src/multiGrid/plugins/MultiLineAreas.ts +3 -3
  121. package/src/multiGrid/plugins/MultiLines.ts +3 -3
  122. package/src/multiGrid/plugins/{MultiStackedBar.ts → MultiStackedBars.ts} +10 -10
  123. package/src/multiGrid/plugins/OverlappingStackedValueAxes.ts +1 -0
  124. package/src/multiValue/defaults.ts +277 -12
  125. package/src/multiValue/index.ts +5 -1
  126. package/src/multiValue/multiValueObservables.ts +414 -44
  127. package/src/multiValue/plugins/OrdinalBubbles.ts +0 -0
  128. package/src/multiValue/plugins/OrdinalXAxis.ts +0 -0
  129. package/src/multiValue/plugins/RacingBars.ts +373 -0
  130. package/src/multiValue/plugins/RacingCounterAxis.ts +0 -0
  131. package/src/multiValue/plugins/RacingCounterTexts.ts +300 -0
  132. package/src/multiValue/plugins/RacingValueAxis.ts +115 -0
  133. package/src/multiValue/plugins/RankingAxis_legacy.ts +109 -0
  134. package/src/multiValue/plugins/Scatter.ts +13 -13
  135. package/src/multiValue/plugins/ScatterBubbles.ts +13 -13
  136. package/src/multiValue/plugins/XAxis.ts +108 -0
  137. package/src/multiValue/plugins/XYAux.ts +15 -14
  138. package/src/multiValue/plugins/XYAxes.ts +38 -528
  139. package/src/multiValue/plugins/XYAxes_legacy.ts +684 -0
  140. package/src/multiValue/plugins/{XYZoom.ts → XZoom.ts} +17 -17
  141. package/src/relationship/defaults.ts +42 -16
  142. package/src/relationship/plugins/ForceDirected.ts +26 -19
  143. package/src/relationship/plugins/ForceDirectedBubbles.ts +46 -25
  144. package/src/series/defaults.ts +51 -36
  145. package/src/series/plugins/Bubbles.ts +67 -37
  146. package/src/series/plugins/Pie.ts +5 -5
  147. package/src/series/plugins/PieEventTexts.ts +3 -3
  148. package/src/series/plugins/PieLabels.ts +5 -5
  149. package/src/series/plugins/Rose.ts +11 -11
  150. package/src/series/plugins/RoseLabels.ts +9 -9
  151. package/src/tree/defaults.ts +46 -22
  152. package/src/tree/plugins/TreeMap.ts +11 -3
  153. package/src/utils/commonUtils.ts +10 -1
  154. package/src/utils/d3Graphics.ts +4 -2
  155. package/src/utils/d3Utils.ts +18 -0
  156. package/src/utils/orbchartsUtils.ts +30 -16
  157. package/dist/orbcharts-plugins-basic/lib/plugins-basic-types.d.ts +0 -1
  158. package/dist/orbcharts-plugins-basic/src/grid/plugins/Bars.d.ts +0 -1
  159. package/dist/orbcharts-plugins-basic/src/grid/plugins/BarsPN.d.ts +0 -1
  160. package/dist/orbcharts-plugins-basic/src/grid/plugins/BarsTriangle.d.ts +0 -1
  161. package/dist/orbcharts-plugins-basic/src/grid/plugins/Dots.d.ts +0 -1
  162. package/dist/orbcharts-plugins-basic/src/grid/plugins/GridLegend.d.ts +0 -1
  163. package/dist/orbcharts-plugins-basic/src/grid/plugins/GridTooltip.d.ts +0 -1
  164. package/dist/orbcharts-plugins-basic/src/grid/plugins/GridZoom.d.ts +0 -1
  165. package/dist/orbcharts-plugins-basic/src/grid/plugins/GroupAux.d.ts +0 -3
  166. package/dist/orbcharts-plugins-basic/src/grid/plugins/GroupAxis.d.ts +0 -1
  167. package/dist/orbcharts-plugins-basic/src/grid/plugins/LineAreas.d.ts +0 -1
  168. package/dist/orbcharts-plugins-basic/src/grid/plugins/Lines.d.ts +0 -1
  169. package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedBar.d.ts +0 -1
  170. package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedValueAxis.d.ts +0 -1
  171. package/dist/orbcharts-plugins-basic/src/grid/plugins/ValueAxis.d.ts +0 -1
  172. package/dist/orbcharts-plugins-basic/src/index.d.ts +0 -7
  173. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiBars.d.ts +0 -1
  174. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiBarsTriangle.d.ts +0 -1
  175. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiDots.d.ts +0 -1
  176. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiGridLegend.d.ts +0 -1
  177. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiGridTooltip.d.ts +0 -1
  178. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiGroupAxis.d.ts +0 -1
  179. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiLineAreas.d.ts +0 -1
  180. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiLines.d.ts +0 -1
  181. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedBar.d.ts +0 -1
  182. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedValueAxis.d.ts +0 -1
  183. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiValueAxis.d.ts +0 -1
  184. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/OverlappingStackedValueAxes.d.ts +0 -1
  185. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -1
  186. package/dist/orbcharts-plugins-basic/src/multiValue/defaults.d.ts +0 -9
  187. package/dist/orbcharts-plugins-basic/src/multiValue/multiValueObservables.d.ts +0 -33
  188. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueLegend.d.ts +0 -1
  189. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueTooltip.d.ts +0 -1
  190. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/Scatter.d.ts +0 -3
  191. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/ScatterBubbles.d.ts +0 -3
  192. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAux.d.ts +0 -3
  193. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAxes.d.ts +0 -3
  194. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYZoom.d.ts +0 -1
  195. package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirected.d.ts +0 -3
  196. package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirectedBubbles.d.ts +0 -3
  197. package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipLegend.d.ts +0 -1
  198. package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipTooltip.d.ts +0 -1
  199. package/dist/orbcharts-plugins-basic/src/series/plugins/Bubbles.d.ts +0 -3
  200. package/dist/orbcharts-plugins-basic/src/series/plugins/Pie.d.ts +0 -3
  201. package/dist/orbcharts-plugins-basic/src/series/plugins/PieEventTexts.d.ts +0 -3
  202. package/dist/orbcharts-plugins-basic/src/series/plugins/PieLabels.d.ts +0 -3
  203. package/dist/orbcharts-plugins-basic/src/series/plugins/RoseLabels.d.ts +0 -3
  204. package/dist/orbcharts-plugins-basic/src/series/plugins/SeriesLegend.d.ts +0 -1
  205. package/dist/orbcharts-plugins-basic/src/series/plugins/SeriesTooltip.d.ts +0 -1
  206. package/dist/orbcharts-plugins-basic/src/tree/plugins/TreeLegend.d.ts +0 -1
  207. package/dist/orbcharts-plugins-basic/src/tree/plugins/TreeMap.d.ts +0 -3
  208. package/dist/orbcharts-plugins-basic/src/tree/plugins/TreeTooltip.d.ts +0 -1
  209. /package/dist/{orbcharts-plugins-basic/lib → lib}/core-types.d.ts +0 -0
  210. /package/dist/{orbcharts-plugins-basic/lib → lib}/core.d.ts +0 -0
  211. /package/dist/{orbcharts-plugins-basic/src → src}/base/BaseGroupAxis.d.ts +0 -0
  212. /package/dist/{orbcharts-plugins-basic/src → src}/base/BaseLegend.d.ts +0 -0
  213. /package/dist/{orbcharts-plugins-basic/src → src}/base/BaseTooltip.d.ts +0 -0
  214. /package/dist/{orbcharts-plugins-basic/src → src}/base/types.d.ts +0 -0
  215. /package/dist/{orbcharts-plugins-basic/src → src}/const.d.ts +0 -0
  216. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/multiGridObservables.d.ts +0 -0
  217. /package/dist/{orbcharts-plugins-basic/src/multiValue/plugins/Ranking.d.ts → src/multiValue/plugins/OrdinalBubbles.d.ts} +0 -0
  218. /package/dist/{orbcharts-plugins-basic/src/multiValue/plugins/RankingAxis.d.ts → src/multiValue/plugins/OrdinalXAxis.d.ts} +0 -0
  219. /package/dist/{orbcharts-plugins-basic/src/noneData/plugins/Container.d.ts → src/multiValue/plugins/RacingCounterAxis.d.ts} +0 -0
  220. /package/dist/{orbcharts-plugins-basic/src/noneData/plugins/Tooltip.d.ts → src/multiValue/plugins/RankingAxis_legacy.d.ts} +0 -0
  221. /package/dist/{orbcharts-plugins-basic/src → src}/noneData/defaults.d.ts +0 -0
  222. /package/dist/{orbcharts-plugins-basic/src → src}/noneData/index.d.ts +0 -0
  223. /package/dist/{orbcharts-plugins-basic/src/series/plugins/Waffle.d.ts → src/noneData/plugins/Container.d.ts} +0 -0
  224. /package/{src/multiValue/plugins/Ranking.ts → dist/src/noneData/plugins/Tooltip.d.ts} +0 -0
  225. /package/dist/{orbcharts-plugins-basic/src → src}/relationship/defaults.d.ts +0 -0
  226. /package/dist/{orbcharts-plugins-basic/src → src}/relationship/index.d.ts +0 -0
  227. /package/dist/{orbcharts-plugins-basic/src → src}/relationship/relationshipObservables.d.ts +0 -0
  228. /package/dist/{orbcharts-plugins-basic/src → src}/series/defaults.d.ts +0 -0
  229. /package/dist/{orbcharts-plugins-basic/src → src}/series/index.d.ts +0 -0
  230. /package/{src/multiValue/plugins/RankingAxis.ts → dist/src/series/plugins/Waffle.d.ts} +0 -0
  231. /package/dist/{orbcharts-plugins-basic/src → src}/series/seriesObservables.d.ts +0 -0
  232. /package/dist/{orbcharts-plugins-basic/src → src}/series/seriesUtils.d.ts +0 -0
  233. /package/dist/{orbcharts-plugins-basic/src → src}/tree/defaults.d.ts +0 -0
  234. /package/dist/{orbcharts-plugins-basic/src → src}/tree/index.d.ts +0 -0
  235. /package/dist/{orbcharts-plugins-basic/src → src}/utils/observables.d.ts +0 -0
  236. /package/dist/{orbcharts-plugins-basic/src → src}/utils/orbchartsUtils.d.ts +0 -0
  237. /package/dist/{orbcharts-plugins-basic/vite.config.d.ts → vite.config.d.ts} +0 -0
@@ -13,16 +13,16 @@ import type { DefinePluginConfig } from '../../../lib/core-types'
13
13
  import type { DataFormatterMultiValue } from '../../../lib/core-types'
14
14
  import {
15
15
  defineMultiValuePlugin, createValueToAxisScale } from '../../../lib/core'
16
- import { DEFAULT_X_Y_ZOOM_PARAMS } from '../defaults'
16
+ import { DEFAULT_X_ZOOM_PARAMS } from '../defaults'
17
17
  import { getClassName, getUniID } from '../../utils/orbchartsUtils'
18
18
  import { LAYER_INDEX_OF_ROOT } from '../../const'
19
19
 
20
- const pluginName = 'XYZoom'
20
+ const pluginName = 'XZoom'
21
21
  const rectClassName = getClassName(pluginName, 'rect')
22
22
 
23
- const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_X_Y_ZOOM_PARAMS> = {
23
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_X_ZOOM_PARAMS> = {
24
24
  name: pluginName,
25
- defaultParams: DEFAULT_X_Y_ZOOM_PARAMS,
25
+ defaultParams: DEFAULT_X_ZOOM_PARAMS,
26
26
  layerIndex: LAYER_INDEX_OF_ROOT,
27
27
  validator: (params, { validateColumns }) => {
28
28
  return {
@@ -33,7 +33,7 @@ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_X_Y_ZOO
33
33
  }
34
34
  }
35
35
 
36
- export const XYZoom = defineMultiValuePlugin(pluginConfig)(({ selection, rootSelection, name, observer, subject }) => {
36
+ export const XZoom = defineMultiValuePlugin(pluginConfig)(({ selection, rootSelection, name, observer, subject }) => {
37
37
 
38
38
  const destroy$ = new Subject()
39
39
 
@@ -119,15 +119,15 @@ export const XYZoom = defineMultiValuePlugin(pluginConfig)(({ selection, rootSel
119
119
  combineLatest({
120
120
  initXAxis: initXAxis$,
121
121
  layout: observer.layout$,
122
- minMaxXY: observer.minMaxXY$
122
+ xyMinMax: observer.xyMinMax$
123
123
  }).pipe(
124
124
  takeUntil(destroy$),
125
125
  switchMap(async (d) => d),
126
126
  ).subscribe(data => {
127
127
 
128
128
  const xScale: d3.ScaleLinear<number, number> = createValueToAxisScale({
129
- maxValue: data.minMaxXY.maxX,
130
- minValue: data.minMaxXY.minX,
129
+ maxValue: data.xyMinMax.maxX,
130
+ minValue: data.xyMinMax.minX,
131
131
  axisWidth: data.layout.width,
132
132
  scaleDomain: data.initXAxis.scaleDomain,
133
133
  scaleRange: data.initXAxis.scaleRange,
@@ -141,15 +141,15 @@ export const XYZoom = defineMultiValuePlugin(pluginConfig)(({ selection, rootSel
141
141
  combineLatest({
142
142
  initYAxis: initYAxis$,
143
143
  layout: observer.layout$,
144
- minMaxXY: observer.minMaxXY$
144
+ xyMinMax: observer.xyMinMax$
145
145
  }).pipe(
146
146
  takeUntil(destroy$),
147
147
  switchMap(async (d) => d),
148
148
  ).subscribe(data => {
149
149
 
150
150
  const yScale: d3.ScaleLinear<number, number> = createValueToAxisScale({
151
- maxValue: data.minMaxXY.maxY,
152
- minValue: data.minMaxXY.minY,
151
+ maxValue: data.xyMinMax.maxY,
152
+ minValue: data.xyMinMax.minY,
153
153
  axisWidth: data.layout.height,
154
154
  scaleDomain: data.initYAxis.scaleDomain,
155
155
  scaleRange: data.initYAxis.scaleRange,
@@ -163,15 +163,15 @@ export const XYZoom = defineMultiValuePlugin(pluginConfig)(({ selection, rootSel
163
163
  const minMaxScaleDomain$ = combineLatest({
164
164
  initXAxis: initXAxis$,
165
165
  initYAxis: initYAxis$,
166
- minMaxXY: observer.minMaxXY$
166
+ xyMinMax: observer.xyMinMax$
167
167
  }).pipe(
168
168
  takeUntil(destroy$),
169
169
  switchMap(async (d) => d),
170
170
  map(data => {
171
- let minX = data.minMaxXY.minX
172
- let maxX = data.minMaxXY.maxX
173
- let minY = data.minMaxXY.minY
174
- let maxY = data.minMaxXY.maxY
171
+ let minX = data.xyMinMax.minX
172
+ let maxX = data.xyMinMax.maxX
173
+ let minY = data.xyMinMax.minY
174
+ let maxY = data.xyMinMax.maxY
175
175
 
176
176
  // 原始設定為auto時要額外判斷
177
177
  if (data.initXAxis.scaleDomain[0] === 'auto' && minX > 0) {
@@ -202,7 +202,7 @@ export const XYZoom = defineMultiValuePlugin(pluginConfig)(({ selection, rootSel
202
202
  // fullDataFormatter: fullDataFormatter$.pipe(first()), // 只用第一次資料來計算scale才不會造成每次變動都受到影響
203
203
  fullDataFormatter: observer.fullDataFormatter$,
204
204
  // groupMax: groupMax$,
205
- // minMaxXY: observer.minMaxXY$,
205
+ // xyMinMax: observer.xyMinMax$,
206
206
  minMaxScaleDomain: minMaxScaleDomain$,
207
207
  // layout: observer.layout$,
208
208
  // axisSize: observer.gridAxesSize$
@@ -37,7 +37,8 @@ export const DEFAULT_FORCE_DIRECTED_PARAMS: ForceDirectedParams = {
37
37
  dotLabel: {
38
38
  colorType: 'primary',
39
39
  sizeFixed: false,
40
- styleFn: (node) => 'text-shadow:0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff'
40
+ // styleFn: (node) => 'text-shadow:0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff'
41
+ styleFn: (node) => ''
41
42
  },
42
43
  arrow: {
43
44
  colorType: 'primary',
@@ -47,7 +48,7 @@ export const DEFAULT_FORCE_DIRECTED_PARAMS: ForceDirectedParams = {
47
48
  styleFn: (node) => '',
48
49
  },
49
50
  arrowLabel: {
50
- colorType: 'secondary',
51
+ colorType: 'primary',
51
52
  sizeFixed: false,
52
53
  styleFn: (node) => ''
53
54
  },
@@ -70,14 +71,14 @@ export const DEFAULT_FORCE_DIRECTED_PARAMS: ForceDirectedParams = {
70
71
  }
71
72
  }
72
73
  DEFAULT_FORCE_DIRECTED_PARAMS.dot.styleFn.toString = () => `(node) => ''`
73
- DEFAULT_FORCE_DIRECTED_PARAMS.dotLabel.styleFn.toString = () => `(node) => 'text-shadow:0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff'`
74
- DEFAULT_FORCE_DIRECTED_PARAMS.arrow.styleFn.toString = () => `(node) => ''`
75
- DEFAULT_FORCE_DIRECTED_PARAMS.arrowLabel.styleFn.toString = () => `(node) => ''`
74
+ DEFAULT_FORCE_DIRECTED_PARAMS.dotLabel.styleFn.toString = () => `(node) => ''`
75
+ DEFAULT_FORCE_DIRECTED_PARAMS.arrow.styleFn.toString = () => `(edge) => ''`
76
+ DEFAULT_FORCE_DIRECTED_PARAMS.arrowLabel.styleFn.toString = () => `(edge) => ''`
76
77
 
77
78
  export const DEFAULT_FORCE_DIRECTED_BUBBLES_PARAMS: ForceDirectedBubblesParams = {
78
79
  bubble: {
79
- radiusMin: 30,
80
- radiusMax: 60,
80
+ radiusMin: 15,
81
+ radiusMax: 45,
81
82
  arcScaleType: 'area',
82
83
  fillColorType: 'label',
83
84
  strokeColorType: 'label',
@@ -85,10 +86,11 @@ export const DEFAULT_FORCE_DIRECTED_BUBBLES_PARAMS: ForceDirectedBubblesParams =
85
86
  styleFn: (node) => '',
86
87
  },
87
88
  bubbleLabel: {
88
- fillRate: 0.8,
89
+ fillRate: 0.9,
89
90
  lineHeight: 1,
90
- lineLengthMin: 4,
91
- colorType: 'primary',
91
+ maxLineLength: 6,
92
+ wordBreakAll: true,
93
+ colorType: 'labelContrast',
92
94
  styleFn: (node) => ''
93
95
  },
94
96
  arrow: {
@@ -100,13 +102,13 @@ export const DEFAULT_FORCE_DIRECTED_BUBBLES_PARAMS: ForceDirectedBubblesParams =
100
102
  styleFn: (node) => '',
101
103
  },
102
104
  arrowLabel: {
103
- colorType: 'secondary',
105
+ colorType: 'primary',
104
106
  sizeFixed: false,
105
107
  styleFn: (node) => ''
106
108
  },
107
109
  force: {
108
110
  nodeStrength: -500, // 泡泡引力
109
- linkDistance: 200, // 連結長度
111
+ linkDistance: 130, // 連結長度
110
112
  velocityDecay: 0.1, // 衰減數
111
113
  alphaDecay: 0.05
112
114
  // collisionSpacing: 2 // 泡泡間距
@@ -124,8 +126,8 @@ export const DEFAULT_FORCE_DIRECTED_BUBBLES_PARAMS: ForceDirectedBubblesParams =
124
126
  }
125
127
  DEFAULT_FORCE_DIRECTED_BUBBLES_PARAMS.bubble.styleFn.toString = () => `(node) => ''`
126
128
  DEFAULT_FORCE_DIRECTED_BUBBLES_PARAMS.bubbleLabel.styleFn.toString = () => `(node) => ''`
127
- DEFAULT_FORCE_DIRECTED_BUBBLES_PARAMS.arrow.styleFn.toString = () => `(node) => ''`
128
- DEFAULT_FORCE_DIRECTED_BUBBLES_PARAMS.arrowLabel.styleFn.toString = () => `(node) => ''`
129
+ DEFAULT_FORCE_DIRECTED_BUBBLES_PARAMS.arrow.styleFn.toString = () => `(edge) => ''`
130
+ DEFAULT_FORCE_DIRECTED_BUBBLES_PARAMS.arrowLabel.styleFn.toString = () => `(edge) => ''`
129
131
 
130
132
 
131
133
  export const DEFAULT_RELATIONSHIP_LEGEND_PARAMS: RelationshipLegendParams = {
@@ -150,6 +152,7 @@ export const DEFAULT_RELATIONSHIP_TOOLTIP_PARAMS: RelationshipTooltipParams = {
150
152
  renderFn: (eventData, { styles, utils }) => {
151
153
  const hasCategoryLabel = eventData.categoryLabel ? true : false
152
154
  const hasDatumLabel = eventData.datum.label ? true : false
155
+ const valueText = utils.toCurrency(eventData.datum.value)
153
156
  const bulletWidth = styles.textSizePx * 0.7
154
157
  const offset = (styles.textSizePx / 2) - (bulletWidth / 2)
155
158
  const categorySvg = hasCategoryLabel
@@ -161,8 +164,19 @@ export const DEFAULT_RELATIONSHIP_TOOLTIP_PARAMS: RelationshipTooltipParams = {
161
164
  const datumLabelSvg = hasDatumLabel
162
165
  ? `<tspan>${eventData.datum.label}</tspan> `
163
166
  : ''
167
+ const categoryLabelTextWidth = hasCategoryLabel
168
+ ? utils.measureTextWidth(`${eventData.categoryLabel}${valueText}`, styles.textSizePx) + styles.textSizePx * 1.5
169
+ : 0
170
+ const datumLabelTextWidth = hasDatumLabel
171
+ ? utils.measureTextWidth(`${eventData.datum.label}${valueText}`, styles.textSizePx)
172
+ : 0
173
+ const maxTextWidth = Math.max(categoryLabelTextWidth, datumLabelTextWidth)
174
+ const lineEndX = hasDatumLabel
175
+ ? maxTextWidth + styles.textSizePx * 0.5
176
+ : 0
177
+ const valueTextAnchor = hasDatumLabel ? 'end' : 'start'
164
178
  const datumSvg = `<text font-size="${styles.textSizePx}" dominant-baseline="hanging" fill="${styles.textColor}">
165
- ${datumLabelSvg}<tspan font-weight="bold">${eventData.datum.value}</tspan>
179
+ ${datumLabelSvg}<tspan font-weight="bold" text-anchor="${valueTextAnchor}" x="${lineEndX}">${valueText}</tspan>
166
180
  </text>`
167
181
 
168
182
  return `${categorySvg}
@@ -174,6 +188,7 @@ export const DEFAULT_RELATIONSHIP_TOOLTIP_PARAMS: RelationshipTooltipParams = {
174
188
  DEFAULT_RELATIONSHIP_TOOLTIP_PARAMS.renderFn.toString = () => `(eventData, { styles, utils }) => {
175
189
  const hasCategoryLabel = eventData.categoryLabel ? true : false
176
190
  const hasDatumLabel = eventData.datum.label ? true : false
191
+ const valueText = utils.toCurrency(eventData.datum.value)
177
192
  const bulletWidth = styles.textSizePx * 0.7
178
193
  const offset = (styles.textSizePx / 2) - (bulletWidth / 2)
179
194
  const categorySvg = hasCategoryLabel
@@ -185,8 +200,19 @@ DEFAULT_RELATIONSHIP_TOOLTIP_PARAMS.renderFn.toString = () => `(eventData, { sty
185
200
  const datumLabelSvg = hasDatumLabel
186
201
  ? \`<tspan>\${eventData.datum.label}</tspan> \`
187
202
  : ''
203
+ const categoryLabelTextWidth = hasCategoryLabel
204
+ ? utils.measureTextWidth(\`\${eventData.categoryLabel}\${valueText}\`, styles.textSizePx) + styles.textSizePx * 1.5
205
+ : 0
206
+ const datumLabelTextWidth = hasDatumLabel
207
+ ? utils.measureTextWidth(\`\${eventData.datum.label}\${valueText}\`, styles.textSizePx)
208
+ : 0
209
+ const maxTextWidth = Math.max(categoryLabelTextWidth, datumLabelTextWidth)
210
+ const lineEndX = hasDatumLabel
211
+ ? maxTextWidth + styles.textSizePx * 0.5
212
+ : 0
213
+ const valueTextAnchor = hasDatumLabel ? 'end' : 'start'
188
214
  const datumSvg = \`<text font-size="\${styles.textSizePx}" dominant-baseline="hanging" fill="\${styles.textColor}">
189
- \${datumLabelSvg}<tspan font-weight="bold">\${eventData.datum.value}</tspan>
215
+ \${datumLabelSvg}<tspan font-weight="bold" text-anchor="\${valueTextAnchor}" x="\${lineEndX}">\${valueText}</tspan>
190
216
  </text>\`
191
217
 
192
218
  return \`\${categorySvg}
@@ -33,7 +33,7 @@ import type {
33
33
  import {
34
34
  defineRelationshipPlugin } from '../../../lib/core'
35
35
  import type { BubblesParams, ArcScaleType, ForceDirectedParams } from '../../../lib/plugins-basic-types'
36
- import { getDatumColor, getClassName, getUniID } from '../../utils/orbchartsUtils'
36
+ import { getColor, getDatumColor, getClassName, getUniID } from '../../utils/orbchartsUtils'
37
37
  import { DEFAULT_FORCE_DIRECTED_PARAMS } from '../defaults'
38
38
  // import { renderCircleText } from '../../utils/d3Graphics'
39
39
  import { LAYER_INDEX_OF_GRAPHIC } from '../../const'
@@ -303,7 +303,7 @@ function translateCenterFn (d: any): string {
303
303
  function linkArcFn (d: RenderEdge): string {
304
304
  // console.log('linkArcFn', d)
305
305
 
306
- // var dx = d.target.x - d.source.x,
306
+ // const dx = d.target.x - d.source.x,
307
307
  // dy = d.target.y - d.source.y
308
308
  // dr讓方向線變成有弧度的
309
309
  // dr = Math.sqrt(dx * dx + dy * dy);
@@ -317,7 +317,7 @@ function linkArcFn (d: RenderEdge): string {
317
317
 
318
318
 
319
319
 
320
- function renderArrowMarker (defsSelection: d3.Selection<SVGDefsElement, any, any, unknown>, fullParams: ForceDirectedParams) {
320
+ function renderArrowMarker (defsSelection: d3.Selection<SVGDefsElement, any, any, unknown>, fullParams: ForceDirectedParams, fullChartParams: ChartParams) {
321
321
  return defsSelection
322
322
  .selectAll<SVGMarkerElement, any>(`marker.${defsArrowMarkerClassName}`)
323
323
  .data([fullParams])
@@ -327,6 +327,7 @@ function renderArrowMarker (defsSelection: d3.Selection<SVGDefsElement, any, any
327
327
  .append("marker")
328
328
  .classed(defsArrowMarkerClassName, true)
329
329
  .attr('id', defsArrowMarkerId)
330
+ .attr('fill', d => getColor(fullParams.arrow.colorType, fullChartParams ))
330
331
  .attr("viewBox", d => `-${d.arrow.pointerWidth} -${d.arrow.pointerHeight / 2} ${d.arrow.pointerWidth} ${d.arrow.pointerHeight}`)
331
332
  .attr("orient", "auto")
332
333
  enterSelection.append("path")
@@ -411,25 +412,25 @@ function renderArrowMarker (defsSelection: d3.Selection<SVGDefsElement, any, any
411
412
  // }
412
413
 
413
414
  function drag (simulation: d3.Simulation<d3.SimulationNodeDatum, undefined>, dragStatus$: BehaviorSubject<DragStatus>) {
414
- function dragstarted (event: D3DragEvent) {
415
- if (!event.active) simulation.alphaTarget(0.3).restart();
416
- event.subject.fx = event.subject.x;
417
- event.subject.fy = event.subject.y;
415
+ function dragstarted (event: D3DragEvent, node: RenderNode) {
416
+ if (!event.active) simulation.alphaTarget(0.3).restart()
417
+ event.subject.fx = event.x
418
+ event.subject.fy = event.y
418
419
 
419
420
  dragStatus$.next('start')
420
421
  }
421
422
 
422
- function dragged (event: D3DragEvent) {
423
- event.subject.fx = event.x;
424
- event.subject.fy = event.y;
423
+ function dragged (event: D3DragEvent, node: RenderNode) {
424
+ event.subject.fx = event.x
425
+ event.subject.fy = event.y
425
426
 
426
427
  dragStatus$.next('drag')
427
428
  }
428
429
 
429
- function dragended (event: D3DragEvent) {
430
+ function dragended (event: D3DragEvent, node: RenderNode) {
430
431
  if (!event.active) simulation.alphaTarget(0);
431
- event.subject.fx = null;
432
- event.subject.fy = null;
432
+ event.subject.fx = null
433
+ event.subject.fy = null
433
434
 
434
435
  dragStatus$.next('end')
435
436
  }
@@ -437,7 +438,7 @@ function drag (simulation: d3.Simulation<d3.SimulationNodeDatum, undefined>, dra
437
438
  return d3.drag()
438
439
  .on("start", dragstarted)
439
440
  .on("drag", dragged)
440
- .on("end", dragended);
441
+ .on("end", dragended)
441
442
  }
442
443
 
443
444
  function renderNodeG ({ nodeListGSelection, nodes }: {
@@ -736,7 +737,7 @@ function renderEdgeLabel ({ edgeLabelGSelection, fullParams, fullChartParams }:
736
737
  // .each((d,i,g) => {
737
738
  // const gSelection = d3.select(g[i])
738
739
  // let breakAll = true
739
- // if (d[textDataColumn].length <= fullParams.label.lineLengthMin) {
740
+ // if (d[textDataColumn].length <= fullParams.label.maxLineLength) {
740
741
  // breakAll = false
741
742
  // }
742
743
  // gSelection.call(renderCircleText, {
@@ -801,6 +802,7 @@ function highlightNodes ({ nodeGSelection, edgeGSelection, highlightIds, fullCha
801
802
  highlightIds: string[]
802
803
  }) {
803
804
  nodeGSelection.interrupt('highlight')
805
+ edgeGSelection.interrupt('highlight')
804
806
  // console.log(highlightIds)
805
807
  if (!highlightIds.length) {
806
808
  nodeGSelection
@@ -886,10 +888,14 @@ export const ForceDirected = defineRelationshipPlugin(pluginConfig)(({ selection
886
888
  const mouseEvent$ = new Subject<EventRelationship>()
887
889
 
888
890
  // <marker> marker selection
889
- observer.fullParams$.pipe(
891
+ combineLatest({
892
+ fullParams: observer.fullParams$,
893
+ fullChartParams: observer.fullChartParams$
894
+ }).pipe(
890
895
  takeUntil(destroy$),
891
- map(fullParams => {
892
- return renderArrowMarker(defsSelection, fullParams)
896
+ switchMap(async d => d),
897
+ map(({ fullParams, fullChartParams }) => {
898
+ return renderArrowMarker(defsSelection, fullParams, fullChartParams)
893
899
  })
894
900
  ).subscribe()
895
901
 
@@ -1006,7 +1012,7 @@ export const ForceDirected = defineRelationshipPlugin(pluginConfig)(({ selection
1006
1012
  fullParams: data.fullParams,
1007
1013
  fullChartParams: data.fullChartParams
1008
1014
  })
1009
- nodeCircleSelection.call(drag(data.simulation, dragStatus$))
1015
+ nodeGSelection.call(drag(data.simulation, dragStatus$))
1010
1016
 
1011
1017
  nodeLabelGSelection = renderNodeLabelG({
1012
1018
  nodeGSelection: nodeGSelection,
@@ -1122,6 +1128,7 @@ export const ForceDirected = defineRelationshipPlugin(pluginConfig)(({ selection
1122
1128
  })
1123
1129
 
1124
1130
  dragStatus$.pipe(
1131
+ distinctUntilChanged((a, b) => a === b),
1125
1132
  // 只有沒有托曳時才執行
1126
1133
  switchMap(d => iif(() => d === 'end', mouseEvent$, EMPTY))
1127
1134
  ).subscribe(data => {
@@ -35,7 +35,7 @@ import {
35
35
  getMinMax
36
36
  } from '../../../lib/core'
37
37
  import type { BubblesParams, ArcScaleType, ForceDirectedBubblesParams } from '../../../lib/plugins-basic-types'
38
- import { getDatumColor, getClassName, getUniID } from '../../utils/orbchartsUtils'
38
+ import { getColor, getDatumColor, getClassName, getUniID } from '../../utils/orbchartsUtils'
39
39
  import { DEFAULT_FORCE_DIRECTED_BUBBLES_PARAMS } from '../defaults'
40
40
  // import { renderCircleText } from '../../utils/d3Graphics'
41
41
  import { LAYER_INDEX_OF_GRAPHIC } from '../../const'
@@ -194,7 +194,7 @@ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_FORCE_D
194
194
  lineHeight: {
195
195
  toBeTypes: ['number']
196
196
  },
197
- lineLengthMin: {
197
+ maxLineLength: {
198
198
  toBeTypes: ['number']
199
199
  },
200
200
  colorType: {
@@ -342,7 +342,7 @@ function translateCenterFn (d: any): string {
342
342
  function linkArcFn (d: RenderEdge): string {
343
343
  // console.log('linkArcFn', d)
344
344
 
345
- // var dx = d.target.x - d.source.x,
345
+ // const dx = d.target.x - d.source.x,
346
346
  // dy = d.target.y - d.source.y
347
347
  // dr讓方向線變成有弧度的
348
348
  // dr = Math.sqrt(dx * dx + dy * dy);
@@ -356,10 +356,12 @@ function linkArcFn (d: RenderEdge): string {
356
356
 
357
357
 
358
358
 
359
- function renderArrowMarker ({ defsSelection, markerParams, markerData }: {
359
+ function renderArrowMarker ({ defsSelection, markerParams, markerData, fullParams, fullChartParams }: {
360
360
  defsSelection: d3.Selection<SVGDefsElement, any, any, unknown>
361
361
  markerParams: MarkerParams
362
362
  markerData: MarkerDatum[]
363
+ fullParams: ForceDirectedBubblesParams
364
+ fullChartParams: ChartParams
363
365
  }) {
364
366
  return defsSelection
365
367
  .selectAll<SVGMarkerElement, any>(`marker.${defsArrowMarkerClassName}`)
@@ -383,6 +385,7 @@ function renderArrowMarker ({ defsSelection, markerParams, markerData }: {
383
385
  }
384
386
  )
385
387
  .attr('id', d => d.id)
388
+ .attr('fill', d => getColor(fullParams.arrow.colorType, fullChartParams ))
386
389
  .attr("markerWidth", markerParams.pointerWidth)
387
390
  .attr("markerHeight", markerParams.pointerHeight)
388
391
  .attr('refX', d => d.refX)
@@ -450,25 +453,29 @@ function renderArrowMarker ({ defsSelection, markerParams, markerData }: {
450
453
  // }
451
454
 
452
455
  function drag (simulation: d3.Simulation<d3.SimulationNodeDatum, undefined>, dragStatus$: BehaviorSubject<DragStatus>) {
453
- function dragstarted (event: D3DragEvent) {
454
- if (!event.active) simulation.alphaTarget(0.3).restart();
455
- event.subject.fx = event.subject.x;
456
- event.subject.fy = event.subject.y;
456
+ function dragstarted (event: D3DragEvent, node: RenderNode) {
457
+ if (!event.active) {
458
+ simulation.alphaTarget(0.3).restart()
459
+ }
460
+ event.subject.fx = event.subject.x
461
+ event.subject.fy = event.subject.y
457
462
 
458
463
  dragStatus$.next('start')
459
464
  }
460
465
 
461
- function dragged (event: D3DragEvent) {
462
- event.subject.fx = event.x;
463
- event.subject.fy = event.y;
466
+ function dragged (event: D3DragEvent, node: RenderNode) {
467
+ event.subject.fx = event.x
468
+ event.subject.fy = event.y
464
469
 
465
470
  dragStatus$.next('drag')
466
471
  }
467
472
 
468
- function dragended (event: D3DragEvent) {
469
- if (!event.active) simulation.alphaTarget(0);
470
- event.subject.fx = null;
471
- event.subject.fy = null;
473
+ function dragended (event: D3DragEvent, node: RenderNode) {
474
+ if (!event.active) {
475
+ simulation.alphaTarget(0)
476
+ }
477
+ event.subject.fx = null
478
+ event.subject.fy = null
472
479
 
473
480
  dragStatus$.next('end')
474
481
  }
@@ -476,7 +483,7 @@ function drag (simulation: d3.Simulation<d3.SimulationNodeDatum, undefined>, dra
476
483
  return d3.drag()
477
484
  .on("start", dragstarted)
478
485
  .on("drag", dragged)
479
- .on("end", dragended);
486
+ .on("end", dragended)
480
487
  }
481
488
 
482
489
  function renderNodeG ({ nodeListGSelection, nodes }: {
@@ -538,17 +545,24 @@ function renderNodeCircle ({ nodeGSelection, fullParams, fullChartParams }: {
538
545
  .attr('font-size', baseLineHeight)
539
546
  .each((d,i,g) => {
540
547
  const gSelection = d3.select(g[i])
541
- let breakAll = true
542
- if (d.label.length <= fullParams.bubbleLabel.lineLengthMin) {
543
- breakAll = false
544
- }
548
+
545
549
  gSelection.call(renderCircleText, {
546
550
  text: d.label,
547
551
  radius: d.r * fullParams.bubbleLabel.fillRate,
548
552
  lineHeight: baseLineHeight * fullParams.bubbleLabel.lineHeight,
549
- isBreakAll: breakAll
553
+ isBreakAll: d.label.length <= fullParams.bubbleLabel.maxLineLength
554
+ ? false
555
+ : fullParams.bubbleLabel.wordBreakAll
550
556
  })
551
557
 
558
+ // -- text color --
559
+ gSelection.select('text').attr('fill', _ => getDatumColor({
560
+ datum: d,
561
+ colorType: fullParams.bubbleLabel.colorType,
562
+ fullChartParams: fullChartParams
563
+ }))
564
+
565
+
552
566
  })
553
567
 
554
568
  nodeGSelection.select('text')
@@ -796,7 +810,7 @@ function renderEdgeLabel ({ edgeLabelGSelection, fullParams, fullChartParams }:
796
810
  // .each((d,i,g) => {
797
811
  // const gSelection = d3.select(g[i])
798
812
  // let breakAll = true
799
- // if (d[textDataColumn].length <= fullParams.label.lineLengthMin) {
813
+ // if (d[textDataColumn].length <= fullParams.label.maxLineLength) {
800
814
  // breakAll = false
801
815
  // }
802
816
  // gSelection.call(renderCircleText, {
@@ -861,6 +875,7 @@ function highlightNodes ({ nodeGSelection, edgeGSelection, highlightIds, fullCha
861
875
  highlightIds: string[]
862
876
  }) {
863
877
  nodeGSelection.interrupt('highlight')
878
+ edgeGSelection.interrupt('highlight')
864
879
  // console.log(highlightIds)
865
880
  if (!highlightIds.length) {
866
881
  nodeGSelection
@@ -1196,14 +1211,19 @@ export const ForceDirectedBubbles = defineRelationshipPlugin(pluginConfig)(({ se
1196
1211
  combineLatest({
1197
1212
  defsSelection,
1198
1213
  markerParams: markerParams$,
1199
- markerData: markerData$
1214
+ markerData: markerData$,
1215
+ fullParams: observer.fullParams$,
1216
+ fullChartParams: observer.fullChartParams$
1200
1217
  }).pipe(
1201
1218
  takeUntil(destroy$),
1219
+ switchMap(async d => d),
1202
1220
  map(data => {
1203
1221
  return renderArrowMarker({
1204
1222
  defsSelection,
1205
1223
  markerParams: data.markerParams,
1206
- markerData: data.markerData
1224
+ markerData: data.markerData,
1225
+ fullParams: data.fullParams,
1226
+ fullChartParams: data.fullChartParams
1207
1227
  })
1208
1228
  })
1209
1229
  ).subscribe()
@@ -1231,7 +1251,7 @@ export const ForceDirectedBubbles = defineRelationshipPlugin(pluginConfig)(({ se
1231
1251
  fullParams: data.fullParams,
1232
1252
  fullChartParams: data.fullChartParams
1233
1253
  })
1234
- nodeCircleSelection.call(drag(data.simulation, dragStatus$))
1254
+ nodeGSelection.call(drag(data.simulation, dragStatus$))
1235
1255
 
1236
1256
  // nodeLabelGSelection = renderNodeLabelG({
1237
1257
  // nodeGSelection: nodeGSelection,
@@ -1346,6 +1366,7 @@ export const ForceDirectedBubbles = defineRelationshipPlugin(pluginConfig)(({ se
1346
1366
  })
1347
1367
 
1348
1368
  dragStatus$.pipe(
1369
+ distinctUntilChanged((a, b) => a === b),
1349
1370
  // 只有沒有托曳時才執行
1350
1371
  switchMap(d => iif(() => d === 'end', mouseEvent$, EMPTY))
1351
1372
  ).subscribe(data => {