@orbcharts/plugins-basic 3.0.0-beta.14 → 3.0.0-beta.16

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 (180) hide show
  1. package/dist/orbcharts-plugins-basic.es.js +15129 -13927
  2. package/dist/orbcharts-plugins-basic.umd.js +72 -72
  3. package/dist/{orbcharts-plugins-basic/src → src}/base/BaseBars.d.ts +3 -3
  4. package/dist/{orbcharts-plugins-basic/src → src}/base/BaseBarsTriangle.d.ts +3 -3
  5. package/dist/{orbcharts-plugins-basic/src → src}/base/BaseDots.d.ts +3 -3
  6. package/dist/{orbcharts-plugins-basic/src → src}/base/BaseLineAreas.d.ts +3 -3
  7. package/dist/{orbcharts-plugins-basic/src → src}/base/BaseLines.d.ts +3 -3
  8. package/dist/src/base/BaseRacingBars.d.ts +23 -0
  9. package/dist/src/base/BaseRacingLabels.d.ts +20 -0
  10. package/dist/src/base/BaseRacingValueLabels.d.ts +20 -0
  11. package/dist/{orbcharts-plugins-basic/src/base/BaseStackedBar.d.ts → src/base/BaseStackedBars.d.ts} +7 -7
  12. package/dist/{orbcharts-plugins-basic/src → src}/base/BaseValueAxis.d.ts +4 -7
  13. package/dist/src/base/BaseXAxis.d.ts +20 -0
  14. package/dist/src/base/BaseYAxis.d.ts +18 -0
  15. package/dist/{orbcharts-plugins-basic/src → src}/grid/defaults.d.ts +3 -3
  16. package/dist/{orbcharts-plugins-basic/src → src}/grid/gridObservables.d.ts +8 -1
  17. package/dist/{orbcharts-plugins-basic/src → src}/grid/index.d.ts +2 -2
  18. package/dist/src/grid/plugins/GroupZoom.d.ts +1 -0
  19. package/dist/src/grid/plugins/StackedBars.d.ts +1 -0
  20. package/dist/src/index.d.ts +7 -1
  21. package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/defaults.d.ts +2 -2
  22. package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/index.d.ts +1 -1
  23. package/dist/src/multiGrid/plugins/MultiStackedBars.d.ts +1 -0
  24. package/dist/src/multiValue/defaults.d.ts +13 -0
  25. package/dist/{orbcharts-plugins-basic/src → src}/multiValue/index.d.ts +5 -1
  26. package/dist/src/multiValue/multiValueObservables.d.ts +56 -0
  27. package/dist/src/multiValue/plugins/RacingBars.d.ts +1 -0
  28. package/dist/src/multiValue/plugins/RacingCounterTexts.d.ts +3 -0
  29. package/dist/src/multiValue/plugins/RacingValueAxis.d.ts +1 -0
  30. package/dist/src/multiValue/plugins/XAxis.d.ts +1 -0
  31. package/dist/src/multiValue/plugins/XYAxes.d.ts +1 -0
  32. package/dist/src/multiValue/plugins/XZoom.d.ts +1 -0
  33. package/lib/core.ts +1 -1
  34. package/package.json +4 -4
  35. package/src/base/BaseBars.ts +11 -11
  36. package/src/base/BaseBarsTriangle.ts +11 -11
  37. package/src/base/BaseDots.ts +10 -10
  38. package/src/base/BaseGroupAxis.ts +2 -0
  39. package/src/base/BaseLineAreas.ts +8 -8
  40. package/src/base/BaseLines.ts +7 -7
  41. package/src/base/BaseRacingBars.ts +552 -0
  42. package/src/base/BaseRacingLabels.ts +392 -0
  43. package/src/base/BaseRacingValueLabels.ts +403 -0
  44. package/src/base/{BaseStackedBar.ts → BaseStackedBars.ts} +22 -22
  45. package/src/base/BaseValueAxis.ts +70 -53
  46. package/src/base/BaseXAxis.ts +427 -0
  47. package/src/base/BaseYAxis.ts +389 -0
  48. package/src/grid/defaults.ts +4 -56
  49. package/src/grid/gridObservables.ts +58 -0
  50. package/src/grid/index.ts +2 -2
  51. package/src/grid/plugins/Bars.ts +2 -2
  52. package/src/grid/plugins/BarsPN.ts +2 -2
  53. package/src/grid/plugins/BarsTriangle.ts +2 -2
  54. package/src/grid/plugins/Dots.ts +2 -2
  55. package/src/grid/plugins/GridLegend.ts +7 -7
  56. package/src/grid/plugins/GroupAxis.ts +0 -24
  57. package/src/grid/plugins/{GridZoom.ts → GroupZoom.ts} +2 -2
  58. package/src/grid/plugins/LineAreas.ts +2 -2
  59. package/src/grid/plugins/Lines.ts +2 -2
  60. package/src/grid/plugins/{StackedBar.ts → StackedBars.ts} +6 -6
  61. package/src/multiGrid/defaults.ts +2 -2
  62. package/src/multiGrid/index.ts +1 -1
  63. package/src/multiGrid/multiGridObservables.ts +1 -0
  64. package/src/multiGrid/plugins/MultiBars.ts +3 -3
  65. package/src/multiGrid/plugins/MultiBarsTriangle.ts +3 -3
  66. package/src/multiGrid/plugins/MultiDots.ts +3 -3
  67. package/src/multiGrid/plugins/MultiGridLegend.ts +20 -10
  68. package/src/multiGrid/plugins/MultiLineAreas.ts +3 -3
  69. package/src/multiGrid/plugins/MultiLines.ts +3 -3
  70. package/src/multiGrid/plugins/{MultiStackedBar.ts → MultiStackedBars.ts} +7 -7
  71. package/src/multiGrid/plugins/OverlappingStackedValueAxes.ts +1 -0
  72. package/src/multiValue/defaults.ts +137 -4
  73. package/src/multiValue/index.ts +5 -1
  74. package/src/multiValue/multiValueObservables.ts +414 -44
  75. package/src/multiValue/plugins/OrdinalBubbles.ts +0 -0
  76. package/src/multiValue/plugins/OrdinalXAxis.ts +0 -0
  77. package/src/multiValue/plugins/RacingBars.ts +362 -0
  78. package/src/multiValue/plugins/RacingCounterAxis.ts +0 -0
  79. package/src/multiValue/plugins/RacingCounterTexts.ts +300 -0
  80. package/src/multiValue/plugins/RacingValueAxis.ts +115 -0
  81. package/src/multiValue/plugins/RankingAxis_legacy.ts +109 -0
  82. package/src/multiValue/plugins/Scatter.ts +13 -13
  83. package/src/multiValue/plugins/ScatterBubbles.ts +13 -13
  84. package/src/multiValue/plugins/XAxis.ts +108 -0
  85. package/src/multiValue/plugins/XYAux.ts +13 -13
  86. package/src/multiValue/plugins/XYAxes.ts +38 -528
  87. package/src/multiValue/plugins/XYAxes_legacy.ts +684 -0
  88. package/src/multiValue/plugins/{XYZoom.ts → XZoom.ts} +14 -14
  89. package/src/series/defaults.ts +2 -13
  90. package/src/series/plugins/Bubbles.ts +45 -29
  91. package/src/series/plugins/Pie.ts +5 -5
  92. package/src/series/plugins/PieEventTexts.ts +3 -3
  93. package/src/series/plugins/PieLabels.ts +5 -5
  94. package/src/series/plugins/Rose.ts +11 -11
  95. package/src/series/plugins/RoseLabels.ts +9 -9
  96. package/dist/orbcharts-plugins-basic/src/grid/plugins/GridZoom.d.ts +0 -1
  97. package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedBar.d.ts +0 -1
  98. package/dist/orbcharts-plugins-basic/src/index.d.ts +0 -7
  99. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedBar.d.ts +0 -1
  100. package/dist/orbcharts-plugins-basic/src/multiValue/defaults.d.ts +0 -9
  101. package/dist/orbcharts-plugins-basic/src/multiValue/multiValueObservables.d.ts +0 -33
  102. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYZoom.d.ts +0 -1
  103. /package/dist/{orbcharts-plugins-basic/lib → lib}/core-types.d.ts +0 -0
  104. /package/dist/{orbcharts-plugins-basic/lib → lib}/core.d.ts +0 -0
  105. /package/dist/{orbcharts-plugins-basic/lib → lib}/plugins-basic-types.d.ts +0 -0
  106. /package/dist/{orbcharts-plugins-basic/src → src}/base/BaseGroupAxis.d.ts +0 -0
  107. /package/dist/{orbcharts-plugins-basic/src → src}/base/BaseLegend.d.ts +0 -0
  108. /package/dist/{orbcharts-plugins-basic/src → src}/base/BaseTooltip.d.ts +0 -0
  109. /package/dist/{orbcharts-plugins-basic/src → src}/base/types.d.ts +0 -0
  110. /package/dist/{orbcharts-plugins-basic/src → src}/const.d.ts +0 -0
  111. /package/dist/{orbcharts-plugins-basic/src → src}/grid/plugins/Bars.d.ts +0 -0
  112. /package/dist/{orbcharts-plugins-basic/src → src}/grid/plugins/BarsPN.d.ts +0 -0
  113. /package/dist/{orbcharts-plugins-basic/src → src}/grid/plugins/BarsTriangle.d.ts +0 -0
  114. /package/dist/{orbcharts-plugins-basic/src → src}/grid/plugins/Dots.d.ts +0 -0
  115. /package/dist/{orbcharts-plugins-basic/src → src}/grid/plugins/GridLegend.d.ts +0 -0
  116. /package/dist/{orbcharts-plugins-basic/src → src}/grid/plugins/GridTooltip.d.ts +0 -0
  117. /package/dist/{orbcharts-plugins-basic/src → src}/grid/plugins/GroupAux.d.ts +0 -0
  118. /package/dist/{orbcharts-plugins-basic/src → src}/grid/plugins/GroupAxis.d.ts +0 -0
  119. /package/dist/{orbcharts-plugins-basic/src → src}/grid/plugins/LineAreas.d.ts +0 -0
  120. /package/dist/{orbcharts-plugins-basic/src → src}/grid/plugins/Lines.d.ts +0 -0
  121. /package/dist/{orbcharts-plugins-basic/src → src}/grid/plugins/StackedValueAxis.d.ts +0 -0
  122. /package/dist/{orbcharts-plugins-basic/src → src}/grid/plugins/ValueAxis.d.ts +0 -0
  123. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/multiGridObservables.d.ts +0 -0
  124. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/plugins/MultiBars.d.ts +0 -0
  125. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/plugins/MultiBarsTriangle.d.ts +0 -0
  126. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/plugins/MultiDots.d.ts +0 -0
  127. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/plugins/MultiGridLegend.d.ts +0 -0
  128. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/plugins/MultiGridTooltip.d.ts +0 -0
  129. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/plugins/MultiGroupAxis.d.ts +0 -0
  130. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/plugins/MultiLineAreas.d.ts +0 -0
  131. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/plugins/MultiLines.d.ts +0 -0
  132. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/plugins/MultiStackedValueAxis.d.ts +0 -0
  133. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/plugins/MultiValueAxis.d.ts +0 -0
  134. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/plugins/OverlappingStackedValueAxes.d.ts +0 -0
  135. /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -0
  136. /package/dist/{orbcharts-plugins-basic/src → src}/multiValue/plugins/MultiValueLegend.d.ts +0 -0
  137. /package/dist/{orbcharts-plugins-basic/src → src}/multiValue/plugins/MultiValueTooltip.d.ts +0 -0
  138. /package/dist/{orbcharts-plugins-basic/src/multiValue/plugins/Ranking.d.ts → src/multiValue/plugins/OrdinalBubbles.d.ts} +0 -0
  139. /package/dist/{orbcharts-plugins-basic/src/multiValue/plugins/RankingAxis.d.ts → src/multiValue/plugins/OrdinalXAxis.d.ts} +0 -0
  140. /package/dist/{orbcharts-plugins-basic/src/noneData/plugins/Container.d.ts → src/multiValue/plugins/RacingCounterAxis.d.ts} +0 -0
  141. /package/dist/{orbcharts-plugins-basic/src/noneData/plugins/Tooltip.d.ts → src/multiValue/plugins/RankingAxis_legacy.d.ts} +0 -0
  142. /package/dist/{orbcharts-plugins-basic/src → src}/multiValue/plugins/Scatter.d.ts +0 -0
  143. /package/dist/{orbcharts-plugins-basic/src → src}/multiValue/plugins/ScatterBubbles.d.ts +0 -0
  144. /package/dist/{orbcharts-plugins-basic/src → src}/multiValue/plugins/XYAux.d.ts +0 -0
  145. /package/dist/{orbcharts-plugins-basic/src/multiValue/plugins/XYAxes.d.ts → src/multiValue/plugins/XYAxes_legacy.d.ts} +0 -0
  146. /package/dist/{orbcharts-plugins-basic/src → src}/noneData/defaults.d.ts +0 -0
  147. /package/dist/{orbcharts-plugins-basic/src → src}/noneData/index.d.ts +0 -0
  148. /package/dist/{orbcharts-plugins-basic/src/series/plugins/Waffle.d.ts → src/noneData/plugins/Container.d.ts} +0 -0
  149. /package/{src/multiValue/plugins/Ranking.ts → dist/src/noneData/plugins/Tooltip.d.ts} +0 -0
  150. /package/dist/{orbcharts-plugins-basic/src → src}/relationship/defaults.d.ts +0 -0
  151. /package/dist/{orbcharts-plugins-basic/src → src}/relationship/index.d.ts +0 -0
  152. /package/dist/{orbcharts-plugins-basic/src → src}/relationship/plugins/ForceDirected.d.ts +0 -0
  153. /package/dist/{orbcharts-plugins-basic/src → src}/relationship/plugins/ForceDirectedBubbles.d.ts +0 -0
  154. /package/dist/{orbcharts-plugins-basic/src → src}/relationship/plugins/RelationshipLegend.d.ts +0 -0
  155. /package/dist/{orbcharts-plugins-basic/src → src}/relationship/plugins/RelationshipTooltip.d.ts +0 -0
  156. /package/dist/{orbcharts-plugins-basic/src → src}/relationship/relationshipObservables.d.ts +0 -0
  157. /package/dist/{orbcharts-plugins-basic/src → src}/series/defaults.d.ts +0 -0
  158. /package/dist/{orbcharts-plugins-basic/src → src}/series/index.d.ts +0 -0
  159. /package/dist/{orbcharts-plugins-basic/src → src}/series/plugins/Bubbles.d.ts +0 -0
  160. /package/dist/{orbcharts-plugins-basic/src → src}/series/plugins/Pie.d.ts +0 -0
  161. /package/dist/{orbcharts-plugins-basic/src → src}/series/plugins/PieEventTexts.d.ts +0 -0
  162. /package/dist/{orbcharts-plugins-basic/src → src}/series/plugins/PieLabels.d.ts +0 -0
  163. /package/dist/{orbcharts-plugins-basic/src → src}/series/plugins/Rose.d.ts +0 -0
  164. /package/dist/{orbcharts-plugins-basic/src → src}/series/plugins/RoseLabels.d.ts +0 -0
  165. /package/dist/{orbcharts-plugins-basic/src → src}/series/plugins/SeriesLegend.d.ts +0 -0
  166. /package/dist/{orbcharts-plugins-basic/src → src}/series/plugins/SeriesTooltip.d.ts +0 -0
  167. /package/{src/multiValue/plugins/RankingAxis.ts → dist/src/series/plugins/Waffle.d.ts} +0 -0
  168. /package/dist/{orbcharts-plugins-basic/src → src}/series/seriesObservables.d.ts +0 -0
  169. /package/dist/{orbcharts-plugins-basic/src → src}/series/seriesUtils.d.ts +0 -0
  170. /package/dist/{orbcharts-plugins-basic/src → src}/tree/defaults.d.ts +0 -0
  171. /package/dist/{orbcharts-plugins-basic/src → src}/tree/index.d.ts +0 -0
  172. /package/dist/{orbcharts-plugins-basic/src → src}/tree/plugins/TreeLegend.d.ts +0 -0
  173. /package/dist/{orbcharts-plugins-basic/src → src}/tree/plugins/TreeMap.d.ts +0 -0
  174. /package/dist/{orbcharts-plugins-basic/src → src}/tree/plugins/TreeTooltip.d.ts +0 -0
  175. /package/dist/{orbcharts-plugins-basic/src → src}/utils/commonUtils.d.ts +0 -0
  176. /package/dist/{orbcharts-plugins-basic/src → src}/utils/d3Graphics.d.ts +0 -0
  177. /package/dist/{orbcharts-plugins-basic/src → src}/utils/d3Utils.d.ts +0 -0
  178. /package/dist/{orbcharts-plugins-basic/src → src}/utils/observables.d.ts +0 -0
  179. /package/dist/{orbcharts-plugins-basic/src → src}/utils/orbchartsUtils.d.ts +0 -0
  180. /package/dist/{orbcharts-plugins-basic/vite.config.d.ts → vite.config.d.ts} +0 -0
