@orbcharts/plugins-basic 3.0.0-beta.1 → 3.0.0-beta.11
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/{src → orbcharts-plugins-basic/src}/base/BaseBars.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarsTriangle.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseDots.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseGroupAxis.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLegend.d.ts +1 -1
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLineAreas.d.ts +3 -3
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLines.d.ts +3 -3
- package/dist/{src/base/BaseBarStack.d.ts → orbcharts-plugins-basic/src/base/BaseStackedBar.d.ts} +6 -6
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseValueAxis.d.ts +3 -2
- package/dist/{src → orbcharts-plugins-basic/src}/grid/defaults.d.ts +4 -4
- package/dist/{src → orbcharts-plugins-basic/src}/grid/gridObservables.d.ts +5 -5
- package/dist/{src → orbcharts-plugins-basic/src}/grid/index.d.ts +2 -2
- package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedBar.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedValueAxis.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/index.d.ts +7 -0
- package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/defaults.d.ts +4 -4
- package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/index.d.ts +3 -3
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedBar.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedValueAxis.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/OverlappingStackedValueAxes.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/defaults.d.ts +9 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/index.d.ts +8 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/multiValueObservables.d.ts +33 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueLegend.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueTooltip.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/Scatter.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/ScatterBubbles.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAux.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAxes.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYZoom.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/relationship/defaults.d.ts +6 -0
- package/dist/orbcharts-plugins-basic/src/relationship/index.d.ts +5 -0
- package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirected.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirectedBubbles.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipLegend.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipTooltip.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/relationship/relationshipObservables.d.ts +1 -0
- package/dist/{src → orbcharts-plugins-basic/src}/series/seriesObservables.d.ts +3 -3
- package/dist/{src → orbcharts-plugins-basic/src}/utils/commonUtils.d.ts +1 -1
- package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Utils.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/utils/observables.d.ts +1 -1
- package/dist/{src → orbcharts-plugins-basic/src}/utils/orbchartsUtils.d.ts +3 -3
- package/dist/orbcharts-plugins-basic.es.js +13327 -10361
- package/dist/orbcharts-plugins-basic.umd.js +99 -49
- package/dist/src/index.d.ts +1 -5
- package/package.json +4 -4
- package/src/base/BaseBars.ts +5 -5
- package/src/base/BaseBarsTriangle.ts +6 -4
- package/src/base/BaseDots.ts +3 -54
- package/src/base/BaseGroupAxis.ts +50 -50
- package/src/base/BaseLegend.ts +25 -21
- package/src/base/BaseLineAreas.ts +4 -4
- package/src/base/BaseLines.ts +3 -3
- package/src/base/{BaseBarStack.ts → BaseStackedBar.ts} +22 -20
- package/src/base/BaseTooltip.ts +5 -2
- package/src/base/BaseValueAxis.ts +84 -81
- package/src/grid/defaults.ts +15 -13
- package/src/grid/gridObservables.ts +56 -47
- package/src/grid/index.ts +2 -2
- package/src/grid/plugins/GridLegend.ts +2 -2
- package/src/grid/plugins/GridZoom.ts +20 -20
- package/src/grid/plugins/GroupAux.ts +216 -211
- package/src/grid/plugins/{BarStack.ts → StackedBar.ts} +7 -7
- package/src/grid/plugins/{ValueStackAxis.ts → StackedValueAxis.ts} +6 -5
- package/src/grid/plugins/ValueAxis.ts +1 -0
- package/src/index.ts +2 -5
- package/src/multiGrid/defaults.ts +11 -11
- package/src/multiGrid/index.ts +3 -3
- package/src/multiGrid/plugins/MultiBars.ts +1 -1
- package/src/multiGrid/plugins/MultiBarsTriangle.ts +1 -1
- package/src/multiGrid/plugins/MultiGridLegend.ts +2 -2
- package/src/multiGrid/plugins/MultiGroupAxis.ts +1 -1
- package/src/multiGrid/plugins/{MultiBarStack.ts → MultiStackedBar.ts} +8 -8
- package/src/multiGrid/plugins/{MultiValueStackAxis.ts → MultiStackedValueAxis.ts} +4 -3
- package/src/multiGrid/plugins/MultiValueAxis.ts +2 -1
- package/src/multiGrid/plugins/{OverlappingValueStackAxes.ts → OverlappingStackedValueAxes.ts} +9 -8
- package/src/multiGrid/plugins/OverlappingValueAxes.ts +4 -3
- package/src/multiValue/defaults.ts +167 -0
- package/src/multiValue/index.ts +9 -0
- package/src/multiValue/multiValueObservables.ts +297 -0
- package/src/multiValue/plugins/MultiValueLegend.ts +107 -0
- package/src/multiValue/plugins/MultiValueTooltip.ts +66 -0
- package/src/multiValue/plugins/Scatter.ts +426 -0
- package/src/multiValue/plugins/ScatterBubbles.ts +554 -0
- package/src/multiValue/plugins/XYAux.ts +682 -0
- package/src/multiValue/plugins/XYAxes.ts +685 -0
- package/src/multiValue/plugins/XYZoom.ts +300 -0
- package/src/noneData/plugins/Container.ts +23 -23
- package/src/noneData/plugins/Tooltip.ts +365 -365
- package/src/relationship/defaults.ts +197 -0
- package/src/relationship/index.ts +5 -0
- package/src/relationship/plugins/ForceDirected.ts +1169 -0
- package/src/relationship/plugins/ForceDirectedBubbles.ts +1394 -0
- package/src/relationship/plugins/RelationshipLegend.ts +100 -0
- package/src/relationship/plugins/RelationshipTooltip.ts +66 -0
- package/src/relationship/relationshipObservables.ts +50 -0
- package/src/series/defaults.ts +13 -12
- package/src/series/plugins/Bubbles.ts +22 -22
- package/src/series/plugins/Pie.ts +2 -2
- package/src/series/plugins/PieEventTexts.ts +22 -21
- package/src/series/plugins/PieLabels.ts +2 -2
- package/src/series/plugins/Rose.ts +2 -2
- package/src/series/plugins/RoseLabels.ts +2 -2
- package/src/series/plugins/SeriesLegend.ts +4 -4
- package/src/series/seriesObservables.ts +3 -3
- package/src/tree/defaults.ts +3 -3
- package/src/tree/plugins/TreeLegend.ts +3 -10
- package/src/utils/commonUtils.ts +5 -5
- package/src/utils/d3Utils.ts +4 -3
- package/src/utils/observables.ts +2 -2
- package/src/utils/orbchartsUtils.ts +28 -12
- package/dist/src/grid/plugins/BarStack.d.ts +0 -1
- package/dist/src/grid/plugins/ValueStackAxis.d.ts +0 -1
- package/dist/src/multiGrid/plugins/MultiBarStack.d.ts +0 -1
- package/dist/src/multiGrid/plugins/MultiValueStackAxis.d.ts +0 -1
- package/dist/src/multiGrid/plugins/OverlappingValueStackAxes.d.ts +0 -1
- package/dist/src/multiValue/plugins/Scatter.d.ts +0 -0
- package/dist/src/multiValue/plugins/ScatterAxes.d.ts +0 -0
- package/dist/src/noneData/plugins/Container.d.ts +0 -1
- package/dist/src/noneData/plugins/Tooltip.d.ts +0 -3
- package/dist/src/relationship/index.d.ts +0 -0
- package/dist/src/relationship/plugins/Relationship.d.ts +0 -0
- package/src/base/BaseGroupArea.ts +0 -0
- package/src/multiValue/plugins/ScatterAxes.ts +0 -0
- package/src/relationship/plugins/Relationship.ts +0 -0
- /package/dist/{lib → orbcharts-plugins-basic/lib}/core-types.d.ts +0 -0
- /package/dist/{lib → orbcharts-plugins-basic/lib}/core.d.ts +0 -0
- /package/dist/{lib → orbcharts-plugins-basic/lib}/plugins-basic-types.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/base/BaseTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/base/types.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/const.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Bars.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsPN.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsTriangle.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Dots.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridLegend.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridZoom.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAux.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/LineAreas.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Lines.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/multiGridObservables.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBars.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarsTriangle.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiDots.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridLegend.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGroupAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLineAreas.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLines.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiValueAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -0
- /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/Ranking.d.ts +0 -0
- /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/RankingAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/noneData/defaults.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/noneData/index.d.ts +0 -0
- /package/dist/{src/base/BaseGroupArea.d.ts → orbcharts-plugins-basic/src/noneData/plugins/Container.d.ts} +0 -0
- /package/dist/{src/multiValue/index.d.ts → orbcharts-plugins-basic/src/noneData/plugins/Tooltip.d.ts} +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/defaults.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/index.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Bubbles.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Pie.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieEventTexts.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieLabels.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Rose.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/RoseLabels.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesLegend.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Waffle.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/seriesUtils.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/defaults.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/index.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeLegend.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeMap.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Graphics.d.ts +0 -0
- /package/dist/{vite.config.d.ts → orbcharts-plugins-basic/vite.config.d.ts} +0 -0
- /package/src/{grid → multiValue}/plugins/Ranking.ts +0 -0
- /package/src/{grid → multiValue}/plugins/RankingAxis.ts +0 -0
package/dist/src/index.d.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orbcharts/plugins-basic",
|
3
|
-
"version": "3.0.0-beta.
|
3
|
+
"version": "3.0.0-beta.11",
|
4
4
|
"description": "plugins for OrbCharts",
|
5
5
|
"author": "Blue Planet Inc.",
|
6
6
|
"license": "Apache-2.0",
|
@@ -35,9 +35,9 @@
|
|
35
35
|
"vite-plugin-dts": "^3.7.3"
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
|
-
"@orbcharts/core": "^3.0.0-beta.
|
39
|
-
"@orbcharts/core-types": "^3.0.0-beta.
|
40
|
-
"@orbcharts/plugins-basic-types": "^3.0.0-beta.
|
38
|
+
"@orbcharts/core": "^3.0.0-beta.7",
|
39
|
+
"@orbcharts/core-types": "^3.0.0-beta.5",
|
40
|
+
"@orbcharts/plugins-basic-types": "^3.0.0-beta.10",
|
41
41
|
"d3": "^7.8.5",
|
42
42
|
"rxjs": "^7.8.1"
|
43
43
|
}
|
package/src/base/BaseBars.ts
CHANGED
@@ -14,7 +14,7 @@ import type {
|
|
14
14
|
ComputedDataGrid,
|
15
15
|
ComputedLayoutDataGrid,
|
16
16
|
DataFormatterTypeMap,
|
17
|
-
|
17
|
+
ContainerPositionScaled,
|
18
18
|
EventGrid,
|
19
19
|
ChartParams,
|
20
20
|
Layout,
|
@@ -51,7 +51,7 @@ interface BaseBarsContext {
|
|
51
51
|
height: number;
|
52
52
|
}>
|
53
53
|
gridHighlight$: Observable<ComputedDatumGrid[]>
|
54
|
-
gridContainerPosition$: Observable<
|
54
|
+
gridContainerPosition$: Observable<ContainerPositionScaled[]>
|
55
55
|
isSeriesSeprate$: Observable<boolean>
|
56
56
|
event$: Subject<EventGrid>
|
57
57
|
}
|
@@ -92,7 +92,7 @@ function calcBarWidth ({ axisWidth, groupAmount, barAmountOfGroup, barPadding =
|
|
92
92
|
barPadding: number
|
93
93
|
barGroupPadding: number
|
94
94
|
}) {
|
95
|
-
const eachGroupWidth = groupAmount > 1
|
95
|
+
const eachGroupWidth = groupAmount > 1 // 等於 1 時會算出 Infinity
|
96
96
|
? axisWidth / (groupAmount - 1) // -1是因為要扣掉兩側的padding
|
97
97
|
: axisWidth
|
98
98
|
const width = (eachGroupWidth - barGroupPadding) / barAmountOfGroup - barPadding
|
@@ -140,7 +140,7 @@ function renderRectBars ({ graphicGSelection, rectClassName, visibleComputedLayo
|
|
140
140
|
.append('rect')
|
141
141
|
.classed(rectClassName, true)
|
142
142
|
.attr('cursor', 'pointer')
|
143
|
-
.attr('height', d =>
|
143
|
+
.attr('height', d => 1)
|
144
144
|
},
|
145
145
|
update => update,
|
146
146
|
exit => exit.remove()
|
@@ -156,7 +156,7 @@ function renderRectBars ({ graphicGSelection, rectClassName, visibleComputedLayo
|
|
156
156
|
.duration(transitionItem)
|
157
157
|
.ease(getD3TransitionEase(chartParams.transitionEase))
|
158
158
|
.delay((d, i) => d.groupIndex * delayGroup)
|
159
|
-
.attr('height', d => Math.abs(d.axisYFromZero))
|
159
|
+
.attr('height', d => Math.abs(d.axisYFromZero) || 1) // 無值還是給一個 1 的高度
|
160
160
|
})
|
161
161
|
|
162
162
|
|
@@ -17,7 +17,7 @@ import type {
|
|
17
17
|
DataFormatterTypeMap,
|
18
18
|
EventGrid,
|
19
19
|
ChartParams,
|
20
|
-
|
20
|
+
ContainerPositionScaled,
|
21
21
|
Layout,
|
22
22
|
TransformData
|
23
23
|
} from '../../lib/core-types'
|
@@ -52,7 +52,7 @@ interface BaseBarsContext {
|
|
52
52
|
height: number;
|
53
53
|
}>
|
54
54
|
gridHighlight$: Observable<ComputedDatumGrid[]>
|
55
|
-
gridContainerPosition$: Observable<
|
55
|
+
gridContainerPosition$: Observable<ContainerPositionScaled[]>
|
56
56
|
isSeriesSeprate$: Observable<boolean>
|
57
57
|
event$: Subject<EventGrid>
|
58
58
|
}
|
@@ -100,7 +100,9 @@ function calcBarWidth ({ axisWidth, groupAmount, barAmountOfGroup, barPadding =
|
|
100
100
|
barPadding: number
|
101
101
|
barGroupPadding: number
|
102
102
|
}) {
|
103
|
-
const eachGroupWidth =
|
103
|
+
const eachGroupWidth = groupAmount > 1 // 等於 1 時會算出 Infinity
|
104
|
+
? axisWidth / (groupAmount - 1)
|
105
|
+
: axisWidth
|
104
106
|
const width = (eachGroupWidth - barGroupPadding) / barAmountOfGroup - barPadding
|
105
107
|
return width > 1 ? width : 1
|
106
108
|
}
|
@@ -164,7 +166,7 @@ function renderTriangleBars ({ graphicGSelection, pathGClassName, pathClassName,
|
|
164
166
|
|
165
167
|
// path
|
166
168
|
gSelection.select(`path.${pathClassName}`)
|
167
|
-
.attr('height', d => Math.abs(d.axisYFromZero))
|
169
|
+
.attr('height', d => Math.abs(d.axisYFromZero) || 1) // 無值還是給一個 1 的高度
|
168
170
|
.attr('y', d => d.axisY < zeroYArr[seriesIndex] ? d.axisY : zeroYArr[seriesIndex])
|
169
171
|
.attr('x', d => isSeriesSeprate ? 0 : barScale(d.seriesLabel)!)
|
170
172
|
// .style('fill', d => `url(#${d.linearGradientId})`)
|
package/src/base/BaseDots.ts
CHANGED
@@ -14,7 +14,7 @@ import type {
|
|
14
14
|
ComputedLayoutDataGrid,
|
15
15
|
EventGrid,
|
16
16
|
ChartParams,
|
17
|
-
|
17
|
+
ContainerPositionScaled,
|
18
18
|
Layout,
|
19
19
|
TransformData,
|
20
20
|
ColorType
|
@@ -51,7 +51,7 @@ interface BaseDotsContext {
|
|
51
51
|
height: number;
|
52
52
|
}>
|
53
53
|
gridHighlight$: Observable<ComputedDatumGrid[]>
|
54
|
-
gridContainerPosition$: Observable<
|
54
|
+
gridContainerPosition$: Observable<ContainerPositionScaled[]>
|
55
55
|
event$: Subject<EventGrid>
|
56
56
|
}
|
57
57
|
|
@@ -138,57 +138,6 @@ function renderDots ({ graphicGSelection, circleGClassName, circleClassName, vis
|
|
138
138
|
.attr('transform', `scale(${graphicReverseScale[seriesIndex][0] ?? 1}, ${graphicReverseScale[seriesIndex][1] ?? 1})`)
|
139
139
|
})
|
140
140
|
})
|
141
|
-
|
142
|
-
// const dots = graphicGSelection
|
143
|
-
// .selectAll<SVGGElement, ComputedDatumGrid>('g')
|
144
|
-
// .data(data, d => d.id)
|
145
|
-
// .join(
|
146
|
-
// enter => {
|
147
|
-
// // enterDuration
|
148
|
-
// enterDuration = createEnterDuration(enter)
|
149
|
-
|
150
|
-
// return enter
|
151
|
-
// .append('g')
|
152
|
-
// .classed(circleGClassName, true)
|
153
|
-
// },
|
154
|
-
// update => update,
|
155
|
-
// exit => exit.remove()
|
156
|
-
// )
|
157
|
-
// .attr('transform', d => `translate(${d.axisX}, ${d.axisY})`)
|
158
|
-
// .each((d, i, g) => {
|
159
|
-
// const circle = d3.select(g[i])
|
160
|
-
// .selectAll('circle')
|
161
|
-
// .data([d])
|
162
|
-
// .join(
|
163
|
-
// enter => {
|
164
|
-
// return enter
|
165
|
-
// .append('circle')
|
166
|
-
// .style('cursor', 'pointer')
|
167
|
-
// .style('vector-effect', 'non-scaling-stroke')
|
168
|
-
// .classed(circleClassName, true)
|
169
|
-
// .attr('opacity', 0)
|
170
|
-
// .transition()
|
171
|
-
// .delay((_d, _i) => {
|
172
|
-
// return i * enterDuration
|
173
|
-
// })
|
174
|
-
// .attr('opacity', 1)
|
175
|
-
// },
|
176
|
-
// update => {
|
177
|
-
// return update
|
178
|
-
// .transition()
|
179
|
-
// .duration(50)
|
180
|
-
// // .attr('cx', d => d.axisX)
|
181
|
-
// // .attr('cy', d => d.axisY)
|
182
|
-
// .attr('opacity', 1)
|
183
|
-
// },
|
184
|
-
// exit => exit.remove()
|
185
|
-
// )
|
186
|
-
// .attr('r', fullParams.radius)
|
187
|
-
// .attr('fill', (d, i) => getDatumColor({ datum: d, colorType: fullParams.fillColorType, fullChartParams }))
|
188
|
-
// .attr('stroke', (d, i) => getDatumColor({ datum: d, colorType: fullParams.strokeColorType, fullChartParams }))
|
189
|
-
// .attr('stroke-width', fullParams.strokeWidth)
|
190
|
-
// .attr('transform', `scale(${graphicReverseScale[0]}, ${graphicReverseScale[1]})`)
|
191
|
-
// })
|
192
141
|
|
193
142
|
const graphicCircleSelection: d3.Selection<SVGRectElement, ComputedDatumGrid, SVGGElement, unknown> = graphicGSelection.selectAll(`circle.${circleClassName}`)
|
194
143
|
|
@@ -391,7 +340,7 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
|
|
391
340
|
takeUntil(destroy$),
|
392
341
|
switchMap(async (d) => d),
|
393
342
|
).subscribe(data => {
|
394
|
-
|
343
|
+
|
395
344
|
data.graphicSelection
|
396
345
|
.on('mouseover', (event, datum) => {
|
397
346
|
// event.stopPropagation()
|
@@ -13,7 +13,7 @@ import {
|
|
13
13
|
import type {
|
14
14
|
ColorType,
|
15
15
|
ComputedDataGrid,
|
16
|
-
|
16
|
+
ContainerPositionScaled,
|
17
17
|
ComputedDatumGrid,
|
18
18
|
DataFormatterGrid,
|
19
19
|
ChartParams,
|
@@ -57,7 +57,7 @@ interface BaseGroupAxisContext {
|
|
57
57
|
width: number;
|
58
58
|
height: number;
|
59
59
|
}>
|
60
|
-
gridContainerPosition$: Observable<
|
60
|
+
gridContainerPosition$: Observable<ContainerPositionScaled[]>
|
61
61
|
isSeriesSeprate$: Observable<boolean>
|
62
62
|
textSizePx$: Observable<number>
|
63
63
|
}
|
@@ -79,7 +79,7 @@ interface GroupLabelData {
|
|
79
79
|
// const groupingLabelClassName = getClassName(pluginName, 'groupingLabel')
|
80
80
|
const defaultTickSize = 6
|
81
81
|
|
82
|
-
function createGroupLabelData (groupLabels: string[], tickFormat: string | ((text: any) => string)): GroupLabelData[] {
|
82
|
+
function createGroupLabelData (groupLabels: string[], tickFormat: string | ((text: any) => string | d3.NumberValue)): GroupLabelData[] {
|
83
83
|
return groupLabels.map((_text, i) => {
|
84
84
|
const text = parseTickFormatValue(_text, tickFormat)
|
85
85
|
const textArr = typeof text === 'string' ? text.split('\n') : [text]
|
@@ -106,32 +106,32 @@ function renderAxisLabel ({ selection, groupingLabelClassName, fullParams, axisL
|
|
106
106
|
const offsetY = fullParams.tickPadding + fullParams.labelOffset[1]
|
107
107
|
let labelX = 0
|
108
108
|
let labelY = 0
|
109
|
-
if (fullDataFormatter.
|
109
|
+
if (fullDataFormatter.groupAxis.position === 'bottom') {
|
110
110
|
labelY = offsetY
|
111
|
-
if (fullDataFormatter.
|
111
|
+
if (fullDataFormatter.valueAxis.position === 'left') {
|
112
112
|
labelX = offsetX
|
113
|
-
} else if (fullDataFormatter.
|
113
|
+
} else if (fullDataFormatter.valueAxis.position === 'right') {
|
114
114
|
labelX = - offsetX
|
115
115
|
}
|
116
|
-
} else if (fullDataFormatter.
|
116
|
+
} else if (fullDataFormatter.groupAxis.position === 'top') {
|
117
117
|
labelY = - offsetY
|
118
|
-
if (fullDataFormatter.
|
118
|
+
if (fullDataFormatter.valueAxis.position === 'left') {
|
119
119
|
labelX = offsetX
|
120
|
-
} else if (fullDataFormatter.
|
120
|
+
} else if (fullDataFormatter.valueAxis.position === 'right') {
|
121
121
|
labelX = - offsetX
|
122
122
|
}
|
123
|
-
} else if (fullDataFormatter.
|
123
|
+
} else if (fullDataFormatter.groupAxis.position === 'left') {
|
124
124
|
labelX = - offsetX
|
125
|
-
if (fullDataFormatter.
|
125
|
+
if (fullDataFormatter.valueAxis.position === 'bottom') {
|
126
126
|
labelY = - offsetY
|
127
|
-
} else if (fullDataFormatter.
|
127
|
+
} else if (fullDataFormatter.valueAxis.position === 'top') {
|
128
128
|
labelY = offsetY
|
129
129
|
}
|
130
|
-
} else if (fullDataFormatter.
|
130
|
+
} else if (fullDataFormatter.groupAxis.position === 'right') {
|
131
131
|
labelX = offsetX
|
132
|
-
if (fullDataFormatter.
|
132
|
+
if (fullDataFormatter.valueAxis.position === 'bottom') {
|
133
133
|
labelY = - offsetY
|
134
|
-
} else if (fullDataFormatter.
|
134
|
+
} else if (fullDataFormatter.valueAxis.position === 'top') {
|
135
135
|
labelY = offsetY
|
136
136
|
}
|
137
137
|
}
|
@@ -162,7 +162,7 @@ function renderAxisLabel ({ selection, groupingLabelClassName, fullParams, axisL
|
|
162
162
|
// 偏移使用 x, y 而非 transform 才不會受到外層 scale 變形影響
|
163
163
|
.attr('x', labelX)
|
164
164
|
.attr('y', labelY)
|
165
|
-
.text(d => fullDataFormatter.
|
165
|
+
.text(d => fullDataFormatter.groupAxis.label)
|
166
166
|
})
|
167
167
|
.attr('transform', d => `translate(${gridAxesSize.width}, 0)`)
|
168
168
|
// .attr('transform', d => `translate(${gridAxesSize.width + d.tickPadding + fullParams.labelOffset[0]}, ${- d.tickPadding - fullParams.labelOffset[1]})`)
|
@@ -197,16 +197,16 @@ function renderAxis ({ selection, xAxisClassName, fullParams, tickTextAlign, gri
|
|
197
197
|
// 刻度文字偏移
|
198
198
|
let tickPadding = 0
|
199
199
|
let textX = 0
|
200
|
-
if (fullDataFormatter.
|
200
|
+
if (fullDataFormatter.groupAxis.position === 'left') {
|
201
201
|
tickPadding = 0
|
202
202
|
textX = - fullParams.tickPadding
|
203
|
-
} else if (fullDataFormatter.
|
203
|
+
} else if (fullDataFormatter.groupAxis.position === 'right') {
|
204
204
|
tickPadding = 0
|
205
205
|
textX = fullParams.tickPadding
|
206
|
-
} else if (fullDataFormatter.
|
206
|
+
} else if (fullDataFormatter.groupAxis.position === 'bottom') {
|
207
207
|
tickPadding = fullParams.tickPadding
|
208
208
|
textX = 0
|
209
|
-
} else if (fullDataFormatter.
|
209
|
+
} else if (fullDataFormatter.groupAxis.position === 'top') {
|
210
210
|
tickPadding = - fullParams.tickPadding
|
211
211
|
textX = - 0
|
212
212
|
}
|
@@ -248,7 +248,7 @@ function renderAxis ({ selection, xAxisClassName, fullParams, tickTextAlign, gri
|
|
248
248
|
renderTspansOnAxis(d3.select(n[i]), {
|
249
249
|
textArr,
|
250
250
|
textSizePx,
|
251
|
-
groupAxisPosition: fullDataFormatter.
|
251
|
+
groupAxisPosition: fullDataFormatter.groupAxis.position
|
252
252
|
})
|
253
253
|
})
|
254
254
|
})
|
@@ -275,7 +275,7 @@ function renderAxis ({ selection, xAxisClassName, fullParams, tickTextAlign, gri
|
|
275
275
|
.style('transform', textReverseTransformWithRotate)
|
276
276
|
|
277
277
|
// 抵消掉預設的偏移
|
278
|
-
// if (fullDataFormatter.
|
278
|
+
// if (fullDataFormatter.groupAxis.position === 'left' || fullDataFormatter.groupAxis.position === 'right') {
|
279
279
|
xText.attr('dy', 0)
|
280
280
|
// }
|
281
281
|
|
@@ -386,7 +386,7 @@ export const createBaseGroupAxis: BasePluginFn<BaseGroupAxisContext> = ((pluginN
|
|
386
386
|
// const tickTextFormatter$ = fullDataFormatter$
|
387
387
|
// .pipe(
|
388
388
|
// map(d => {
|
389
|
-
// return d.
|
389
|
+
// return d.seriesDirection === 'row' ? d.columnLabelFormat : d.rowLabelFormat
|
390
390
|
// })
|
391
391
|
// )
|
392
392
|
|
@@ -472,12 +472,12 @@ export const createBaseGroupAxis: BasePluginFn<BaseGroupAxisContext> = ((pluginN
|
|
472
472
|
// ).subscribe(data => {
|
473
473
|
// const groupMin = 0
|
474
474
|
// const groupMax = data.computedData[0] ? data.computedData[0].length - 1 : 0
|
475
|
-
// const groupScaleDomainMin = data.fullDataFormatter.
|
476
|
-
// ? groupMin - data.fullDataFormatter.
|
477
|
-
// : data.fullDataFormatter.
|
478
|
-
// const groupScaleDomainMax = data.fullDataFormatter.
|
479
|
-
// ? groupMax + data.fullDataFormatter.
|
480
|
-
// : data.fullDataFormatter.
|
475
|
+
// const groupScaleDomainMin = data.fullDataFormatter.groupAxis.scaleDomain[0] === 'auto'
|
476
|
+
// ? groupMin - data.fullDataFormatter.groupAxis.scalePadding
|
477
|
+
// : data.fullDataFormatter.groupAxis.scaleDomain[0] as number - data.fullDataFormatter.groupAxis.scalePadding
|
478
|
+
// const groupScaleDomainMax = data.fullDataFormatter.groupAxis.scaleDomain[1] === 'auto'
|
479
|
+
// ? groupMax + data.fullDataFormatter.groupAxis.scalePadding
|
480
|
+
// : data.fullDataFormatter.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.groupAxis.scalePadding
|
481
481
|
|
482
482
|
// const groupingLength = data.computedData[0]
|
483
483
|
// ? data.computedData[0].length
|
@@ -496,9 +496,9 @@ export const createBaseGroupAxis: BasePluginFn<BaseGroupAxisContext> = ((pluginN
|
|
496
496
|
// })
|
497
497
|
|
498
498
|
|
499
|
-
// const padding = data.fullDataFormatter.
|
499
|
+
// const padding = data.fullDataFormatter.groupAxis.scalePadding
|
500
500
|
|
501
|
-
// const groupScale =
|
501
|
+
// const groupScale = createLabelToAxisScale({
|
502
502
|
// axisLabels,
|
503
503
|
// axisWidth: data.gridAxesSize.width,
|
504
504
|
// padding
|
@@ -518,13 +518,13 @@ export const createBaseGroupAxis: BasePluginFn<BaseGroupAxisContext> = ((pluginN
|
|
518
518
|
map(data => {
|
519
519
|
const groupMin = 0
|
520
520
|
const groupMax = data.computedData[0] ? data.computedData[0].length - 1 : 0
|
521
|
-
// const groupScaleDomainMin = data.fullDataFormatter.
|
522
|
-
// ? groupMin - data.fullDataFormatter.
|
523
|
-
// : data.fullDataFormatter.
|
524
|
-
const groupScaleDomainMin = data.fullDataFormatter.
|
525
|
-
const groupScaleDomainMax = data.fullDataFormatter.
|
526
|
-
? groupMax + data.fullDataFormatter.
|
527
|
-
: data.fullDataFormatter.
|
521
|
+
// const groupScaleDomainMin = data.fullDataFormatter.groupAxis.scaleDomain[0] === 'auto'
|
522
|
+
// ? groupMin - data.fullDataFormatter.groupAxis.scalePadding
|
523
|
+
// : data.fullDataFormatter.groupAxis.scaleDomain[0] as number - data.fullDataFormatter.groupAxis.scalePadding
|
524
|
+
const groupScaleDomainMin = data.fullDataFormatter.groupAxis.scaleDomain[0] - data.fullDataFormatter.groupAxis.scalePadding
|
525
|
+
const groupScaleDomainMax = data.fullDataFormatter.groupAxis.scaleDomain[1] === 'max'
|
526
|
+
? groupMax + data.fullDataFormatter.groupAxis.scalePadding
|
527
|
+
: data.fullDataFormatter.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.groupAxis.scalePadding
|
528
528
|
|
529
529
|
return [groupScaleDomainMin, groupScaleDomainMax]
|
530
530
|
}),
|
@@ -559,20 +559,20 @@ export const createBaseGroupAxis: BasePluginFn<BaseGroupAxisContext> = ((pluginN
|
|
559
559
|
let textAnchor: 'start' | 'middle' | 'end' = 'middle'
|
560
560
|
let dominantBaseline: 'auto' | 'middle' | 'hanging' = 'hanging'
|
561
561
|
|
562
|
-
if (data.fullDataFormatter.
|
562
|
+
if (data.fullDataFormatter.groupAxis.position === 'bottom') {
|
563
563
|
textAnchor = data.fullParams.tickTextRotate
|
564
564
|
? 'end'
|
565
565
|
: 'middle'
|
566
566
|
dominantBaseline = 'hanging'
|
567
|
-
} else if (data.fullDataFormatter.
|
567
|
+
} else if (data.fullDataFormatter.groupAxis.position === 'top') {
|
568
568
|
textAnchor = data.fullParams.tickTextRotate
|
569
569
|
? 'start'
|
570
570
|
: 'middle'
|
571
571
|
dominantBaseline = 'auto'
|
572
|
-
} else if (data.fullDataFormatter.
|
572
|
+
} else if (data.fullDataFormatter.groupAxis.position === 'left') {
|
573
573
|
textAnchor = 'end'
|
574
574
|
dominantBaseline = 'middle'
|
575
|
-
} else if (data.fullDataFormatter.
|
575
|
+
} else if (data.fullDataFormatter.groupAxis.position === 'right') {
|
576
576
|
textAnchor = 'start'
|
577
577
|
dominantBaseline = 'middle'
|
578
578
|
}
|
@@ -589,22 +589,22 @@ export const createBaseGroupAxis: BasePluginFn<BaseGroupAxisContext> = ((pluginN
|
|
589
589
|
let textAnchor: 'start' | 'middle' | 'end' = 'start'
|
590
590
|
let dominantBaseline: 'auto' | 'middle' | 'hanging' = 'hanging'
|
591
591
|
|
592
|
-
if (d.
|
592
|
+
if (d.groupAxis.position === 'bottom') {
|
593
593
|
dominantBaseline = 'hanging'
|
594
|
-
} else if (d.
|
594
|
+
} else if (d.groupAxis.position === 'top') {
|
595
595
|
dominantBaseline = 'auto'
|
596
|
-
} else if (d.
|
596
|
+
} else if (d.groupAxis.position === 'left') {
|
597
597
|
textAnchor = 'end'
|
598
|
-
} else if (d.
|
598
|
+
} else if (d.groupAxis.position === 'right') {
|
599
599
|
textAnchor = 'start'
|
600
600
|
}
|
601
|
-
if (d.
|
601
|
+
if (d.valueAxis.position === 'left') {
|
602
602
|
textAnchor = 'start'
|
603
|
-
} else if (d.
|
603
|
+
} else if (d.valueAxis.position === 'right') {
|
604
604
|
textAnchor = 'end'
|
605
|
-
} else if (d.
|
605
|
+
} else if (d.valueAxis.position === 'bottom') {
|
606
606
|
dominantBaseline = 'auto'
|
607
|
-
} else if (d.
|
607
|
+
} else if (d.valueAxis.position === 'top') {
|
608
608
|
dominantBaseline = 'hanging'
|
609
609
|
}
|
610
610
|
return {
|
package/src/base/BaseLegend.ts
CHANGED
@@ -25,7 +25,7 @@ import { measureTextWidth } from '../utils/commonUtils'
|
|
25
25
|
// backgroundStroke: ColorType
|
26
26
|
// textColorType: ColorType
|
27
27
|
// gap: number
|
28
|
-
//
|
28
|
+
// labelList: Array<{
|
29
29
|
// listRectWidth: number
|
30
30
|
// listRectHeight: number
|
31
31
|
// listRectRadius: number
|
@@ -35,7 +35,7 @@ import { measureTextWidth } from '../utils/commonUtils'
|
|
35
35
|
|
36
36
|
interface BaseLegendContext {
|
37
37
|
rootSelection: d3.Selection<any, unknown, any, unknown>
|
38
|
-
|
38
|
+
legendLabels$: Observable<string[]>
|
39
39
|
fullParams$: Observable<BaseLegendParams>
|
40
40
|
layout$: Observable<Layout>
|
41
41
|
fullChartParams$: Observable<ChartParams>
|
@@ -89,6 +89,8 @@ interface ListStyle {
|
|
89
89
|
listRectRadius: number
|
90
90
|
}
|
91
91
|
|
92
|
+
const noneLabelText = ' - ' // 沒有label時的預設文字
|
93
|
+
|
92
94
|
const defaultListStyle: ListStyle = {
|
93
95
|
listRectWidth: 14,
|
94
96
|
listRectHeight: 14,
|
@@ -96,16 +98,16 @@ const defaultListStyle: ListStyle = {
|
|
96
98
|
}
|
97
99
|
|
98
100
|
function getSeriesColor (seriesIndex: number, fullChartParams: ChartParams) {
|
99
|
-
const colorIndex = seriesIndex < fullChartParams.colors[fullChartParams.colorScheme].
|
101
|
+
const colorIndex = seriesIndex < fullChartParams.colors[fullChartParams.colorScheme].label.length
|
100
102
|
? seriesIndex
|
101
|
-
: seriesIndex % fullChartParams.colors[fullChartParams.colorScheme].
|
102
|
-
return fullChartParams.colors[fullChartParams.colorScheme].
|
103
|
+
: seriesIndex % fullChartParams.colors[fullChartParams.colorScheme].label.length
|
104
|
+
return fullChartParams.colors[fullChartParams.colorScheme].label[colorIndex]
|
103
105
|
}
|
104
106
|
|
105
107
|
|
106
108
|
export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: string, {
|
107
109
|
rootSelection,
|
108
|
-
|
110
|
+
legendLabels$,
|
109
111
|
fullParams$,
|
110
112
|
layout$,
|
111
113
|
fullChartParams$,
|
@@ -119,7 +121,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
|
|
119
121
|
|
120
122
|
const destroy$ = new Subject()
|
121
123
|
|
122
|
-
// const
|
124
|
+
// const legendLabels$: Observable<string[]> = SeriesDataMap$.pipe(
|
123
125
|
// takeUntil(destroy$),
|
124
126
|
// map(data => {
|
125
127
|
// return Array.from(data.keys())
|
@@ -127,7 +129,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
|
|
127
129
|
// )
|
128
130
|
|
129
131
|
const SeriesLabelColorMap$ = combineLatest({
|
130
|
-
|
132
|
+
legendLabels: legendLabels$,
|
131
133
|
fullChartParams: fullChartParams$
|
132
134
|
}).pipe(
|
133
135
|
takeUntil(destroy$),
|
@@ -135,7 +137,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
|
|
135
137
|
map(data => {
|
136
138
|
const SeriesLabelColorMap: Map<string, string> = new Map()
|
137
139
|
let accIndex = 0
|
138
|
-
data.
|
140
|
+
data.legendLabels.forEach((label, i) => {
|
139
141
|
if (!SeriesLabelColorMap.has(label)) {
|
140
142
|
const color = getSeriesColor(accIndex, data.fullChartParams)
|
141
143
|
SeriesLabelColorMap.set(label, color)
|
@@ -146,8 +148,8 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
|
|
146
148
|
})
|
147
149
|
)
|
148
150
|
|
149
|
-
// 對應
|
150
|
-
const visibleList$ =
|
151
|
+
// 對應legendLabels是否顯示(只顯示不重覆的)
|
152
|
+
const visibleList$ = legendLabels$.pipe(
|
151
153
|
takeUntil(destroy$),
|
152
154
|
map(data => {
|
153
155
|
const AccSeriesLabelSet = new Set()
|
@@ -305,7 +307,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
|
|
305
307
|
const defaultListStyle$ = fullParams$.pipe(
|
306
308
|
takeUntil(destroy$),
|
307
309
|
map(data => {
|
308
|
-
return data.
|
310
|
+
return data.labelList[0] ? data.labelList[0] : defaultListStyle
|
309
311
|
})
|
310
312
|
)
|
311
313
|
|
@@ -314,7 +316,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
|
|
314
316
|
visibleList: visibleList$,
|
315
317
|
fullParams: fullParams$,
|
316
318
|
fullChartParams: fullChartParams$,
|
317
|
-
|
319
|
+
legendLabels: legendLabels$,
|
318
320
|
lineDirection: lineDirection$,
|
319
321
|
lineMaxSize: lineMaxSize$,
|
320
322
|
defaultListStyle: defaultListStyle$,
|
@@ -324,16 +326,18 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
|
|
324
326
|
takeUntil(destroy$),
|
325
327
|
switchMap(async d => d),
|
326
328
|
map(data => {
|
327
|
-
return data.
|
329
|
+
return data.legendLabels.reduce((prev: LegendItem[][], _current, currentIndex) => {
|
328
330
|
// visible為flase則不加入
|
329
331
|
if (!data.visibleList[currentIndex]) {
|
330
332
|
return prev
|
331
333
|
}
|
334
|
+
|
335
|
+
const currentText = _current !== '' ? _current : noneLabelText
|
332
336
|
|
333
|
-
const textWidth = measureTextWidth(
|
337
|
+
const textWidth = measureTextWidth(currentText, data.textSizePx)
|
334
338
|
const itemWidth = (data.textSizePx * 1.5) + textWidth
|
335
339
|
// const color = getSeriesColor(currentIndex, data.fullChartParams)
|
336
|
-
const color = data.SeriesLabelColorMap.get(
|
340
|
+
const color = data.SeriesLabelColorMap.get(_current)
|
337
341
|
const lastItem: LegendItem | null = prev[0] && prev[0][0]
|
338
342
|
? prev[prev.length - 1][prev[prev.length - 1].length - 1]
|
339
343
|
: null
|
@@ -389,15 +393,15 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
|
|
389
393
|
prev[lineIndex] = []
|
390
394
|
}
|
391
395
|
|
392
|
-
const listStyle = data.fullParams.
|
396
|
+
const listStyle = data.fullParams.labelList[itemIndex] ? data.fullParams.labelList[itemIndex] : data.defaultListStyle
|
393
397
|
|
394
398
|
prev[lineIndex].push({
|
395
|
-
id:
|
396
|
-
seriesLabel:
|
399
|
+
id: currentText,
|
400
|
+
seriesLabel: currentText,
|
397
401
|
seriesIndex: currentIndex,
|
398
402
|
lineIndex,
|
399
403
|
itemIndex,
|
400
|
-
text:
|
404
|
+
text: currentText,
|
401
405
|
itemWidth,
|
402
406
|
translateX,
|
403
407
|
translateY,
|
@@ -664,7 +668,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
|
|
664
668
|
)
|
665
669
|
.attr('x', data.textSizePx * 1.5)
|
666
670
|
.attr('font-size', data.fullChartParams.styles.textSize)
|
667
|
-
.attr('fill', d => data.fullParams.textColorType === '
|
671
|
+
.attr('fill', d => data.fullParams.textColorType === 'label'
|
668
672
|
? getSeriesColor(d.seriesIndex, data.fullChartParams)
|
669
673
|
: getColor(data.fullParams.textColorType, data.fullChartParams))
|
670
674
|
.text(d => d.text)
|
@@ -16,14 +16,14 @@ import type {
|
|
16
16
|
ComputedLayoutDataGrid,
|
17
17
|
DataFormatterGrid,
|
18
18
|
EventGrid,
|
19
|
-
|
19
|
+
ContainerPositionScaled,
|
20
20
|
ChartParams,
|
21
21
|
Layout,
|
22
22
|
TransformData
|
23
23
|
} from '../../lib/core-types'
|
24
24
|
import type { BaseLineAreasParams } from '../../lib/plugins-basic-types'
|
25
25
|
import { getD3TransitionEase } from '../utils/d3Utils'
|
26
|
-
import { getClassName, getUniID,
|
26
|
+
import { getClassName, getUniID, getMinMaxValue } from '../utils/orbchartsUtils'
|
27
27
|
import { gridGroupPositionFnObservable } from '../grid/gridObservables'
|
28
28
|
import { gridSelectionsObservable } from '../grid/gridObservables'
|
29
29
|
|
@@ -52,8 +52,8 @@ interface BaseLineAreasContext {
|
|
52
52
|
height: number;
|
53
53
|
}>
|
54
54
|
gridHighlight$: Observable<ComputedDatumGrid[]>
|
55
|
-
gridContainerPosition$: Observable<
|
56
|
-
allContainerPosition$: Observable<
|
55
|
+
gridContainerPosition$: Observable<ContainerPositionScaled[]>
|
56
|
+
allContainerPosition$: Observable<ContainerPositionScaled[]>
|
57
57
|
layout$: Observable<Layout>
|
58
58
|
event$: Subject<EventGrid>
|
59
59
|
}
|
package/src/base/BaseLines.ts
CHANGED
@@ -16,7 +16,7 @@ import type {
|
|
16
16
|
ComputedLayoutDataGrid,
|
17
17
|
DataFormatterGrid,
|
18
18
|
EventGrid,
|
19
|
-
|
19
|
+
ContainerPositionScaled,
|
20
20
|
ChartParams,
|
21
21
|
Layout,
|
22
22
|
TransformData
|
@@ -58,8 +58,8 @@ interface BaseLinesContext {
|
|
58
58
|
height: number;
|
59
59
|
}>
|
60
60
|
gridHighlight$: Observable<ComputedDatumGrid[]>
|
61
|
-
gridContainerPosition$: Observable<
|
62
|
-
allContainerPosition$: Observable<
|
61
|
+
gridContainerPosition$: Observable<ContainerPositionScaled[]>
|
62
|
+
allContainerPosition$: Observable<ContainerPositionScaled[]>
|
63
63
|
layout$: Observable<Layout>
|
64
64
|
event$: Subject<EventGrid>
|
65
65
|
}
|