@orbcharts/plugins-basic 3.0.0-beta.9 → 3.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.
- package/dist/lib/plugins-basic-types.d.ts +1 -0
- package/dist/orbcharts-plugins-basic.es.js +12358 -10836
- package/dist/orbcharts-plugins-basic.umd.js +273 -110
- package/dist/{orbcharts-plugins-basic/src → src}/base/BaseBars.d.ts +3 -3
- package/dist/{orbcharts-plugins-basic/src → src}/base/BaseBarsTriangle.d.ts +3 -3
- package/dist/{orbcharts-plugins-basic/src → src}/base/BaseDots.d.ts +3 -3
- package/dist/{orbcharts-plugins-basic/src → src}/base/BaseLineAreas.d.ts +3 -3
- package/dist/{orbcharts-plugins-basic/src → src}/base/BaseLines.d.ts +3 -3
- package/dist/src/base/BaseRacingBars.d.ts +23 -0
- package/dist/src/base/BaseRacingLabels.d.ts +20 -0
- package/dist/src/base/BaseRacingValueLabels.d.ts +20 -0
- package/dist/{orbcharts-plugins-basic/src/base/BaseStackedBar.d.ts → src/base/BaseStackedBars.d.ts} +7 -7
- package/dist/{orbcharts-plugins-basic/src → src}/base/BaseValueAxis.d.ts +4 -7
- package/dist/src/base/BaseXAxis.d.ts +20 -0
- package/dist/src/base/BaseYAxis.d.ts +18 -0
- package/dist/{orbcharts-plugins-basic/src → src}/grid/defaults.d.ts +3 -3
- package/dist/{orbcharts-plugins-basic/src → src}/grid/gridObservables.d.ts +8 -1
- package/dist/{orbcharts-plugins-basic/src → src}/grid/index.d.ts +2 -2
- package/dist/src/grid/plugins/Bars.d.ts +1 -0
- package/dist/src/grid/plugins/BarsPN.d.ts +1 -0
- package/dist/src/grid/plugins/BarsTriangle.d.ts +1 -0
- package/dist/src/grid/plugins/Dots.d.ts +1 -0
- package/dist/src/grid/plugins/GridLegend.d.ts +1 -0
- package/dist/src/grid/plugins/GridTooltip.d.ts +1 -0
- package/dist/src/grid/plugins/GroupAux.d.ts +3 -0
- package/dist/src/grid/plugins/GroupAxis.d.ts +1 -0
- package/dist/src/grid/plugins/GroupZoom.d.ts +1 -0
- package/dist/src/grid/plugins/LineAreas.d.ts +1 -0
- package/dist/src/grid/plugins/Lines.d.ts +1 -0
- package/dist/src/grid/plugins/StackedBars.d.ts +1 -0
- package/dist/src/grid/plugins/StackedValueAxis.d.ts +1 -0
- package/dist/src/grid/plugins/ValueAxis.d.ts +1 -0
- package/dist/src/index.d.ts +7 -1
- package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/defaults.d.ts +2 -2
- package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/index.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiBars.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiBarsTriangle.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiDots.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiGridLegend.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiGridTooltip.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiGroupAxis.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiLineAreas.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiLines.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiStackedBars.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiStackedValueAxis.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiValueAxis.d.ts +1 -0
- package/dist/src/multiGrid/plugins/OverlappingStackedValueAxes.d.ts +1 -0
- package/dist/src/multiGrid/plugins/OverlappingValueAxes.d.ts +1 -0
- package/dist/src/multiValue/defaults.d.ts +13 -0
- package/dist/{orbcharts-plugins-basic/src → src}/multiValue/index.d.ts +5 -1
- package/dist/src/multiValue/multiValueObservables.d.ts +56 -0
- package/dist/src/multiValue/plugins/MultiValueLegend.d.ts +1 -0
- package/dist/src/multiValue/plugins/MultiValueTooltip.d.ts +1 -0
- package/dist/src/multiValue/plugins/RacingBars.d.ts +1 -0
- package/dist/src/multiValue/plugins/RacingCounterTexts.d.ts +3 -0
- package/dist/src/multiValue/plugins/RacingValueAxis.d.ts +1 -0
- package/dist/src/multiValue/plugins/Scatter.d.ts +3 -0
- package/dist/src/multiValue/plugins/ScatterBubbles.d.ts +3 -0
- package/dist/src/multiValue/plugins/XAxis.d.ts +1 -0
- package/dist/src/multiValue/plugins/XYAux.d.ts +3 -0
- package/dist/src/multiValue/plugins/XYAxes.d.ts +1 -0
- package/dist/src/multiValue/plugins/XYAxes_legacy.d.ts +3 -0
- package/dist/src/multiValue/plugins/XZoom.d.ts +1 -0
- package/dist/src/relationship/plugins/ForceDirected.d.ts +3 -0
- package/dist/src/relationship/plugins/ForceDirectedBubbles.d.ts +3 -0
- package/dist/src/relationship/plugins/RelationshipLegend.d.ts +1 -0
- package/dist/src/relationship/plugins/RelationshipTooltip.d.ts +1 -0
- package/dist/src/series/plugins/Bubbles.d.ts +3 -0
- package/dist/src/series/plugins/Pie.d.ts +3 -0
- package/dist/src/series/plugins/PieEventTexts.d.ts +3 -0
- package/dist/src/series/plugins/PieLabels.d.ts +3 -0
- package/dist/{orbcharts-plugins-basic/src → src}/series/plugins/Rose.d.ts +1 -1
- package/dist/src/series/plugins/RoseLabels.d.ts +3 -0
- package/dist/src/series/plugins/SeriesLegend.d.ts +1 -0
- package/dist/src/series/plugins/SeriesTooltip.d.ts +1 -0
- package/dist/src/tree/plugins/TreeLegend.d.ts +1 -0
- package/dist/src/tree/plugins/TreeMap.d.ts +3 -0
- package/dist/src/tree/plugins/TreeTooltip.d.ts +1 -0
- package/dist/{orbcharts-plugins-basic/src → src}/utils/commonUtils.d.ts +1 -0
- package/dist/{orbcharts-plugins-basic/src → src}/utils/d3Graphics.d.ts +2 -1
- package/dist/{orbcharts-plugins-basic/src → src}/utils/d3Utils.d.ts +1 -0
- package/lib/core.ts +1 -1
- package/lib/plugins-basic-types.ts +2 -2
- package/package.json +4 -4
- package/src/base/BaseBars.ts +15 -15
- package/src/base/BaseBarsTriangle.ts +15 -15
- package/src/base/BaseDots.ts +14 -14
- package/src/base/BaseGroupAxis.ts +18 -6
- package/src/base/BaseLineAreas.ts +12 -12
- package/src/base/BaseLines.ts +11 -11
- package/src/base/BaseRacingBars.ts +552 -0
- package/src/base/BaseRacingLabels.ts +396 -0
- package/src/base/BaseRacingValueLabels.ts +403 -0
- package/src/base/{BaseStackedBar.ts → BaseStackedBars.ts} +26 -26
- package/src/base/BaseTooltip.ts +2 -1
- package/src/base/BaseValueAxis.ts +70 -53
- package/src/base/BaseXAxis.ts +427 -0
- package/src/base/BaseYAxis.ts +389 -0
- package/src/grid/defaults.ts +44 -77
- package/src/grid/gridObservables.ts +58 -0
- package/src/grid/index.ts +2 -2
- package/src/grid/plugins/Bars.ts +2 -2
- package/src/grid/plugins/BarsPN.ts +2 -2
- package/src/grid/plugins/BarsTriangle.ts +2 -2
- package/src/grid/plugins/Dots.ts +2 -2
- package/src/grid/plugins/GridLegend.ts +7 -7
- package/src/grid/plugins/GroupAux.ts +41 -24
- package/src/grid/plugins/GroupAxis.ts +0 -24
- package/src/grid/plugins/{GridZoom.ts → GroupZoom.ts} +5 -5
- package/src/grid/plugins/LineAreas.ts +2 -2
- package/src/grid/plugins/Lines.ts +2 -2
- package/src/grid/plugins/{StackedBar.ts → StackedBars.ts} +9 -9
- package/src/multiGrid/defaults.ts +44 -24
- package/src/multiGrid/index.ts +1 -1
- package/src/multiGrid/multiGridObservables.ts +1 -0
- package/src/multiGrid/plugins/MultiBars.ts +3 -3
- package/src/multiGrid/plugins/MultiBarsTriangle.ts +3 -3
- package/src/multiGrid/plugins/MultiDots.ts +3 -3
- package/src/multiGrid/plugins/MultiGridLegend.ts +20 -10
- package/src/multiGrid/plugins/MultiLineAreas.ts +3 -3
- package/src/multiGrid/plugins/MultiLines.ts +3 -3
- package/src/multiGrid/plugins/{MultiStackedBar.ts → MultiStackedBars.ts} +10 -10
- package/src/multiGrid/plugins/OverlappingStackedValueAxes.ts +1 -0
- package/src/multiValue/defaults.ts +277 -12
- package/src/multiValue/index.ts +5 -1
- package/src/multiValue/multiValueObservables.ts +414 -44
- package/src/multiValue/plugins/OrdinalBubbles.ts +0 -0
- package/src/multiValue/plugins/OrdinalXAxis.ts +0 -0
- package/src/multiValue/plugins/RacingBars.ts +373 -0
- package/src/multiValue/plugins/RacingCounterAxis.ts +0 -0
- package/src/multiValue/plugins/RacingCounterTexts.ts +300 -0
- package/src/multiValue/plugins/RacingValueAxis.ts +115 -0
- package/src/multiValue/plugins/RankingAxis_legacy.ts +109 -0
- package/src/multiValue/plugins/Scatter.ts +13 -13
- package/src/multiValue/plugins/ScatterBubbles.ts +13 -13
- package/src/multiValue/plugins/XAxis.ts +108 -0
- package/src/multiValue/plugins/XYAux.ts +15 -14
- package/src/multiValue/plugins/XYAxes.ts +38 -528
- package/src/multiValue/plugins/XYAxes_legacy.ts +684 -0
- package/src/multiValue/plugins/{XYZoom.ts → XZoom.ts} +17 -17
- package/src/relationship/defaults.ts +42 -16
- package/src/relationship/plugins/ForceDirected.ts +26 -19
- package/src/relationship/plugins/ForceDirectedBubbles.ts +46 -25
- package/src/series/defaults.ts +51 -36
- package/src/series/plugins/Bubbles.ts +67 -37
- package/src/series/plugins/Pie.ts +5 -5
- package/src/series/plugins/PieEventTexts.ts +3 -3
- package/src/series/plugins/PieLabels.ts +5 -5
- package/src/series/plugins/Rose.ts +11 -11
- package/src/series/plugins/RoseLabels.ts +9 -9
- package/src/tree/defaults.ts +46 -22
- package/src/tree/plugins/TreeMap.ts +11 -3
- package/src/utils/commonUtils.ts +10 -1
- package/src/utils/d3Graphics.ts +4 -2
- package/src/utils/d3Utils.ts +18 -0
- package/src/utils/orbchartsUtils.ts +30 -16
- package/dist/orbcharts-plugins-basic/lib/plugins-basic-types.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/Bars.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/BarsPN.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/BarsTriangle.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/Dots.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/GridLegend.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/GridTooltip.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/GridZoom.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/GroupAux.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/grid/plugins/GroupAxis.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/LineAreas.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/Lines.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedBar.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedValueAxis.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/grid/plugins/ValueAxis.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/index.d.ts +0 -7
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiBars.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiBarsTriangle.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiDots.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiGridLegend.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiGridTooltip.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiGroupAxis.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiLineAreas.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiLines.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedBar.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedValueAxis.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiValueAxis.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/OverlappingStackedValueAxes.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiValue/defaults.d.ts +0 -9
- package/dist/orbcharts-plugins-basic/src/multiValue/multiValueObservables.d.ts +0 -33
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueLegend.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueTooltip.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/Scatter.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/ScatterBubbles.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAux.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAxes.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYZoom.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirected.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirectedBubbles.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipLegend.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipTooltip.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/series/plugins/Bubbles.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/series/plugins/Pie.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/series/plugins/PieEventTexts.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/series/plugins/PieLabels.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/series/plugins/RoseLabels.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/series/plugins/SeriesLegend.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/series/plugins/SeriesTooltip.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/tree/plugins/TreeLegend.d.ts +0 -1
- package/dist/orbcharts-plugins-basic/src/tree/plugins/TreeMap.d.ts +0 -3
- package/dist/orbcharts-plugins-basic/src/tree/plugins/TreeTooltip.d.ts +0 -1
- /package/dist/{orbcharts-plugins-basic/lib → lib}/core-types.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/lib → lib}/core.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/base/BaseGroupAxis.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/base/BaseLegend.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/base/BaseTooltip.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/base/types.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/const.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/multiGrid/multiGridObservables.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src/multiValue/plugins/Ranking.d.ts → src/multiValue/plugins/OrdinalBubbles.d.ts} +0 -0
- /package/dist/{orbcharts-plugins-basic/src/multiValue/plugins/RankingAxis.d.ts → src/multiValue/plugins/OrdinalXAxis.d.ts} +0 -0
- /package/dist/{orbcharts-plugins-basic/src/noneData/plugins/Container.d.ts → src/multiValue/plugins/RacingCounterAxis.d.ts} +0 -0
- /package/dist/{orbcharts-plugins-basic/src/noneData/plugins/Tooltip.d.ts → src/multiValue/plugins/RankingAxis_legacy.d.ts} +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/noneData/defaults.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/noneData/index.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src/series/plugins/Waffle.d.ts → src/noneData/plugins/Container.d.ts} +0 -0
- /package/{src/multiValue/plugins/Ranking.ts → dist/src/noneData/plugins/Tooltip.d.ts} +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/relationship/defaults.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/relationship/index.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/relationship/relationshipObservables.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/series/defaults.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/series/index.d.ts +0 -0
- /package/{src/multiValue/plugins/RankingAxis.ts → dist/src/series/plugins/Waffle.d.ts} +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/series/seriesObservables.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/series/seriesUtils.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/tree/defaults.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/tree/index.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/utils/observables.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/src → src}/utils/orbchartsUtils.d.ts +0 -0
- /package/dist/{orbcharts-plugins-basic/vite.config.d.ts → vite.config.d.ts} +0 -0
package/src/series/defaults.ts
CHANGED
@@ -18,26 +18,20 @@ export const DEFAULT_BUBBLES_PARAMS: BubblesParams = {
|
|
18
18
|
collisionSpacing: 2 // 泡泡間距
|
19
19
|
},
|
20
20
|
bubbleLabel: {
|
21
|
+
colorType: 'labelContrast',
|
21
22
|
fillRate: 0.6,
|
22
23
|
lineHeight: 1,
|
23
|
-
|
24
|
+
maxLineLength: 6,
|
25
|
+
wordBreakAll: true,
|
24
26
|
},
|
25
27
|
// highlightRIncrease: 0,
|
26
28
|
arcScaleType: 'area'
|
27
29
|
}
|
28
30
|
|
29
31
|
export const DEFAULT_PIE_PARAMS: PieParams = {
|
30
|
-
// padding: {
|
31
|
-
// top: 50,
|
32
|
-
// right: 70,
|
33
|
-
// bottom: 50,
|
34
|
-
// left: 70
|
35
|
-
// },
|
36
32
|
outerRadius: 0.85,
|
37
33
|
innerRadius: 0,
|
38
34
|
outerRadiusWhileHighlight: 0.9,
|
39
|
-
// label?: LabelStyle
|
40
|
-
// enterDuration: 800,
|
41
35
|
startAngle: 0,
|
42
36
|
endAngle: Math.PI * 2,
|
43
37
|
padAngle: 0,
|
@@ -45,9 +39,6 @@ export const DEFAULT_PIE_PARAMS: PieParams = {
|
|
45
39
|
strokeWidth: 1,
|
46
40
|
// padRadius: 100,
|
47
41
|
cornerRadius: 0,
|
48
|
-
// highlightTarget: 'datum',
|
49
|
-
// highlightId: null,
|
50
|
-
// highlightLabel: null,
|
51
42
|
}
|
52
43
|
|
53
44
|
export const DEFAULT_PIE_EVENT_TEXTS_PARAMS: PieEventTextsParams = {
|
@@ -117,17 +108,17 @@ export const DEFAULT_PIE_LABELS_PARAMS: PieLabelsParams = {
|
|
117
108
|
DEFAULT_PIE_LABELS_PARAMS.labelFn.toString = () => `d => String(d.label)`
|
118
109
|
|
119
110
|
export const DEFAULT_ROSE_PARAMS: RoseParams = {
|
120
|
-
outerRadius: 0.
|
111
|
+
outerRadius: 0.95,
|
121
112
|
padAngle: 0,
|
122
113
|
strokeColorType: 'background',
|
123
|
-
strokeWidth: 0,
|
114
|
+
strokeWidth: 0.5,
|
124
115
|
cornerRadius: 0,
|
125
116
|
arcScaleType: 'area',
|
126
117
|
angleIncreaseWhileHighlight: 0.05
|
127
118
|
}
|
128
119
|
|
129
120
|
export const DEFAULT_ROSE_LABELS_PARAMS: RoseLabelsParams = {
|
130
|
-
outerRadius: 0.
|
121
|
+
outerRadius: 0.95,
|
131
122
|
labelCentroid: 2.1,
|
132
123
|
labelFn: d => String(d.label),
|
133
124
|
labelColorType: 'primary',
|
@@ -161,6 +152,7 @@ export const DEFAULT_SERIES_TOOLTIP_PARAMS: SeriesTooltipParams = {
|
|
161
152
|
renderFn: (eventData, { styles, utils }) => {
|
162
153
|
const hasSeriesLabel = eventData.seriesLabel.slice(0, 7) === 'series_' ? false : true
|
163
154
|
const hasDatumLabel = eventData.datum.label.slice(0, 7) === 'series_' ? false : true
|
155
|
+
const valueText = utils.toCurrency(eventData.datum.value)
|
164
156
|
const bulletWidth = styles.textSizePx * 0.7
|
165
157
|
const offset = (styles.textSizePx / 2) - (bulletWidth / 2)
|
166
158
|
const seriesSvg = hasSeriesLabel
|
@@ -172,8 +164,19 @@ export const DEFAULT_SERIES_TOOLTIP_PARAMS: SeriesTooltipParams = {
|
|
172
164
|
const datumLabelSvg = hasDatumLabel
|
173
165
|
? `<tspan>${eventData.datum.label}</tspan> `
|
174
166
|
: ''
|
167
|
+
const seriesLabelTextWidth = hasSeriesLabel
|
168
|
+
? utils.measureTextWidth(`${eventData.seriesLabel}${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(seriesLabelTextWidth, datumLabelTextWidth)
|
174
|
+
const lineEndX = hasDatumLabel
|
175
|
+
? maxTextWidth + styles.textSizePx * 1.5
|
176
|
+
: 0
|
177
|
+
const valueTextAnchor = hasDatumLabel ? 'end' : 'start'
|
175
178
|
const datumSvg = `<text font-size="${styles.textSizePx}" dominant-baseline="hanging" fill="${styles.textColor}">
|
176
|
-
${datumLabelSvg}<tspan font-weight="bold">${
|
179
|
+
${datumLabelSvg}<tspan font-weight="bold" text-anchor="${valueTextAnchor}" x="${lineEndX}">${valueText}</tspan>
|
177
180
|
</text>`
|
178
181
|
|
179
182
|
return `${seriesSvg}
|
@@ -183,25 +186,37 @@ export const DEFAULT_SERIES_TOOLTIP_PARAMS: SeriesTooltipParams = {
|
|
183
186
|
},
|
184
187
|
}
|
185
188
|
DEFAULT_SERIES_TOOLTIP_PARAMS.renderFn.toString = () => `(eventData, { styles, utils }) => {
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
</
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
189
|
+
const hasSeriesLabel = eventData.seriesLabel.slice(0, 7) === 'series_' ? false : true
|
190
|
+
const hasDatumLabel = eventData.datum.label.slice(0, 7) === 'series_' ? false : true
|
191
|
+
const valueText = utils.toCurrency(eventData.datum.value)
|
192
|
+
const bulletWidth = styles.textSizePx * 0.7
|
193
|
+
const offset = (styles.textSizePx / 2) - (bulletWidth / 2)
|
194
|
+
const seriesSvg = hasSeriesLabel
|
195
|
+
? \`<rect width="\${bulletWidth}" height="\${bulletWidth}" x="\${offset}" y="\${offset - 1}" rx="\${bulletWidth / 2}" fill="\${eventData.datum.color}"></rect>
|
196
|
+
<text x="\${styles.textSizePx * 1.5}" font-size="\${styles.textSizePx}" dominant-baseline="hanging" fill="\${styles.textColor}">
|
197
|
+
<tspan>\${eventData.seriesLabel}</tspan>
|
198
|
+
</text>\`
|
199
|
+
: ''
|
200
|
+
const datumLabelSvg = hasDatumLabel
|
201
|
+
? \`<tspan>\${eventData.datum.label}</tspan> \`
|
202
|
+
: ''
|
203
|
+
const seriesLabelTextWidth = hasSeriesLabel
|
204
|
+
? utils.measureTextWidth(\`\${eventData.seriesLabel}\${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(seriesLabelTextWidth, datumLabelTextWidth)
|
210
|
+
const lineEndX = hasDatumLabel
|
211
|
+
? maxTextWidth + styles.textSizePx * 1.5
|
212
|
+
: 0
|
213
|
+
const valueTextAnchor = hasDatumLabel ? 'end' : 'start'
|
214
|
+
const datumSvg = \`<text font-size="\${styles.textSizePx}" dominant-baseline="hanging" fill="\${styles.textColor}">
|
215
|
+
\${datumLabelSvg}<tspan font-weight="bold" text-anchor="\${valueTextAnchor}" x="\${lineEndX}">\${valueText}</tspan>
|
216
|
+
</text>\`
|
202
217
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
218
|
+
return \`\${seriesSvg}
|
219
|
+
<g \${hasSeriesLabel ? \`transform="translate(0, \${styles.textSizePx * 2})"\` : ''}>
|
220
|
+
\${datumSvg}
|
221
|
+
</g>\`
|
207
222
|
}`
|
@@ -5,6 +5,7 @@ import {
|
|
5
5
|
switchMap,
|
6
6
|
first,
|
7
7
|
takeUntil,
|
8
|
+
debounceTime,
|
8
9
|
Subject,
|
9
10
|
Observable,
|
10
11
|
distinctUntilChanged,
|
@@ -24,6 +25,7 @@ import type { BubblesParams, ArcScaleType } from '../../../lib/plugins-basic-typ
|
|
24
25
|
import { DEFAULT_BUBBLES_PARAMS } from '../defaults'
|
25
26
|
import { renderCircleText } from '../../utils/d3Graphics'
|
26
27
|
import { LAYER_INDEX_OF_GRAPHIC } from '../../const'
|
28
|
+
import { getDatumColor } from '../../utils/orbchartsUtils'
|
27
29
|
|
28
30
|
interface BubblesDatum extends ComputedDatumSeries {
|
29
31
|
x: number
|
@@ -73,13 +75,16 @@ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_BUBBLES
|
|
73
75
|
}
|
74
76
|
if (params.bubbleLabel) {
|
75
77
|
const bubbleLabelResult = validateColumns(params.bubbleLabel, {
|
78
|
+
colorType: {
|
79
|
+
toBeOption: 'ColorType'
|
80
|
+
},
|
76
81
|
fillRate: {
|
77
82
|
toBeTypes: ['number']
|
78
83
|
},
|
79
84
|
lineHeight: {
|
80
85
|
toBeTypes: ['number']
|
81
86
|
},
|
82
|
-
|
87
|
+
maxLineLength: {
|
83
88
|
toBeTypes: ['number']
|
84
89
|
},
|
85
90
|
})
|
@@ -91,9 +96,10 @@ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_BUBBLES
|
|
91
96
|
}
|
92
97
|
}
|
93
98
|
|
94
|
-
let force: d3.Simulation<d3.SimulationNodeDatum, undefined> | undefined
|
95
99
|
|
96
|
-
|
100
|
+
// let isRunning = false
|
101
|
+
|
102
|
+
function createSimulation (bubblesSelection: d3.Selection<SVGGElement, BubblesDatum, any, any>, fullParams: BubblesParams) {
|
97
103
|
return d3.forceSimulation()
|
98
104
|
.velocityDecay(fullParams.force!.velocityDecay!)
|
99
105
|
// .alphaDecay(0.2)
|
@@ -122,7 +128,12 @@ function makeForce (bubblesSelection: d3.Selection<SVGGElement, BubblesDatum, an
|
|
122
128
|
})
|
123
129
|
// .attr("cx", (d) => d.x)
|
124
130
|
// .attr("cy", (d) => d.y)
|
131
|
+
|
132
|
+
|
125
133
|
})
|
134
|
+
// .on("end", () => {
|
135
|
+
|
136
|
+
// })
|
126
137
|
|
127
138
|
}
|
128
139
|
|
@@ -145,8 +156,8 @@ function makeForce (bubblesSelection: d3.Selection<SVGGElement, BubblesDatum, an
|
|
145
156
|
// return maxR * modifier
|
146
157
|
// }
|
147
158
|
|
148
|
-
function createBubblesData ({
|
149
|
-
|
159
|
+
function createBubblesData ({ visibleComputedSortedData, LastBubbleDataMap, graphicWidth, graphicHeight, SeriesContainerPositionMap, scaleType }: {
|
160
|
+
visibleComputedSortedData: ComputedDataSeries
|
150
161
|
LastBubbleDataMap: Map<string, BubblesDatum>
|
151
162
|
graphicWidth: number
|
152
163
|
graphicHeight: number
|
@@ -157,7 +168,7 @@ function createBubblesData ({ visibleComputedLayoutData, LastBubbleDataMap, grap
|
|
157
168
|
// 虛擬大圓(所有小圓聚合起來的大圓)的半徑
|
158
169
|
const totalR = Math.min(...[graphicWidth, graphicHeight]) / 2
|
159
170
|
|
160
|
-
const data =
|
171
|
+
const data = visibleComputedSortedData.flat()
|
161
172
|
|
162
173
|
const totalValue = data.reduce((acc, current) => acc + current.value, 0)
|
163
174
|
|
@@ -204,10 +215,11 @@ function createBubblesData ({ visibleComputedLayoutData, LastBubbleDataMap, grap
|
|
204
215
|
})
|
205
216
|
}
|
206
217
|
|
207
|
-
function renderBubbles ({ selection, bubblesData, fullParams, sumSeries }: {
|
218
|
+
function renderBubbles ({ selection, bubblesData, fullParams, fullChartParams, sumSeries }: {
|
208
219
|
selection: d3.Selection<SVGGElement, any, any, any>
|
209
220
|
bubblesData: BubblesDatum[]
|
210
221
|
fullParams: BubblesParams
|
222
|
+
fullChartParams: ChartParams
|
211
223
|
sumSeries: boolean
|
212
224
|
}) {
|
213
225
|
const bubblesSelection = selection.selectAll<SVGGElement, BubblesDatum>("g")
|
@@ -261,17 +273,24 @@ function renderBubbles ({ selection, bubblesData, fullParams, sumSeries }: {
|
|
261
273
|
bubblesSelection
|
262
274
|
.each((d,i,g) => {
|
263
275
|
const gSelection = d3.select(g[i])
|
264
|
-
|
265
|
-
|
266
|
-
breakAll = false
|
267
|
-
}
|
276
|
+
const text = d[textDataColumn] ?? ''
|
277
|
+
|
268
278
|
gSelection.call(renderCircleText, {
|
269
|
-
text
|
279
|
+
text,
|
270
280
|
radius: d.r * fullParams.bubbleLabel.fillRate,
|
271
281
|
lineHeight: baseLineHeight * fullParams.bubbleLabel.lineHeight,
|
272
|
-
isBreakAll:
|
282
|
+
isBreakAll: text.length <= fullParams.bubbleLabel.maxLineLength
|
283
|
+
? false
|
284
|
+
: fullParams.bubbleLabel.wordBreakAll
|
273
285
|
})
|
274
286
|
|
287
|
+
// -- text color --
|
288
|
+
gSelection.select('text').attr('fill', _ => getDatumColor({
|
289
|
+
datum: d,
|
290
|
+
colorType: fullParams.bubbleLabel.colorType,
|
291
|
+
fullChartParams: fullChartParams
|
292
|
+
}))
|
293
|
+
|
275
294
|
})
|
276
295
|
|
277
296
|
return bubblesSelection
|
@@ -299,18 +318,18 @@ function setHighlightData ({ data, highlightRIncrease, highlightIds }: {
|
|
299
318
|
})
|
300
319
|
}
|
301
320
|
|
302
|
-
function drag (): d3.DragBehavior<Element, unknown, unknown> {
|
321
|
+
function drag (_simulation: d3.Simulation<d3.SimulationNodeDatum, undefined>): d3.DragBehavior<Element, unknown, unknown> {
|
303
322
|
return d3.drag()
|
304
323
|
.on("start", (event, d: any) => {
|
305
324
|
if (!event.active) {
|
306
|
-
|
325
|
+
_simulation!.alpha(1).restart()
|
307
326
|
}
|
308
327
|
d.fx = d.x
|
309
328
|
d.fy = d.y
|
310
329
|
})
|
311
330
|
.on("drag", (event, d: any) => {
|
312
331
|
if (!event.active) {
|
313
|
-
|
332
|
+
_simulation!.alphaTarget(0)
|
314
333
|
}
|
315
334
|
d.fx = event.x
|
316
335
|
d.fy = event.y
|
@@ -318,6 +337,7 @@ function drag (): d3.DragBehavior<Element, unknown, unknown> {
|
|
318
337
|
.on("end", (event, d: any) => {
|
319
338
|
d.fx = null
|
320
339
|
d.fy = null
|
340
|
+
_simulation!.alpha(1).restart()
|
321
341
|
})
|
322
342
|
}
|
323
343
|
|
@@ -329,14 +349,15 @@ function drag (): d3.DragBehavior<Element, unknown, unknown> {
|
|
329
349
|
// return typeCenter ? typeCenter.x : 0
|
330
350
|
// }
|
331
351
|
|
332
|
-
function groupBubbles ({ fullParams, SeriesContainerPositionMap }: {
|
352
|
+
function groupBubbles ({ _simulation, fullParams, SeriesContainerPositionMap }: {
|
353
|
+
_simulation: d3.Simulation<d3.SimulationNodeDatum, undefined>
|
333
354
|
fullParams: BubblesParams
|
334
355
|
// graphicWidth: number
|
335
356
|
// graphicHeight: number
|
336
357
|
SeriesContainerPositionMap: Map<string, ContainerPosition>
|
337
358
|
}) {
|
338
359
|
// console.log('groupBubbles')
|
339
|
-
|
360
|
+
_simulation!
|
340
361
|
// .force('x', d3.forceX().strength(fullParams.force.strength).x(graphicWidth / 2))
|
341
362
|
// .force('y', d3.forceY().strength(fullParams.force.strength).y(graphicHeight / 2))
|
342
363
|
.force('x', d3.forceX().strength(fullParams.force.strength).x((data: BubblesSimulationDatum) => {
|
@@ -346,7 +367,7 @@ function groupBubbles ({ fullParams, SeriesContainerPositionMap }: {
|
|
346
367
|
return SeriesContainerPositionMap.get(data.seriesLabel)!.centerY
|
347
368
|
}))
|
348
369
|
|
349
|
-
force!.alpha(1).restart()
|
370
|
+
// force!.alpha(1).restart()
|
350
371
|
}
|
351
372
|
|
352
373
|
function highlight ({ bubblesSelection, highlightIds, fullChartParams }: {
|
@@ -385,6 +406,8 @@ export const Bubbles = defineSeriesPlugin(pluginConfig)(({ selection, name, obse
|
|
385
406
|
|
386
407
|
const destroy$ = new Subject()
|
387
408
|
|
409
|
+
let simulation: d3.Simulation<d3.SimulationNodeDatum, undefined> | undefined
|
410
|
+
|
388
411
|
// 紀錄前一次bubble data
|
389
412
|
let LastBubbleDataMap: Map<string, BubblesDatum> = new Map()
|
390
413
|
|
@@ -403,15 +426,15 @@ export const Bubbles = defineSeriesPlugin(pluginConfig)(({ selection, name, obse
|
|
403
426
|
const bubblesData$ = combineLatest({
|
404
427
|
layout: observer.layout$,
|
405
428
|
SeriesContainerPositionMap: observer.SeriesContainerPositionMap$,
|
406
|
-
|
429
|
+
visibleComputedSortedData: observer.visibleComputedSortedData$,
|
407
430
|
scaleType: scaleType$
|
408
431
|
}).pipe(
|
409
432
|
takeUntil(destroy$),
|
410
433
|
switchMap(async (d) => d),
|
411
434
|
map(data => {
|
412
|
-
// console.log(data.
|
435
|
+
// console.log(data.visibleComputedSortedData)
|
413
436
|
return createBubblesData({
|
414
|
-
|
437
|
+
visibleComputedSortedData: data.visibleComputedSortedData,
|
415
438
|
LastBubbleDataMap,
|
416
439
|
graphicWidth: data.layout.width,
|
417
440
|
graphicHeight: data.layout.height,
|
@@ -436,41 +459,43 @@ export const Bubbles = defineSeriesPlugin(pluginConfig)(({ selection, name, obse
|
|
436
459
|
const bubblesSelection$ = combineLatest({
|
437
460
|
bubblesData: bubblesData$,
|
438
461
|
fullParams: observer.fullParams$,
|
462
|
+
fullChartParams: observer.fullChartParams$,
|
439
463
|
SeriesContainerPositionMap: observer.SeriesContainerPositionMap$,
|
440
464
|
sumSeries: sumSeries$
|
441
465
|
}).pipe(
|
442
466
|
takeUntil(destroy$),
|
443
467
|
switchMap(async (d) => d),
|
444
468
|
map(data => {
|
445
|
-
if (
|
446
|
-
|
469
|
+
if (simulation) {
|
470
|
+
// 先停止,重新計算之後再restart
|
471
|
+
simulation.stop()
|
447
472
|
}
|
448
473
|
|
449
474
|
const bubblesSelection = renderBubbles({
|
450
475
|
selection,
|
451
476
|
bubblesData: data.bubblesData,
|
452
477
|
fullParams: data.fullParams,
|
478
|
+
fullChartParams: data.fullChartParams,
|
453
479
|
sumSeries: data.sumSeries
|
454
480
|
})
|
455
481
|
|
456
|
-
|
482
|
+
simulation = createSimulation(bubblesSelection, data.fullParams)
|
457
483
|
|
458
|
-
|
484
|
+
simulation.nodes(data.bubblesData)
|
459
485
|
|
460
486
|
groupBubbles({
|
487
|
+
_simulation: simulation,
|
461
488
|
fullParams: data.fullParams,
|
462
489
|
SeriesContainerPositionMap: data.SeriesContainerPositionMap
|
463
490
|
// graphicWidth: data.layout.width,
|
464
491
|
// graphicHeight: data.layout.height
|
465
492
|
})
|
466
493
|
|
467
|
-
|
468
|
-
// force!.alphaTarget(0)
|
469
|
-
// force!.alpha(1).restart()
|
470
|
-
// }, 2000)
|
494
|
+
simulation!.alpha(1).restart()
|
471
495
|
|
472
496
|
return bubblesSelection
|
473
|
-
})
|
497
|
+
}),
|
498
|
+
shareReplay(1)
|
474
499
|
)
|
475
500
|
|
476
501
|
combineLatest({
|
@@ -554,22 +579,22 @@ export const Bubbles = defineSeriesPlugin(pluginConfig)(({ selection, name, obse
|
|
554
579
|
data: data.computedData
|
555
580
|
})
|
556
581
|
})
|
557
|
-
.call(drag() as any)
|
582
|
+
.call(drag(simulation) as any)
|
558
583
|
|
559
584
|
|
560
585
|
})
|
561
586
|
|
562
587
|
combineLatest({
|
563
588
|
bubblesSelection: bubblesSelection$,
|
564
|
-
bubblesData: bubblesData$,
|
589
|
+
// bubblesData: bubblesData$,
|
565
590
|
highlight: observer.seriesHighlight$.pipe(
|
566
591
|
map(data => data.map(d => d.id))
|
567
592
|
),
|
568
593
|
fullChartParams: observer.fullChartParams$,
|
569
|
-
fullParams: observer.fullParams$,
|
570
|
-
sumSeries: sumSeries$,
|
571
|
-
// layout: observer.layout$,
|
572
|
-
SeriesContainerPositionMap: observer.SeriesContainerPositionMap$,
|
594
|
+
// fullParams: observer.fullParams$,
|
595
|
+
// sumSeries: sumSeries$,
|
596
|
+
// // layout: observer.layout$,
|
597
|
+
// SeriesContainerPositionMap: observer.SeriesContainerPositionMap$,
|
573
598
|
}).pipe(
|
574
599
|
takeUntil(destroy$),
|
575
600
|
switchMap(async d => d)
|
@@ -600,8 +625,13 @@ export const Bubbles = defineSeriesPlugin(pluginConfig)(({ selection, name, obse
|
|
600
625
|
// }
|
601
626
|
|
602
627
|
})
|
628
|
+
|
603
629
|
|
604
630
|
return () => {
|
605
631
|
destroy$.next(undefined)
|
632
|
+
if (simulation) {
|
633
|
+
simulation.stop()
|
634
|
+
simulation = undefined
|
635
|
+
}
|
606
636
|
}
|
607
637
|
})
|
@@ -205,7 +205,7 @@ function highlight ({ pathSelection, ids, fullChartParams, arc, arcHighlight }:
|
|
205
205
|
function createEachPie (pluginName: string, context: {
|
206
206
|
containerSelection: d3.Selection<SVGGElement, any, any, unknown>
|
207
207
|
computedData$: Observable<ComputedDatumSeries[][]>
|
208
|
-
|
208
|
+
containerVisibleComputedSortedData$: Observable<ComputedDatumSeries[]>
|
209
209
|
SeriesDataMap$: Observable<Map<string, ComputedDatumSeries[]>>
|
210
210
|
fullParams$: Observable<PieParams>
|
211
211
|
fullChartParams$: Observable<ChartParams>
|
@@ -248,7 +248,7 @@ function createEachPie (pluginName: string, context: {
|
|
248
248
|
|
249
249
|
const pieData$: Observable<PieDatum[]> = new Observable(subscriber => {
|
250
250
|
combineLatest({
|
251
|
-
|
251
|
+
containerVisibleComputedSortedData: context.containerVisibleComputedSortedData$,
|
252
252
|
fullParams: context.fullParams$,
|
253
253
|
}).pipe(
|
254
254
|
takeUntil(destroy$),
|
@@ -256,7 +256,7 @@ function createEachPie (pluginName: string, context: {
|
|
256
256
|
).subscribe(data => {
|
257
257
|
// console.log('pieData', data)
|
258
258
|
const pieData: PieDatum[] = makePieData({
|
259
|
-
data: data.
|
259
|
+
data: data.containerVisibleComputedSortedData,
|
260
260
|
startAngle: data.fullParams.startAngle,
|
261
261
|
endAngle: data.fullParams.endAngle
|
262
262
|
})
|
@@ -592,7 +592,7 @@ export const Pie = defineSeriesPlugin(pluginConfig)(({ selection, name, subject,
|
|
592
592
|
// console.log('containerIndex', containerIndex)
|
593
593
|
const containerSelection = d3.select(g[containerIndex])
|
594
594
|
|
595
|
-
const
|
595
|
+
const containerVisibleComputedSortedData$ = observer.visibleComputedSortedData$.pipe(
|
596
596
|
takeUntil(destroy$),
|
597
597
|
map(data => data[containerIndex] ?? data[0])
|
598
598
|
)
|
@@ -605,7 +605,7 @@ export const Pie = defineSeriesPlugin(pluginConfig)(({ selection, name, subject,
|
|
605
605
|
unsubscribeFnArr[containerIndex] = createEachPie(pluginName, {
|
606
606
|
containerSelection: containerSelection,
|
607
607
|
computedData$: observer.computedData$,
|
608
|
-
|
608
|
+
containerVisibleComputedSortedData$: containerVisibleComputedSortedData$,
|
609
609
|
SeriesDataMap$: observer.SeriesDataMap$,
|
610
610
|
fullParams$: observer.fullParams$,
|
611
611
|
fullChartParams$: observer.fullChartParams$,
|
@@ -105,7 +105,7 @@ function createTextData ({ eventData, renderFn, textAttrs, textStyles }: {
|
|
105
105
|
function createEachPieEventTexts (pluginName: string, context: {
|
106
106
|
containerSelection: d3.Selection<SVGGElement, any, any, unknown>
|
107
107
|
computedData$: Observable<ComputedDatumSeries[][]>
|
108
|
-
|
108
|
+
containerComputedSortedData$: Observable<ComputedDatumSeries[]>
|
109
109
|
SeriesDataMap$: Observable<Map<string, ComputedDatumSeries[]>>
|
110
110
|
fullParams$: Observable<PieEventTextsParams>
|
111
111
|
fullChartParams$: Observable<ChartParams>
|
@@ -252,7 +252,7 @@ export const PieEventTexts = defineSeriesPlugin(pluginConfig)(({ selection, name
|
|
252
252
|
|
253
253
|
const containerSelection = d3.select(g[containerIndex])
|
254
254
|
|
255
|
-
const
|
255
|
+
const containerComputedSortedData$ = observer.computedSortedData$.pipe(
|
256
256
|
takeUntil(destroy$),
|
257
257
|
map(data => data[containerIndex] ?? data[0])
|
258
258
|
)
|
@@ -265,7 +265,7 @@ export const PieEventTexts = defineSeriesPlugin(pluginConfig)(({ selection, name
|
|
265
265
|
unsubscribeFnArr[containerIndex] = createEachPieEventTexts(pluginName, {
|
266
266
|
containerSelection: containerSelection,
|
267
267
|
computedData$: observer.computedData$,
|
268
|
-
|
268
|
+
containerComputedSortedData$: containerComputedSortedData$,
|
269
269
|
SeriesDataMap$: observer.SeriesDataMap$,
|
270
270
|
fullParams$: observer.fullParams$,
|
271
271
|
fullChartParams$: observer.fullChartParams$,
|
@@ -447,7 +447,7 @@ function highlight ({ textSelection, lineSelection, ids, fullChartParams }: {
|
|
447
447
|
function createEachPieLabel (pluginName: string, context: {
|
448
448
|
containerSelection: d3.Selection<SVGGElement, any, any, unknown>
|
449
449
|
// computedData$: Observable<ComputedDatumSeries[][]>
|
450
|
-
|
450
|
+
containerVisibleComputedSortedData$: Observable<ComputedDatumSeries[]>
|
451
451
|
// SeriesDataMap$: Observable<Map<string, ComputedDatumSeries[]>>
|
452
452
|
fullParams$: Observable<PieLabelsParams>
|
453
453
|
fullChartParams$: Observable<ChartParams>
|
@@ -488,7 +488,7 @@ function createEachPieLabel (pluginName: string, context: {
|
|
488
488
|
|
489
489
|
combineLatest({
|
490
490
|
shorterSideWith: shorterSideWith$,
|
491
|
-
|
491
|
+
containerVisibleComputedSortedData: context.containerVisibleComputedSortedData$,
|
492
492
|
fullParams: context.fullParams$,
|
493
493
|
fullChartParams: context.fullChartParams$,
|
494
494
|
textSizePx: context.textSizePx$,
|
@@ -516,7 +516,7 @@ function createEachPieLabel (pluginName: string, context: {
|
|
516
516
|
})
|
517
517
|
|
518
518
|
const pieData = makePieData({
|
519
|
-
data: data.
|
519
|
+
data: data.containerVisibleComputedSortedData,
|
520
520
|
startAngle: data.fullParams.startAngle,
|
521
521
|
endAngle: data.fullParams.endAngle
|
522
522
|
})
|
@@ -608,7 +608,7 @@ export const PieLabels = defineSeriesPlugin(pluginConfig)(({ selection, observer
|
|
608
608
|
|
609
609
|
const containerSelection = d3.select(g[containerIndex])
|
610
610
|
|
611
|
-
const
|
611
|
+
const containerVisibleComputedSortedData$ = observer.visibleComputedSortedData$.pipe(
|
612
612
|
takeUntil(destroy$),
|
613
613
|
map(data => data[containerIndex] ?? data[0])
|
614
614
|
)
|
@@ -621,7 +621,7 @@ export const PieLabels = defineSeriesPlugin(pluginConfig)(({ selection, observer
|
|
621
621
|
unsubscribeFnArr[containerIndex] = createEachPieLabel(pluginName, {
|
622
622
|
containerSelection: containerSelection,
|
623
623
|
// computedData$: observer.computedData$,
|
624
|
-
|
624
|
+
containerVisibleComputedSortedData$: containerVisibleComputedSortedData$,
|
625
625
|
// SeriesDataMap$: observer.SeriesDataMap$,
|
626
626
|
fullParams$: observer.fullParams$,
|
627
627
|
fullChartParams$: observer.fullChartParams$,
|
@@ -213,8 +213,8 @@ function createEachRose (pluginName: string, context: {
|
|
213
213
|
containerSelection: d3.Selection<SVGGElement, any, any, unknown>
|
214
214
|
computedData$: Observable<ComputedDatumSeries[][]>
|
215
215
|
visibleComputedData$: Observable<ComputedDatumSeries[][]>
|
216
|
-
|
217
|
-
|
216
|
+
visibleComputedSortedData$: Observable<ComputedDatumSeries[][]>
|
217
|
+
containerVisibleComputedSortedData$: Observable<ComputedDatumSeries[]>
|
218
218
|
SeriesDataMap$: Observable<Map<string, ComputedDatumSeries[]>>
|
219
219
|
fullParams$: Observable<RoseParams>
|
220
220
|
fullChartParams$: Observable<ChartParams>
|
@@ -235,14 +235,14 @@ function createEachRose (pluginName: string, context: {
|
|
235
235
|
)
|
236
236
|
|
237
237
|
const pieData$: Observable<PieDatum[]> = combineLatest({
|
238
|
-
|
238
|
+
containerVisibleComputedSortedData: context.containerVisibleComputedSortedData$,
|
239
239
|
fullParams: context.fullParams$,
|
240
240
|
}).pipe(
|
241
241
|
takeUntil(destroy$),
|
242
242
|
switchMap(async (d) => d),
|
243
243
|
map(data => {
|
244
|
-
const eachAngle = roseEndAngle / data.
|
245
|
-
return data.
|
244
|
+
const eachAngle = roseEndAngle / data.containerVisibleComputedSortedData.length
|
245
|
+
return data.containerVisibleComputedSortedData.map((d, i) => {
|
246
246
|
return {
|
247
247
|
id: d.id,
|
248
248
|
data: d,
|
@@ -263,13 +263,13 @@ function createEachRose (pluginName: string, context: {
|
|
263
263
|
distinctUntilChanged()
|
264
264
|
)
|
265
265
|
|
266
|
-
const maxValue$ = context.
|
266
|
+
const maxValue$ = context.visibleComputedSortedData$.pipe(
|
267
267
|
map(data => Math.max(...data.flat().map(d => d.value))),
|
268
268
|
distinctUntilChanged()
|
269
269
|
)
|
270
270
|
|
271
|
-
// context.
|
272
|
-
// console.log('
|
271
|
+
// context.visibleComputedSortedData$.subscribe(data => {
|
272
|
+
// console.log('visibleComputedSortedData$', data)
|
273
273
|
// })
|
274
274
|
|
275
275
|
const tweenArc$ = combineLatest({
|
@@ -483,7 +483,7 @@ export const Rose = defineSeriesPlugin(pluginConfig)(({ selection, name, subject
|
|
483
483
|
seriesCenterSelection.each((d, containerIndex, g) => {
|
484
484
|
const containerSelection = d3.select(g[containerIndex])
|
485
485
|
|
486
|
-
const
|
486
|
+
const containerVisibleComputedSortedData$ = observer.visibleComputedSortedData$.pipe(
|
487
487
|
takeUntil(destroy$),
|
488
488
|
map(data => JSON.parse(JSON.stringify(data[containerIndex] ?? data[0])))
|
489
489
|
)
|
@@ -497,8 +497,8 @@ export const Rose = defineSeriesPlugin(pluginConfig)(({ selection, name, subject
|
|
497
497
|
containerSelection: containerSelection,
|
498
498
|
computedData$: observer.computedData$,
|
499
499
|
visibleComputedData$: observer.visibleComputedData$,
|
500
|
-
|
501
|
-
|
500
|
+
visibleComputedSortedData$: observer.visibleComputedSortedData$,
|
501
|
+
containerVisibleComputedSortedData$: containerVisibleComputedSortedData$,
|
502
502
|
SeriesDataMap$: observer.SeriesDataMap$,
|
503
503
|
fullParams$: observer.fullParams$,
|
504
504
|
fullChartParams$: observer.fullChartParams$,
|