@@ -0,0 +1,115 @@
1
+ import {
2
+ Observable,
3
+ Subject,
4
+ combineLatest,
5
+ takeUntil,
6
+ of,
7
+ map,
8
+ distinctUntilChanged,
9
+ switchMap,
10
+ shareReplay
11
+ } from 'rxjs'
12
+ import type {
13
+ DefinePluginConfig,
14
+ } from '../../../lib/core-types'
15
+ import {
16
+ defineMultiValuePlugin,
17
+ } from '../../../lib/core'
18
+ import { DEFAULT_RACING_VALUE_AXIS_PARAMS } from '../defaults'
19
+ import { LAYER_INDEX_OF_AXIS } from '../../const'
20
+ import { createBaseXAxis } from '../../base/BaseXAxis'
21
+
22
+ const pluginName = 'RacingValueAxis'
23
+
24
+
25
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_RACING_VALUE_AXIS_PARAMS> = {
26
+ name: pluginName,
27
+ defaultParams: DEFAULT_RACING_VALUE_AXIS_PARAMS,
28
+ layerIndex: LAYER_INDEX_OF_AXIS,
29
+ validator: (params, { validateColumns }) => {
30
+ const result = validateColumns(params, {
31
+ labelOffset: {
32
+ toBe: '[number, number]',
33
+ test: (value: any) => {
34
+ return Array.isArray(value)
35
+ && value.length === 2
36
+ && typeof value[0] === 'number'
37
+ && typeof value[1] === 'number'
38
+ }
39
+ },
40
+ labelColorType: {
41
+ toBeOption: 'ColorType',
42
+ },
43
+ axisLineVisible: {
44
+ toBeTypes: ['boolean']
45
+ },
46
+ axisLineColorType: {
47
+ toBeOption: 'ColorType',
48
+ },
49
+ ticks: {
50
+ toBeTypes: ['number', 'null']
51
+ },
52
+ tickFormat: {
53
+ toBeTypes: ['string', 'Function']
54
+ },
55
+ tickLineVisible: {
56
+ toBeTypes: ['boolean']
57
+ },
58
+ tickPadding: {
59
+ toBeTypes: ['number']
60
+ },
61
+ tickFullLine: {
62
+ toBeTypes: ['boolean']
63
+ },
64
+ tickFullLineDasharray: {
65
+ toBeTypes: ['string']
66
+ },
67
+ tickColorType: {
68
+ toBeOption: 'ColorType',
69
+ },
70
+ tickTextColorType: {
71
+ toBeOption: 'ColorType',
72
+ }
73
+ })
74
+ if (result.status === 'error') {
75
+ return result
76
+ }
77
+ return result
78
+ }
79
+ }
80
+
81
+
82
+
83
+ export const RacingValueAxis = defineMultiValuePlugin(pluginConfig)(({ selection, name, observer, subject }) => {
84
+
85
+ const destroy$ = new Subject()
86
+
87
+ // 過渡速度和圖形一致
88
+ const transitionDuration$ = observer.fullChartParams$.pipe(
89
+ takeUntil(destroy$),
90
+ map(d => d.transitionDuration),
91
+ distinctUntilChanged()
92
+ )
93
+
94
+ const unsubscribeBaseXAxis = createBaseXAxis(pluginName, {
95
+ selection,
96
+ position$: of('top'),
97
+ transitionDuration$,
98
+ computedData$: observer.computedData$,
99
+ fullParams$: observer.fullParams$,
100
+ fullDataFormatter$: observer.fullDataFormatter$,
101
+ fullChartParams$: observer.fullChartParams$,
102
+ isCategorySeprate$: observer.isCategorySeprate$,
103
+ containerPosition$: observer.containerPosition$,
104
+ // layout$: observer.layout$,
105
+ containerSize$: observer.containerSize$,
106
+ xScale$: observer.xScale$,
107
+ // filteredXYMinMaxData$: observer.filteredXYMinMaxData$,
108
+ // xyMinMax$: observer.xyMinMax$,
109
+ })
110
+
111
+ return () => {
112
+ destroy$.next(undefined)
113
+ unsubscribeBaseXAxis()
114
+ }
115
+ })
@@ -0,0 +1,109 @@
1
+ // import * as d3 from 'd3'
2
+ // import {
3
+ // Observable,
4
+ // Subject,
5
+ // combineLatest,
6
+ // takeUntil,
7
+ // map,
8
+ // distinctUntilChanged,
9
+ // switchMap,
10
+ // shareReplay
11
+ // } from 'rxjs'
12
+ // import type {
13
+ // ColorType,
14
+ // ChartParams,
15
+ // ComputedDatumMultiValue,
16
+ // ComputedDataMultiValue,
17
+ // ComputedXYDatumMultiValue,
18
+ // ContainerPositionScaled,
19
+ // DataFormatterMultiValue,
20
+ // DefinePluginConfig,
21
+ // TransformData,
22
+ // Layout
23
+ // } from '../../../lib/core-types'
24
+ // import { defineMultiValuePlugin } from '../../../lib/core'
25
+ // import { createBaseRacingAxis } from '../../base/BaseRacingAxis'
26
+ // import { DEFAULT_RANKING_AXIS_PARAMS } from '../defaults'
27
+ // import { LAYER_INDEX_OF_AXIS } from '../../const'
28
+
29
+ // const pluginName = 'RacingAxis'
30
+
31
+ // const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_RANKING_AXIS_PARAMS> = {
32
+ // name: pluginName,
33
+ // defaultParams: DEFAULT_RANKING_AXIS_PARAMS,
34
+ // layerIndex: LAYER_INDEX_OF_AXIS,
35
+ // validator: (params, { validateColumns }) => {
36
+ // const result = validateColumns(params, {
37
+ // labelOffset: {
38
+ // toBe: '[number, number]',
39
+ // test: (value: any) => {
40
+ // return Array.isArray(value)
41
+ // && value.length === 2
42
+ // && typeof value[0] === 'number'
43
+ // && typeof value[1] === 'number'
44
+ // }
45
+ // },
46
+ // labelColorType: {
47
+ // toBeOption: 'ColorType',
48
+ // },
49
+ // axisLineVisible: {
50
+ // toBeTypes: ['boolean']
51
+ // },
52
+ // axisLineColorType: {
53
+ // toBeOption: 'ColorType',
54
+ // },
55
+ // // ticks: {
56
+ // // toBeTypes: ['number', 'null']
57
+ // // },
58
+ // // tickFormat: {
59
+ // // toBeTypes: ['string', 'Function']
60
+ // // },
61
+ // tickLineVisible: {
62
+ // toBeTypes: ['boolean']
63
+ // },
64
+ // tickPadding: {
65
+ // toBeTypes: ['number']
66
+ // },
67
+ // // tickFullLine: {
68
+ // // toBeTypes: ['boolean']
69
+ // // },
70
+ // // tickFullLineDasharray: {
71
+ // // toBeTypes: ['string']
72
+ // // },
73
+ // tickColorType: {
74
+ // toBeOption: 'ColorType',
75
+ // },
76
+ // tickTextColorType: {
77
+ // toBeOption: 'ColorType',
78
+ // }
79
+ // })
80
+ // if (result.status === 'error') {
81
+ // return result
82
+ // }
83
+ // return result
84
+ // }
85
+ // }
86
+
87
+ // export const RacingAxis = defineMultiValuePlugin(pluginConfig)(({ selection, name, observer, subject }) => {
88
+
89
+ // const destroy$ = new Subject()
90
+
91
+ // const unsubscribeBaseRacingAxis = createBaseRacingAxis(pluginName, {
92
+ // selection,
93
+ // computedData$: observer.computedData$,
94
+ // visibleComputedData$: observer.visibleComputedData$,
95
+ // fullParams$: observer.fullParams$,
96
+ // fullDataFormatter$: observer.fullDataFormatter$,
97
+ // fullChartParams$: observer.fullChartParams$,
98
+ // xyMinMax$: observer.xyMinMax$,
99
+ // textSizePx$: observer.textSizePx$,
100
+ // layout$: observer.layout$,
101
+ // containerPosition$: observer.containerPosition$,
102
+ // isCategorySeprate$: observer.isCategorySeprate$,
103
+ // })
104
+
105
+ // return () => {
106
+ // destroy$.next(undefined)
107
+ // unsubscribeBaseRacingAxis()
108
+ // }
109
+ // })
@@ -11,7 +11,7 @@ import {
11
11
  import type {
12
12
  ComputedDatumMultiValue,
13
13
  ComputedDataMultiValue,
14
- ComputedLayoutDataMultiValue,
14
+ ComputedXYDataMultiValue,
15
15
  DefinePluginConfig,
16
16
  EventMultiValue,
17
17
  ChartParams,
@@ -68,11 +68,11 @@ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_SCATTER
68
68
  }
69
69
  }
