@orbcharts/plugins-basic 3.0.0-beta.3 → 3.0.0-beta.5
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/BaseBarStack.d.ts +2 -2
- 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 → orbcharts-plugins-basic/src}/base/BaseValueAxis.d.ts +3 -2
- package/dist/{src → orbcharts-plugins-basic/src}/grid/defaults.d.ts +1 -1
- package/dist/{src → orbcharts-plugins-basic/src}/grid/gridObservables.d.ts +5 -5
- package/dist/orbcharts-plugins-basic/src/index.d.ts +6 -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/{src → orbcharts-plugins-basic/src}/series/seriesObservables.d.ts +3 -3
- 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 +11809 -10185
- package/dist/orbcharts-plugins-basic.umd.js +66 -34
- package/dist/src/index.d.ts +1 -5
- package/package.json +4 -4
- package/src/base/BaseBarStack.ts +2 -2
- package/src/base/BaseBars.ts +2 -2
- package/src/base/BaseBarsTriangle.ts +2 -2
- package/src/base/BaseDots.ts +2 -53
- package/src/base/BaseGroupAxis.ts +3 -3
- package/src/base/BaseLegend.ts +21 -17
- package/src/base/BaseLineAreas.ts +3 -3
- package/src/base/BaseLines.ts +3 -3
- package/src/base/BaseValueAxis.ts +46 -43
- package/src/grid/defaults.ts +3 -3
- package/src/grid/gridObservables.ts +24 -15
- package/src/grid/plugins/GridLegend.ts +2 -2
- package/src/grid/plugins/GridZoom.ts +14 -14
- package/src/grid/plugins/GroupAux.ts +206 -201
- package/src/grid/plugins/ValueAxis.ts +1 -0
- package/src/grid/plugins/ValueStackAxis.ts +1 -0
- package/src/index.ts +1 -0
- package/src/multiGrid/plugins/MultiGridLegend.ts +2 -2
- package/src/multiGrid/plugins/MultiValueAxis.ts +1 -0
- package/src/multiGrid/plugins/MultiValueStackAxis.ts +1 -0
- package/src/multiGrid/plugins/OverlappingValueAxes.ts +1 -0
- package/src/multiGrid/plugins/OverlappingValueStackAxes.ts +1 -0
- package/src/multiValue/defaults.ts +163 -0
- package/src/multiValue/index.ts +9 -0
- package/src/multiValue/multiValueObservables.ts +258 -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 +551 -0
- package/src/multiValue/plugins/XYAux.ts +682 -0
- package/src/multiValue/plugins/XYAxes.ts +677 -0
- package/src/multiValue/plugins/XYZoom.ts +300 -0
- package/src/series/plugins/Bubbles.ts +4 -4
- package/src/series/plugins/Pie.ts +2 -2
- package/src/series/plugins/PieEventTexts.ts +2 -2
- 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/plugins/TreeLegend.ts +3 -10
- package/src/utils/d3Utils.ts +2 -1
- package/src/utils/observables.ts +2 -2
- package/src/utils/orbchartsUtils.ts +7 -6
- package/dist/src/base/BaseGroupArea.d.ts +0 -0
- package/dist/src/multiValue/plugins/Scatter.d.ts +0 -0
- package/dist/src/multiValue/plugins/ScatterAxes.d.ts +0 -0
- package/dist/src/relationship/index.d.ts +0 -0
- package/src/base/BaseGroupArea.ts +0 -0
- package/src/multiValue/plugins/ScatterAxes.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/index.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarStack.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}/grid/plugins/ValueStackAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/defaults.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/index.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/MultiBarStack.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/MultiValueStackAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueStackAxes.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 → orbcharts-plugins-basic/src}/noneData/plugins/Container.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/noneData/plugins/Tooltip.d.ts +0 -0
- /package/dist/{src/multiValue → orbcharts-plugins-basic/src/relationship}/index.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/relationship/plugins/Relationship.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/commonUtils.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Graphics.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Utils.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.5",
|
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.4",
|
39
|
+
"@orbcharts/core-types": "^3.0.0-beta.3",
|
40
|
+
"@orbcharts/plugins-basic-types": "^3.0.0-beta.4",
|
41
41
|
"d3": "^7.8.5",
|
42
42
|
"rxjs": "^7.8.1"
|
43
43
|
}
|
package/src/base/BaseBarStack.ts
CHANGED
@@ -17,7 +17,7 @@ import type {
|
|
17
17
|
DataFormatterGrid,
|
18
18
|
EventGrid,
|
19
19
|
ChartParams,
|
20
|
-
|
20
|
+
ContainerPositionScaled,
|
21
21
|
Layout,
|
22
22
|
TransformData } from '../../lib/core-types'
|
23
23
|
import type { BaseBarStackParams } from '../../lib/plugins-basic-types'
|
@@ -52,7 +52,7 @@ interface BaseBarStackContext {
|
|
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
|
}
|
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
|
}
|
@@ -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
|
}
|
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
|
|
@@ -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
|
}
|
@@ -498,7 +498,7 @@ export const createBaseGroupAxis: BasePluginFn<BaseGroupAxisContext> = ((pluginN
|
|
498
498
|
|
499
499
|
// const padding = data.fullDataFormatter.grid.groupAxis.scalePadding
|
500
500
|
|
501
|
-
// const groupScale =
|
501
|
+
// const groupScale = createLabelToAxisScale({
|
502
502
|
// axisLabels,
|
503
503
|
// axisWidth: data.gridAxesSize.width,
|
504
504
|
// padding
|
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,
|
@@ -105,7 +107,7 @@ function getSeriesColor (seriesIndex: number, fullChartParams: ChartParams) {
|
|
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,
|
@@ -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
|
@@ -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
|
}
|
@@ -8,14 +8,14 @@ import {
|
|
8
8
|
takeUntil,
|
9
9
|
Observable,
|
10
10
|
Subject } from 'rxjs'
|
11
|
-
import {
|
11
|
+
import { createValueToAxisScale } from '../../lib/core'
|
12
12
|
import type { BasePluginFn } from './types'
|
13
13
|
import type {
|
14
14
|
ComputedDataGrid,
|
15
15
|
DataFormatterGrid,
|
16
16
|
ChartParams,
|
17
17
|
ComputedDatumGrid,
|
18
|
-
|
18
|
+
ContainerPositionScaled,
|
19
19
|
TransformData,
|
20
20
|
EventGrid,
|
21
21
|
ColorType
|
@@ -43,6 +43,7 @@ import { getColor, getMinAndMaxValue, getClassName, getUniID } from '../utils/or
|
|
43
43
|
interface BaseLinesContext {
|
44
44
|
selection: d3.Selection<any, unknown, any, unknown>
|
45
45
|
computedData$: Observable<ComputedDataGrid>
|
46
|
+
filteredMinMaxValue$: Observable<[number, number]>
|
46
47
|
fullParams$: Observable<BaseValueAxisParams>
|
47
48
|
fullDataFormatter$: Observable<DataFormatterGrid>
|
48
49
|
fullChartParams$: Observable<ChartParams>
|
@@ -52,7 +53,7 @@ interface BaseLinesContext {
|
|
52
53
|
width: number;
|
53
54
|
height: number;
|
54
55
|
}>
|
55
|
-
gridContainerPosition$: Observable<
|
56
|
+
gridContainerPosition$: Observable<ContainerPositionScaled[]>
|
56
57
|
isSeriesSeprate$: Observable<boolean>
|
57
58
|
}
|
58
59
|
|
@@ -149,7 +150,7 @@ function renderAxisLabel ({ selection, textClassName, fullParams, axisLabelAlign
|
|
149
150
|
|
150
151
|
}
|
151
152
|
|
152
|
-
function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gridAxesSize, fullDataFormatter, fullChartParams, valueScale, textReverseTransformWithRotate,
|
153
|
+
function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gridAxesSize, fullDataFormatter, fullChartParams, valueScale, textReverseTransformWithRotate, filteredMinMaxValue }: {
|
153
154
|
selection: d3.Selection<SVGGElement, any, any, any>,
|
154
155
|
yAxisClassName: string
|
155
156
|
fullParams: BaseValueAxisParams
|
@@ -159,7 +160,7 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
|
|
159
160
|
fullChartParams: ChartParams
|
160
161
|
valueScale: d3.ScaleLinear<number, number>
|
161
162
|
textReverseTransformWithRotate: string,
|
162
|
-
|
163
|
+
filteredMinMaxValue: [number, number]
|
163
164
|
}) {
|
164
165
|
|
165
166
|
const yAxisSelection = selection
|
@@ -168,7 +169,7 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
|
|
168
169
|
.join('g')
|
169
170
|
.classed(yAxisClassName, true)
|
170
171
|
|
171
|
-
const valueLength =
|
172
|
+
const valueLength = filteredMinMaxValue[1] - filteredMinMaxValue[0]
|
172
173
|
|
173
174
|
// const _valueScale = d3.scaleLinear()
|
174
175
|
// .domain([0, 150])
|
@@ -196,7 +197,7 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
|
|
196
197
|
.scale(valueScale)
|
197
198
|
.ticks(valueLength > fullParams.ticks
|
198
199
|
? fullParams.ticks
|
199
|
-
: ((
|
200
|
+
: ((filteredMinMaxValue[0] === 0 && filteredMinMaxValue[1] === 0)
|
200
201
|
? 1
|
201
202
|
: Math.ceil(valueLength))) // 刻度分段數量
|
202
203
|
.tickFormat(d => parseTickFormatValue(d, fullParams.tickFormat))
|
@@ -231,6 +232,7 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
|
|
231
232
|
.attr('dominant-baseline', tickTextAlign.dominantBaseline)
|
232
233
|
// .attr('dy', 0)
|
233
234
|
.attr('y', textY)
|
235
|
+
.attr('dy', 0)
|
234
236
|
yText.style('transform', textReverseTransformWithRotate)
|
235
237
|
|
236
238
|
// 抵消掉預設的偏移
|
@@ -246,6 +248,7 @@ function renderAxis ({ selection, yAxisClassName, fullParams, tickTextAlign, gri
|
|
246
248
|
export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName: string, {
|
247
249
|
selection,
|
248
250
|
computedData$,
|
251
|
+
filteredMinMaxValue$,
|
249
252
|
fullParams$,
|
250
253
|
fullDataFormatter$,
|
251
254
|
fullChartParams$,
|
@@ -410,52 +413,52 @@ export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName:
|
|
410
413
|
})
|
411
414
|
)
|
412
415
|
|
413
|
-
const minAndMax$: Observable<[number, number]> = new Observable(subscriber => {
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
: data.fullDataFormatter.grid.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.grid.groupAxis.scalePadding
|
416
|
+
// const minAndMax$: Observable<[number, number]> = new Observable(subscriber => {
|
417
|
+
// combineLatest({
|
418
|
+
// fullDataFormatter: fullDataFormatter$,
|
419
|
+
// computedData: computedData$
|
420
|
+
// }).pipe(
|
421
|
+
// takeUntil(destroy$),
|
422
|
+
// switchMap(async (d) => d),
|
423
|
+
// ).subscribe(data => {
|
424
|
+
// const groupMin = 0
|
425
|
+
// const groupMax = data.computedData[0] ? data.computedData[0].length - 1 : 0
|
426
|
+
// // const groupScaleDomainMin = data.fullDataFormatter.grid.groupAxis.scaleDomain[0] === 'auto'
|
427
|
+
// // ? groupMin - data.fullDataFormatter.grid.groupAxis.scalePadding
|
428
|
+
// // : data.fullDataFormatter.grid.groupAxis.scaleDomain[0] as number - data.fullDataFormatter.grid.groupAxis.scalePadding
|
429
|
+
// const groupScaleDomainMin = data.fullDataFormatter.grid.groupAxis.scaleDomain[0] - data.fullDataFormatter.grid.groupAxis.scalePadding
|
430
|
+
// const groupScaleDomainMax = data.fullDataFormatter.grid.groupAxis.scaleDomain[1] === 'max'
|
431
|
+
// ? groupMax + data.fullDataFormatter.grid.groupAxis.scalePadding
|
432
|
+
// : data.fullDataFormatter.grid.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.grid.groupAxis.scalePadding
|
431
433
|
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
434
|
+
// const filteredData = data.computedData.map((d, i) => {
|
435
|
+
// return d.filter((_d, _i) => {
|
436
|
+
// return _i >= groupScaleDomainMin && _i <= groupScaleDomainMax
|
437
|
+
// })
|
438
|
+
// })
|
437
439
|
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
})
|
440
|
+
// const filteredMinAndMax = getMinAndMaxValue(filteredData.flat())
|
441
|
+
// if (filteredMinAndMax[0] === filteredMinAndMax[1]) {
|
442
|
+
// filteredMinAndMax[0] = filteredMinAndMax[1] - 1 // 避免最大及最小值相同造成無法計算scale
|
443
|
+
// }
|
444
|
+
// subscriber.next(filteredMinAndMax)
|
445
|
+
// })
|
446
|
+
// })
|
445
447
|
|
446
448
|
const valueScale$: Observable<d3.ScaleLinear<number, number>> = new Observable(subscriber => {
|
447
449
|
combineLatest({
|
448
450
|
fullDataFormatter: fullDataFormatter$,
|
449
451
|
gridAxesSize: gridAxesSize$,
|
450
|
-
minAndMax: minAndMax$
|
452
|
+
// minAndMax: minAndMax$
|
453
|
+
filteredMinMaxValue: filteredMinMaxValue$
|
451
454
|
}).pipe(
|
452
455
|
takeUntil(destroy$),
|
453
456
|
switchMap(async (d) => d),
|
454
457
|
).subscribe(data => {
|
455
458
|
|
456
|
-
const valueScale: d3.ScaleLinear<number, number> =
|
457
|
-
maxValue: data.
|
458
|
-
minValue: data.
|
459
|
+
const valueScale: d3.ScaleLinear<number, number> = createValueToAxisScale({
|
460
|
+
maxValue: data.filteredMinMaxValue[1],
|
461
|
+
minValue: data.filteredMinMaxValue[0],
|
459
462
|
axisWidth: data.gridAxesSize.height,
|
460
463
|
scaleDomain: data.fullDataFormatter.grid.valueAxis.scaleDomain,
|
461
464
|
scaleRange: data.fullDataFormatter.grid.valueAxis.scaleRange
|
@@ -543,7 +546,7 @@ export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName:
|
|
543
546
|
valueScale: valueScale$,
|
544
547
|
textReverseTransform: textReverseTransform$,
|
545
548
|
textReverseTransformWithRotate: textReverseTransformWithRotate$,
|
546
|
-
|
549
|
+
filteredMinMaxValue: filteredMinMaxValue$
|
547
550
|
}).pipe(
|
548
551
|
takeUntil(destroy$),
|
549
552
|
switchMap(async (d) => d),
|
@@ -559,7 +562,7 @@ export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName:
|
|
559
562
|
fullChartParams: data.fullChartParams,
|
560
563
|
valueScale: data.valueScale,
|
561
564
|
textReverseTransformWithRotate: data.textReverseTransformWithRotate,
|
562
|
-
|
565
|
+
filteredMinMaxValue: data.filteredMinMaxValue
|
563
566
|
})
|
564
567
|
|
565
568
|
renderAxisLabel({
|
package/src/grid/defaults.ts
CHANGED
@@ -13,7 +13,7 @@ import type {
|
|
13
13
|
GridZoomParams,
|
14
14
|
GridLegendParams
|
15
15
|
} from '../../lib/plugins-basic-types'
|
16
|
-
import { measureTextWidth } from '../utils/commonUtils'
|
16
|
+
// import { measureTextWidth } from '../utils/commonUtils'
|
17
17
|
|
18
18
|
export const DEFAULT_LINES_PARAMS: LinesParams = {
|
19
19
|
lineCurve: 'curveLinear',
|
@@ -34,7 +34,7 @@ export const DEFAULT_DOTS_PARAMS: DotsParams = {
|
|
34
34
|
onlyShowHighlighted: false
|
35
35
|
}
|
36
36
|
|
37
|
-
export const
|
37
|
+
export const DEFAULT_GROUP_AUX_PARAMS: GroupAuxParams = {
|
38
38
|
showLine: true,
|
39
39
|
showLabel: true,
|
40
40
|
lineDashArray: '3, 3',
|
@@ -45,7 +45,7 @@ export const DEFAULT_GROUP_AREA_PARAMS: GroupAuxParams = {
|
|
45
45
|
labelPadding: 20,
|
46
46
|
labelRotate: 0
|
47
47
|
}
|
48
|
-
|
48
|
+
DEFAULT_GROUP_AUX_PARAMS.labelTextFormat.toString = () => `text => text`
|
49
49
|
|
50
50
|
export const DEFAULT_BARS_PARAMS: BarsParams = {
|
51
51
|
// barType: 'rect',
|