70
70
 
71
- function renderDots ({ graphicGSelection, circleGClassName, circleClassName, visibleComputedLayoutData, fullParams, fullChartParams, graphicReverseScale }: {
71
+ function renderDots ({ graphicGSelection, circleGClassName, circleClassName, visibleComputedXYData, fullParams, fullChartParams, graphicReverseScale }: {
72
72
  graphicGSelection: d3.Selection<SVGGElement, any, any, any>
73
73
  circleGClassName: string
74
74
  circleClassName: string
75
- visibleComputedLayoutData: ComputedLayoutDataMultiValue
75
+ visibleComputedXYData: ComputedXYDataMultiValue
76
76
  fullParams: ScatterParams
77
77
  fullChartParams: ChartParams
78
78
  graphicReverseScale: [number, number][]
@@ -89,7 +89,7 @@ function renderDots ({ graphicGSelection, circleGClassName, circleClassName, vis
89
89
  .each((categoryData, categoryIndex, g) => {
90
90
  d3.select(g[categoryIndex])
91
91
  .selectAll<SVGGElement, ComputedDatumMultiValue>('g')
92
- .data(visibleComputedLayoutData[categoryIndex], d => d.id)
92
+ .data(visibleComputedXYData[categoryIndex], d => d.id)
93
93
  .join(
94
94
  enter => {
95
95
  // enterDuration
@@ -234,19 +234,19 @@ export const Scatter = defineMultiValuePlugin(pluginConfig)(({ selection, name,
234
234
  pluginName,
235
235
  clipPathID,
236
236
  categoryLabels$: observer.categoryLabels$,
237
- multiValueContainerPosition$: observer.multiValueContainerPosition$,
238
- multiValueGraphicTransform$: observer.multiValueGraphicTransform$
237
+ containerPosition$: observer.containerPosition$,
238
+ graphicTransform$: observer.graphicTransform$
239
239
  })
240
240
 
241
241
  const graphicReverseScale$: Observable<[number, number][]> = combineLatest({
242
242
  computedData: observer.computedData$,
243
- multiValueGraphicReverseScale: observer.multiValueGraphicReverseScale$
243
+ graphicReverseScale: observer.graphicReverseScale$
244
244
  }).pipe(
245
245
  takeUntil(destroy$),
246
246
  switchMap(async data => data),
247
247
  map(data => {
248
248
  return data.computedData.map((series, categoryIndex) => {
249
- return data.multiValueGraphicReverseScale[categoryIndex]
249
+ return data.graphicReverseScale[categoryIndex]
250
250
  })
251
251
  })
252
252
  )
@@ -272,7 +272,7 @@ export const Scatter = defineMultiValuePlugin(pluginConfig)(({ selection, name,
272
272
 
273
273
  const graphicSelection$ = combineLatest({
274
274
  graphicGSelection: graphicGSelection$,
275
- visibleComputedLayoutData: observer.visibleComputedLayoutData$,
275
+ visibleComputedXYData: observer.visibleComputedXYData$,
276
276
  graphicReverseScale: graphicReverseScale$,
277
277
  fullChartParams: observer.fullChartParams$,
278
278
  fullParams: observer.fullParams$,
@@ -284,7 +284,7 @@ export const Scatter = defineMultiValuePlugin(pluginConfig)(({ selection, name,
284
284
  graphicGSelection: data.graphicGSelection,
285
285
  circleGClassName,
286
286
  circleClassName,
287
- visibleComputedLayoutData: data.visibleComputedLayoutData,
287
+ visibleComputedXYData: data.visibleComputedXYData,
288
288
  fullParams: data.fullParams,
289
289
  fullChartParams: data.fullChartParams,
290
290
  graphicReverseScale: data.graphicReverseScale
@@ -389,7 +389,7 @@ export const Scatter = defineMultiValuePlugin(pluginConfig)(({ selection, name,
389
389
 
390
390
  combineLatest({
391
391
  graphicSelection: graphicSelection$,
392
- highlight: observer.multiValueHighlight$.pipe(
392
+ highlight: observer.highlight$.pipe(
393
393
  map(data => data.map(d => d.id))
394
394
  ),
395
395
  fullChartParams: observer.fullChartParams$
@@ -408,8 +408,8 @@ export const Scatter = defineMultiValuePlugin(pluginConfig)(({ selection, name,
408
408
  // console.log('graphicGSelection$', data)
409
409
  // })
410
410
 
411
- // observer.visibleComputedLayoutData$.subscribe(data => {
412
- // console.log('visibleComputedLayoutData$', data)
411
+ // observer.visibleComputedXYData$.subscribe(data => {
412
+ // console.log('visibleComputedXYData$', data)
413
413
  // })
414
414
 
415
415
  // observer.fullChartParams$.subscribe(data => {
@@ -14,8 +14,8 @@ import {
14
14
  import type {
15
15
  ComputedDatumMultiValue,
16
16
  ComputedDataMultiValue,
17
- ComputedLayoutDatumMultiValue,
18
- ComputedLayoutDataMultiValue,
17
+ ComputedXYDatumMultiValue,
18
+ ComputedXYDataMultiValue,
19
19
  DefinePluginConfig,
20
20
  EventMultiValue,
21
21
  ChartParams,
@@ -42,7 +42,7 @@ type ClipPathDatum = {
42
42
  height: number;
43
43
  }
44
44
 
45
- interface BubbleDatum extends ComputedLayoutDatumMultiValue {
45
+ interface BubbleDatum extends ComputedXYDatumMultiValue {
46
46
  r: number
47
47
  opacity: number
48
48
  }
@@ -91,7 +91,7 @@ function renderDots ({ graphicGSelection, circleGClassName, circleClassName, bub
91
91
  graphicGSelection: d3.Selection<SVGGElement, any, any, any>
92
92
  circleGClassName: string
93
93
  circleClassName: string
94
- // visibleComputedLayoutData: ComputedLayoutDataMultiValue
94
+ // visibleComputedLayoutData: ComputedXYDataMultiValue
95
95
  bubbleData: BubbleDatum[][]
96
96
  fullParams: ScatterBubblesParams
97
97
  fullChartParams: ChartParams
@@ -254,19 +254,19 @@ export const ScatterBubbles = defineMultiValuePlugin(pluginConfig)(({ selection,
254
254
  pluginName,
255
255
  clipPathID,
256
256
  categoryLabels$: observer.categoryLabels$,
257
- multiValueContainerPosition$: observer.multiValueContainerPosition$,
258
- multiValueGraphicTransform$: observer.multiValueGraphicTransform$
257
+ containerPosition$: observer.containerPosition$,
258
+ graphicTransform$: observer.graphicTransform$
259
259
  })
260
260
 
261
261
  const graphicReverseScale$: Observable<[number, number][]> = combineLatest({
262
262
  computedData: observer.computedData$,
263
- multiValueGraphicReverseScale: observer.multiValueGraphicReverseScale$
263
+ graphicReverseScale: observer.graphicReverseScale$
264
264
  }).pipe(
265
265
  takeUntil(destroy$),
266
266
  switchMap(async data => data),
267
267
  map(data => {
268
268
  return data.computedData.map((series, categoryIndex) => {
269
- return data.multiValueGraphicReverseScale[categoryIndex]
269
+ return data.graphicReverseScale[categoryIndex]
270
270
  })
271
271
  })
272
272
  )
@@ -290,13 +290,13 @@ export const ScatterBubbles = defineMultiValuePlugin(pluginConfig)(({ selection,
290
290
  })
291
291
  })
292
292
 
293
- const filteredValueList$ = observer.filteredMinMaxXYData$.pipe(
293
+ const filteredValueList$ = observer.filteredXYMinMaxData$.pipe(
294
294
  takeUntil(destroy$),
295
295
  map(data => data.datumList.flat().map(d => d.value[2] ?? 0)),
296
296
  shareReplay(1)
297
297
  )
298
298
 
299
- const filteredMinMaxValue$ = observer.filteredMinMaxXYData$.pipe(
299
+ const filteredMinMaxValue$ = observer.filteredXYMinMaxData$.pipe(
300
300
  takeUntil(destroy$),
301
301
  map(data => {
302
302
  return getMinMax(data.datumList.flat().map(d => d.value[2] ?? 0))
@@ -376,7 +376,7 @@ export const ScatterBubbles = defineMultiValuePlugin(pluginConfig)(({ selection,
376
376
  )
377
377
 
378
378
  const bubbleData$ = combineLatest({
379
- computedLayoutData: observer.computedLayoutData$,
379
+ visibleComputedXYData: observer.visibleComputedXYData$,
380
380
  opacityScale: opacityScale$,
381
381
  radiusScale: radiusScale$,
382
382
  scaleFactor: scaleFactor$,
@@ -385,7 +385,7 @@ export const ScatterBubbles = defineMultiValuePlugin(pluginConfig)(({ selection,
385
385
  takeUntil(destroy$),
386
386
  switchMap(async (d) => d),
387
387
  map(data => {
388
- return data.computedLayoutData.map(category => {
388
+ return data.visibleComputedXYData.map(category => {
389
389
  return category.map(_d => {
390
390
  const d: BubbleDatum = _d as BubbleDatum
391
391
  d.r = data.radiusScale(d.value[2]) * data.scaleFactor * adjustmentFactor
@@ -517,7 +517,7 @@ export const ScatterBubbles = defineMultiValuePlugin(pluginConfig)(({ selection,
517
517
 
518
518
  combineLatest({
519
519
  graphicSelection: graphicSelection$,
520
- highlight: observer.multiValueHighlight$.pipe(
520
+ highlight: observer.highlight$.pipe(
521
521
  map(data => data.map(d => d.id))
522
522
  ),
523
523
  fullChartParams: observer.fullChartParams$
@@ -0,0 +1,108 @@
1
+ import {
2
+ Observable,
3
+ Subject,
4
+ combineLatest,
5
+ takeUntil,
6
+ of,
7
+ map,
8
+ distinctUntilChanged,
9
+ switchMap,
10
+ shareReplay
11
+ } from 'rxjs'
12
+ import type {
13
+ DefinePluginConfig,
14
+ } from '../../../lib/core-types'
15
+ import {
16
+ defineMultiValuePlugin,
17
+ } from '../../../lib/core'
18
+ import { DEFAULT_X_AXIS_PARAMS } from '../defaults'
19
+ import { LAYER_INDEX_OF_AXIS } from '../../const'
20
+ import { createBaseXAxis } from '../../base/BaseXAxis'
21
+
22
+ const pluginName = 'XAxis'
23
+
24
+
25
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_X_AXIS_PARAMS> = {
26
+ name: pluginName,
27
+ defaultParams: DEFAULT_X_AXIS_PARAMS,
28
+ layerIndex: LAYER_INDEX_OF_AXIS,
29
+ validator: (params, { validateColumns }) => {
30
+ const result = validateColumns(params, {
31
+ labelOffset: {
32
+ toBe: '[number, number]',
33
+ test: (value: any) => {
34
+ return Array.isArray(value)
35
+ && value.length === 2
36
+ && typeof value[0] === 'number'
37
+ && typeof value[1] === 'number'
38
+ }
39
+ },
40
+ labelColorType: {
41
+ toBeOption: 'ColorType',
42
+ },
43
+ axisLineVisible: {
44
+ toBeTypes: ['boolean']
45
+ },
46
+ axisLineColorType: {
47
+ toBeOption: 'ColorType',
48
+ },
49
+ ticks: {
50
+ toBeTypes: ['number', 'null']
51
+ },
52
+ tickFormat: {
53
+ toBeTypes: ['string', 'Function']
54
+ },
55
+ tickLineVisible: {
56
+ toBeTypes: ['boolean']
57
+ },
58
+ tickPadding: {
59
+ toBeTypes: ['number']
60
+ },
61
+ tickFullLine: {
62
+ toBeTypes: ['boolean']
63
+ },
64
+ tickFullLineDasharray: {
65
+ toBeTypes: ['string']
66
+ },
67
+ tickColorType: {
68
+ toBeOption: 'ColorType',
69
+ },
70
+ tickTextColorType: {
71
+ toBeOption: 'ColorType',
72
+ }
73
+ })
74
+ if (result.status === 'error') {
75
+ return result
76
+ }
77
+ return result
78
+ }
79
+ }
80
+
81
+
82
+
83
+ export const XAxis = defineMultiValuePlugin(pluginConfig)(({ selection, name, observer, subject }) => {
84
+
85
+ const destroy$ = new Subject()
86
+
87
+ const unsubscribeBaseXAxis = createBaseXAxis(pluginName, {
88
+ selection,
89
+ position$: of('bottom'),
90
+ transitionDuration$: of(100),
91
+ computedData$: observer.computedData$,
92
+ fullParams$: observer.fullParams$,
93
+ fullDataFormatter$: observer.fullDataFormatter$,
94
+ fullChartParams$: observer.fullChartParams$,
95
+ isCategorySeprate$: observer.isCategorySeprate$,
96
+ containerPosition$: observer.containerPosition$,
97
+ // layout$: observer.layout$,
98
+ containerSize$: observer.containerSize$,
99
+ xScale$: observer.xScale$,
100
+ // filteredXYMinMaxData$: observer.filteredXYMinMaxData$,
101
+ // xyMinMax$: observer.xyMinMax$,
102
+ })
103
+
104
+ return () => {
105
+ destroy$.next(undefined)
106
+ unsubscribeBaseXAxis()
107
+ }
108
+ })
@@ -446,8 +446,8 @@ export const XYAux = defineMultiValuePlugin(pluginConfig)(({ selection, rootSele
446
446
  )
447
447
  })
448
448
  ),
449
- multiValueContainerPosition$: observer.multiValueContainerPosition$,
450
- multiValueGraphicTransform$: observer.multiValueGraphicTransform$
449
+ containerPosition$: observer.containerPosition$,
450
+ graphicTransform$: observer.graphicTransform$
451
451
  })
452
452
 
453
453
  observer.layout$.pipe(
@@ -476,9 +476,9 @@ export const XYAux = defineMultiValuePlugin(pluginConfig)(({ selection, rootSele
476
476
  // console.log('r:', r)
477
477
  // })
478
478
 
479
- const columnAmount$ = observer.multiValueContainerPosition$.pipe(
480
- map(multiValueContainerPosition => {
481
- const maxColumnIndex = multiValueContainerPosition.reduce((acc, current) => {
479
+ const columnAmount$ = observer.containerPosition$.pipe(
480
+ map(containerPosition => {
481
+ const maxColumnIndex = containerPosition.reduce((acc, current) => {
482
482
  return current.columnIndex > acc ? current.columnIndex : acc
483
483
  }, 0)
484
484
  return maxColumnIndex + 1
@@ -486,9 +486,9 @@ export const XYAux = defineMultiValuePlugin(pluginConfig)(({ selection, rootSele
486
486
  distinctUntilChanged()
487
487
  )
488
488
 
489
- const rowAmount$ = observer.multiValueContainerPosition$.pipe(
490
- map(multiValueContainerPosition => {
491
- const maxRowIndex = multiValueContainerPosition.reduce((acc, current) => {
489
+ const rowAmount$ = observer.containerPosition$.pipe(
490
+ map(containerPosition => {
491
+ const maxRowIndex = containerPosition.reduce((acc, current) => {
492
492
  return current.rowIndex > acc ? current.rowIndex : acc
493
493
  }, 0)
494
494
  return maxRowIndex + 1
@@ -496,13 +496,13 @@ export const XYAux = defineMultiValuePlugin(pluginConfig)(({ selection, rootSele
496
496
  distinctUntilChanged()
497
497
  )
498
498
 
499
- const textReverseTransform$ = observer.multiValueContainerPosition$.pipe(
499
+ const textReverseTransform$ = observer.containerPosition$.pipe(
500
500
  takeUntil(destroy$),
501
501
  switchMap(async (d) => d),
502
- map(multiValueContainerPosition => {
502
+ map(containerPosition => {
503
503
  // const axesRotateXYReverseValue = `rotateX(${data.gridAxesReverseTransform.rotateX}deg) rotateY(${data.gridAxesReverseTransform.rotateY}deg)`
504
504
  // const axesRotateReverseValue = `rotate(${data.gridAxesReverseTransform.rotate}deg)`
505
- const containerScaleReverseValue = `scale(${1 / multiValueContainerPosition[0].scale[0]}, ${1 / multiValueContainerPosition[0].scale[1]})`
505
+ const containerScaleReverseValue = `scale(${1 / containerPosition[0].scale[0]}, ${1 / containerPosition[0].scale[1]})`
506
506
  // 抵消最外層scale
507
507
  return `${containerScaleReverseValue}`
508
508
  }),
@@ -512,8 +512,8 @@ export const XYAux = defineMultiValuePlugin(pluginConfig)(({ selection, rootSele
512
512
  const xyPosition$ = multiValueXYPositionObservable({
513
513
  rootSelection,
514
514
  fullDataFormatter$: observer.fullDataFormatter$,
515
- filteredMinMaxXYData$: observer.filteredMinMaxXYData$,
516
- multiValueContainerPosition$: observer.multiValueContainerPosition$,
515
+ filteredXYMinMaxData$: observer.filteredXYMinMaxData$,
516
+ containerPosition$: observer.containerPosition$,
517
517
  layout$: observer.layout$
518
518
  }).pipe(
519
519
  takeUntil(destroy$)