@orbcharts/plugins-basic 3.0.0-alpha.70 → 3.0.0-alpha.72
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/core-types.d.ts +1 -0
- package/dist/lib/core.d.ts +1 -0
- package/dist/orbcharts-plugins-basic.es.js +8863 -7397
- package/dist/orbcharts-plugins-basic.umd.js +19 -15
- package/dist/src/base/BaseBarStack.d.ts +1 -1
- package/dist/src/base/BaseBars.d.ts +1 -1
- package/dist/src/base/BaseBarsTriangle.d.ts +1 -1
- package/dist/src/base/BaseDots.d.ts +1 -1
- package/dist/src/base/BaseGroupAxis.d.ts +1 -1
- package/dist/src/base/BaseLegend.d.ts +1 -1
- package/dist/src/base/BaseLineAreas.d.ts +1 -1
- package/dist/src/base/BaseLines.d.ts +1 -1
- package/dist/src/base/BaseValueAxis.d.ts +1 -1
- package/dist/src/const.d.ts +10 -0
- package/dist/src/grid/gridObservables.d.ts +1 -1
- package/dist/src/grid/plugins/BarStack.d.ts +1 -1
- package/dist/src/grid/plugins/Bars.d.ts +1 -1
- package/dist/src/grid/plugins/BarsPN.d.ts +1 -1
- package/dist/src/grid/plugins/BarsTriangle.d.ts +1 -1
- package/dist/src/grid/plugins/Dots.d.ts +1 -1
- package/dist/src/grid/plugins/GridLegend.d.ts +1 -1
- package/dist/src/grid/plugins/GroupAux.d.ts +1 -1
- package/dist/src/grid/plugins/GroupAxis.d.ts +1 -1
- package/dist/src/grid/plugins/LineAreas.d.ts +1 -1
- package/dist/src/grid/plugins/Lines.d.ts +1 -1
- package/dist/src/grid/plugins/ScalingArea.d.ts +1 -1
- package/dist/src/grid/plugins/ValueAxis.d.ts +1 -1
- package/dist/src/grid/plugins/ValueStackAxis.d.ts +1 -1
- package/dist/src/grid/types.d.ts +1 -1
- package/dist/src/multiGrid/multiGridObservables.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiBarStack.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiBars.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiBarsTriangle.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiDots.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiGridLegend.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiGroupAxis.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiLineAreas.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiLines.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiValueAxis.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiValueStackAxis.d.ts +1 -1
- package/dist/src/multiGrid/plugins/OverlappingValueAxes.d.ts +1 -1
- package/dist/src/multiGrid/plugins/OverlappingValueStackAxes.d.ts +1 -1
- package/dist/src/multiGrid/types.d.ts +1 -1
- package/dist/src/noneData/plugins/Container.d.ts +1 -1
- package/dist/src/noneData/plugins/Tooltip.d.ts +2 -2
- package/dist/src/noneData/types.d.ts +1 -1
- package/dist/src/series/plugins/Bubbles.d.ts +1 -1
- package/dist/src/series/plugins/Pie.d.ts +1 -1
- package/dist/src/series/plugins/PieEventTexts.d.ts +1 -1
- package/dist/src/series/plugins/PieLabels.d.ts +1 -1
- package/dist/src/series/plugins/Rose.d.ts +2 -2
- package/dist/src/series/plugins/RoseLabels.d.ts +1 -1
- package/dist/src/series/plugins/SeriesLegend.d.ts +1 -1
- package/dist/src/series/seriesObservables.d.ts +1 -1
- package/dist/src/series/seriesUtils.d.ts +1 -1
- package/dist/src/series/types.d.ts +1 -1
- package/dist/src/tree/plugins/TreeLegend.d.ts +1 -1
- package/dist/src/tree/plugins/TreeMap.d.ts +1 -1
- package/dist/src/tree/types.d.ts +1 -1
- package/dist/src/utils/orbchartsUtils.d.ts +1 -1
- package/lib/core-types.ts +7 -0
- package/lib/core.ts +6 -0
- package/package.json +3 -2
- package/src/base/BaseBarStack.ts +1 -1
- package/src/base/BaseBars.ts +1 -1
- package/src/base/BaseBarsTriangle.ts +1 -1
- package/src/base/BaseDots.ts +1 -1
- package/src/base/BaseGroupAxis.ts +7 -4
- package/src/base/BaseLegend.ts +1 -1
- package/src/base/BaseLineAreas.ts +1 -2
- package/src/base/BaseLines.ts +1 -1
- package/src/base/BaseValueAxis.ts +2 -2
- package/src/const.ts +30 -0
- package/src/grid/gridObservables.ts +5 -3
- package/src/grid/plugins/BarStack.ts +23 -2
- package/src/grid/plugins/Bars.ts +27 -2
- package/src/grid/plugins/BarsPN.ts +27 -2
- package/src/grid/plugins/BarsTriangle.ts +33 -2
- package/src/grid/plugins/Dots.ts +33 -2
- package/src/grid/plugins/GridLegend.ts +39 -2
- package/src/grid/plugins/GroupAux.ts +115 -31
- package/src/grid/plugins/GroupAxis.ts +63 -2
- package/src/grid/plugins/LineAreas.ts +27 -2
- package/src/grid/plugins/Lines.ts +21 -2
- package/src/grid/plugins/ScalingArea.ts +103 -61
- package/src/grid/plugins/ValueAxis.ts +60 -3
- package/src/grid/plugins/ValueStackAxis.ts +60 -3
- package/src/grid/types.ts +1 -1
- package/src/multiGrid/multiGridObservables.ts +1 -1
- package/src/multiGrid/plugins/MultiBarStack.ts +30 -2
- package/src/multiGrid/plugins/MultiBars.ts +33 -2
- package/src/multiGrid/plugins/MultiBarsTriangle.ts +39 -2
- package/src/multiGrid/plugins/MultiDots.ts +39 -2
- package/src/multiGrid/plugins/MultiGridLegend.ts +61 -2
- package/src/multiGrid/plugins/MultiGroupAxis.ts +69 -2
- package/src/multiGrid/plugins/MultiLineAreas.ts +33 -3
- package/src/multiGrid/plugins/MultiLines.ts +27 -3
- package/src/multiGrid/plugins/MultiValueAxis.ts +66 -2
- package/src/multiGrid/plugins/MultiValueStackAxis.ts +66 -2
- package/src/multiGrid/plugins/OverlappingValueAxes.ts +133 -4
- package/src/multiGrid/plugins/OverlappingValueStackAxes.ts +133 -4
- package/src/multiGrid/types.ts +1 -1
- package/src/noneData/defaults.ts +8 -8
- package/src/noneData/plugins/Container.ts +19 -2
- package/src/noneData/plugins/Tooltip.ts +46 -4
- package/src/noneData/types.ts +1 -1
- package/src/series/defaults.ts +1 -1
- package/src/series/plugins/Bubbles.ts +61 -3
- package/src/series/plugins/Pie.ts +43 -4
- package/src/series/plugins/PieEventTexts.ts +25 -4
- package/src/series/plugins/PieLabels.ts +39 -3
- package/src/series/plugins/Rose.ts +38 -3
- package/src/series/plugins/RoseLabels.ts +32 -3
- package/src/series/plugins/SeriesLegend.ts +39 -2
- package/src/series/seriesObservables.ts +1 -1
- package/src/series/seriesUtils.ts +1 -1
- package/src/series/types.ts +1 -1
- package/src/tree/plugins/TreeLegend.ts +39 -2
- package/src/tree/plugins/TreeMap.ts +31 -3
- package/src/tree/types.ts +1 -1
- package/src/utils/orbchartsUtils.ts +1 -1
|
@@ -10,22 +10,24 @@ import {
|
|
|
10
10
|
Observable,
|
|
11
11
|
Subject,
|
|
12
12
|
BehaviorSubject } from 'rxjs'
|
|
13
|
+
import type { DefinePluginConfig } from '../../../lib/core-types'
|
|
13
14
|
import type {
|
|
14
15
|
ComputedDataSeries,
|
|
15
16
|
ComputedDatumSeries,
|
|
16
17
|
SeriesContainerPosition,
|
|
17
18
|
ChartParams,
|
|
18
19
|
EventSeries,
|
|
19
|
-
Layout } from '
|
|
20
|
+
Layout } from '../../../lib/core-types'
|
|
20
21
|
import type { D3PieDatum } from '../seriesUtils'
|
|
21
22
|
import type { RoseParams } from '../types'
|
|
22
23
|
import {
|
|
23
|
-
defineSeriesPlugin } from '
|
|
24
|
+
defineSeriesPlugin } from '../../../lib/core'
|
|
24
25
|
import { DEFAULT_ROSE_PARAMS } from '../defaults'
|
|
25
26
|
// import { makePieData } from '../seriesUtils'
|
|
26
27
|
// import { getD3TransitionEase, makeD3Arc } from '../../utils/d3Utils'
|
|
27
28
|
import { getDatumColor, getClassName } from '../../utils/orbchartsUtils'
|
|
28
29
|
import { seriesCenterSelectionObservable } from '../seriesObservables'
|
|
30
|
+
import { LAYER_INDEX_OF_GRAPHIC } from '../../const'
|
|
29
31
|
|
|
30
32
|
// @Q@ 暫時先寫在這裡,之後pie一起重構後再放到seriesUtils
|
|
31
33
|
export interface PieDatum extends D3PieDatum {
|
|
@@ -40,6 +42,39 @@ const roseInnerRadius = 0
|
|
|
40
42
|
const roseStartAngle = 0
|
|
41
43
|
const roseEndAngle = Math.PI * 2
|
|
42
44
|
|
|
45
|
+
const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_ROSE_PARAMS> = {
|
|
46
|
+
name: pluginName,
|
|
47
|
+
defaultParams: DEFAULT_ROSE_PARAMS,
|
|
48
|
+
layerIndex: LAYER_INDEX_OF_GRAPHIC,
|
|
49
|
+
validator: (params, { validateColumns }) => {
|
|
50
|
+
const result = validateColumns(params, {
|
|
51
|
+
outerRadius: {
|
|
52
|
+
toBeTypes: ['number'],
|
|
53
|
+
},
|
|
54
|
+
padAngle: {
|
|
55
|
+
toBeTypes: ['number'],
|
|
56
|
+
},
|
|
57
|
+
strokeColorType: {
|
|
58
|
+
toBeOption: 'ColorType'
|
|
59
|
+
},
|
|
60
|
+
strokeWidth: {
|
|
61
|
+
toBeTypes: ['number']
|
|
62
|
+
},
|
|
63
|
+
cornerRadius: {
|
|
64
|
+
toBeTypes: ['number']
|
|
65
|
+
},
|
|
66
|
+
arcScaleType: {
|
|
67
|
+
toBe: '"area" | "radius"',
|
|
68
|
+
test: (value: any) => value === 'area' || value === 'radius'
|
|
69
|
+
},
|
|
70
|
+
angleIncreaseWhileHighlight: {
|
|
71
|
+
toBeTypes: ['number']
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
return result
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
43
78
|
function makeTweenArcFn ({ cornerRadius, outerRadius, axisWidth, maxValue, arcScaleType, fullParams }: {
|
|
44
79
|
// interpolateRadius: (t: number) => number
|
|
45
80
|
outerRadius: number
|
|
@@ -424,7 +459,7 @@ function createEachRose (pluginName: string, context: {
|
|
|
424
459
|
}
|
|
425
460
|
}
|
|
426
461
|
|
|
427
|
-
export const Rose = defineSeriesPlugin(
|
|
462
|
+
export const Rose = defineSeriesPlugin(pluginConfig)(({ selection, name, subject, observer }) => {
|
|
428
463
|
const destroy$ = new Subject()
|
|
429
464
|
|
|
430
465
|
const { seriesCenterSelection$ } = seriesCenterSelectionObservable({
|
|
@@ -9,13 +9,14 @@ import {
|
|
|
9
9
|
distinctUntilChanged,
|
|
10
10
|
Subject,
|
|
11
11
|
BehaviorSubject } from 'rxjs'
|
|
12
|
+
import type { DefinePluginConfig } from '../../../lib/core-types'
|
|
12
13
|
import {
|
|
13
|
-
defineSeriesPlugin } from '
|
|
14
|
+
defineSeriesPlugin } from '../../../lib/core'
|
|
14
15
|
import type {
|
|
15
16
|
ComputedDatumSeries,
|
|
16
17
|
SeriesContainerPosition,
|
|
17
18
|
EventSeries,
|
|
18
|
-
ChartParams } from '
|
|
19
|
+
ChartParams } from '../../../lib/core-types'
|
|
19
20
|
import type { RoseLabelsParams } from '../types'
|
|
20
21
|
import type { PieDatum } from '../seriesUtils'
|
|
21
22
|
import { DEFAULT_ROSE_LABELS_PARAMS } from '../defaults'
|
|
@@ -24,6 +25,7 @@ import { makeD3Arc } from '../../utils/d3Utils'
|
|
|
24
25
|
import { getDatumColor, getClassName } from '../../utils/orbchartsUtils'
|
|
25
26
|
import { seriesCenterSelectionObservable } from '../seriesObservables'
|
|
26
27
|
import { renderTspansOnQuadrant } from '../../utils/d3Graphics'
|
|
28
|
+
import { LAYER_INDEX_OF_LABEL } from '../../const'
|
|
27
29
|
|
|
28
30
|
interface RenderDatum {
|
|
29
31
|
pieDatum: PieDatum
|
|
@@ -50,6 +52,33 @@ const textClassName = getClassName(pluginName, 'text')
|
|
|
50
52
|
|
|
51
53
|
const pieOuterCentroid = 2
|
|
52
54
|
|
|
55
|
+
const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_ROSE_LABELS_PARAMS> = {
|
|
56
|
+
name: pluginName,
|
|
57
|
+
defaultParams: DEFAULT_ROSE_LABELS_PARAMS,
|
|
58
|
+
layerIndex: LAYER_INDEX_OF_LABEL,
|
|
59
|
+
validator: (params, { validateColumns }) => {
|
|
60
|
+
const result = validateColumns(params, {
|
|
61
|
+
outerRadius: {
|
|
62
|
+
toBeTypes: ['number'],
|
|
63
|
+
},
|
|
64
|
+
labelCentroid: {
|
|
65
|
+
toBeTypes: ['number'],
|
|
66
|
+
},
|
|
67
|
+
labelFn: {
|
|
68
|
+
toBeTypes: ['Function'],
|
|
69
|
+
},
|
|
70
|
+
labelColorType: {
|
|
71
|
+
toBeOption: 'ColorType'
|
|
72
|
+
},
|
|
73
|
+
arcScaleType: {
|
|
74
|
+
toBe: '"area" | "radius"',
|
|
75
|
+
test: (value: any) => value === 'area' || value === 'radius'
|
|
76
|
+
},
|
|
77
|
+
})
|
|
78
|
+
return result
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
53
82
|
function makeRenderData ({ pieData, labelCentroid, arcScaleType, maxValue, axisWidth, outerRadius, lineStartCentroid, fullParams }: {
|
|
54
83
|
pieData: PieDatum[]
|
|
55
84
|
// arc: d3.Arc<any, d3.DefaultArcObject>
|
|
@@ -512,7 +541,7 @@ function createEachPieLabel (pluginName: string, context: {
|
|
|
512
541
|
}
|
|
513
542
|
|
|
514
543
|
|
|
515
|
-
export const RoseLabels = defineSeriesPlugin(
|
|
544
|
+
export const RoseLabels = defineSeriesPlugin(pluginConfig)(({ selection, observer, subject }) => {
|
|
516
545
|
|
|
517
546
|
const destroy$ = new Subject()
|
|
518
547
|
|
|
@@ -6,14 +6,51 @@ import {
|
|
|
6
6
|
takeUntil,
|
|
7
7
|
Observable,
|
|
8
8
|
Subject } from 'rxjs'
|
|
9
|
+
import type { DefinePluginConfig } from '../../../lib/core-types'
|
|
9
10
|
import {
|
|
10
|
-
defineSeriesPlugin } from '
|
|
11
|
+
defineSeriesPlugin } from '../../../lib/core'
|
|
11
12
|
import { DEFAULT_SERIES_LEGEND_PARAMS } from '../defaults'
|
|
12
13
|
import { createBaseLegend } from '../../base/BaseLegend'
|
|
14
|
+
import { LAYER_INDEX_OF_INFO } from '../../const'
|
|
13
15
|
|
|
14
16
|
const pluginName = 'SeriesLegend'
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_SERIES_LEGEND_PARAMS> = {
|
|
19
|
+
name: pluginName,
|
|
20
|
+
defaultParams: DEFAULT_SERIES_LEGEND_PARAMS,
|
|
21
|
+
layerIndex: LAYER_INDEX_OF_INFO,
|
|
22
|
+
validator: (params, { validateColumns }) => {
|
|
23
|
+
const result = validateColumns(params, {
|
|
24
|
+
padding: {
|
|
25
|
+
toBeTypes: ['number']
|
|
26
|
+
},
|
|
27
|
+
backgroundFill: {
|
|
28
|
+
toBeOption: 'ColorType',
|
|
29
|
+
},
|
|
30
|
+
backgroundStroke: {
|
|
31
|
+
toBeOption: 'ColorType',
|
|
32
|
+
},
|
|
33
|
+
gap: {
|
|
34
|
+
toBeTypes: ['number']
|
|
35
|
+
},
|
|
36
|
+
listRectWidth: {
|
|
37
|
+
toBeTypes: ['number']
|
|
38
|
+
},
|
|
39
|
+
listRectHeight: {
|
|
40
|
+
toBeTypes: ['number']
|
|
41
|
+
},
|
|
42
|
+
listRectRadius: {
|
|
43
|
+
toBeTypes: ['number']
|
|
44
|
+
},
|
|
45
|
+
textColorType: {
|
|
46
|
+
toBeOption: 'ColorType',
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
return result
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const SeriesLegend = defineSeriesPlugin(pluginConfig)(({ selection, rootSelection, observer, subject }) => {
|
|
17
54
|
|
|
18
55
|
const destroy$ = new Subject()
|
|
19
56
|
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
distinctUntilChanged
|
|
15
15
|
} from 'rxjs'
|
|
16
16
|
import type {
|
|
17
|
-
SeriesContainerPosition } from '
|
|
17
|
+
SeriesContainerPosition } from '../../lib/core-types'
|
|
18
18
|
import { getClassName, getUniID } from '../utils/orbchartsUtils'
|
|
19
19
|
|
|
20
20
|
function createSeriesSelection ({ selection, pluginName, separateSeries$, seriesLabels$ }: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as d3 from 'd3'
|
|
2
|
-
import type { ComputedDataSeries, ComputedDatumSeries, EventName, EventSeries, HighlightTarget } from '
|
|
2
|
+
import type { ComputedDataSeries, ComputedDatumSeries, EventName, EventSeries, HighlightTarget } from '../../lib/core-types'
|
|
3
3
|
// import type { D3PieDatum, PieDatum } from '../types'
|
|
4
4
|
|
|
5
5
|
// 由d3.pie()建出來的資料格式
|
package/src/series/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComputedDatumSeries, EventSeries, EventName, ColorType } from '
|
|
1
|
+
import type { ComputedDatumSeries, EventSeries, EventName, ColorType } from '../../lib/core-types'
|
|
2
2
|
// import type { BaseLegendParams } from '../base/BaseLegend'
|
|
3
3
|
|
|
4
4
|
export type ArcScaleType = 'area' | 'radius'
|
|
@@ -6,14 +6,51 @@ import {
|
|
|
6
6
|
takeUntil,
|
|
7
7
|
Observable,
|
|
8
8
|
Subject } from 'rxjs'
|
|
9
|
+
import type { DefinePluginConfig } from '../../../lib/core-types'
|
|
9
10
|
import {
|
|
10
|
-
defineTreePlugin } from '
|
|
11
|
+
defineTreePlugin } from '../../../lib/core'
|
|
11
12
|
import { DEFAULT_TREE_LEGEND_PARAMS } from '../defaults'
|
|
12
13
|
import { createBaseLegend } from '../../base/BaseLegend'
|
|
14
|
+
import { LAYER_INDEX_OF_INFO } from '../../const'
|
|
13
15
|
|
|
14
16
|
const pluginName = 'TreeLegend'
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_TREE_LEGEND_PARAMS> = {
|
|
19
|
+
name: pluginName,
|
|
20
|
+
defaultParams: DEFAULT_TREE_LEGEND_PARAMS,
|
|
21
|
+
layerIndex: LAYER_INDEX_OF_INFO,
|
|
22
|
+
validator: (params, { validateColumns }) => {
|
|
23
|
+
const result = validateColumns(params, {
|
|
24
|
+
padding: {
|
|
25
|
+
toBeTypes: ['number']
|
|
26
|
+
},
|
|
27
|
+
backgroundFill: {
|
|
28
|
+
toBeOption: 'ColorType',
|
|
29
|
+
},
|
|
30
|
+
backgroundStroke: {
|
|
31
|
+
toBeOption: 'ColorType',
|
|
32
|
+
},
|
|
33
|
+
gap: {
|
|
34
|
+
toBeTypes: ['number']
|
|
35
|
+
},
|
|
36
|
+
listRectWidth: {
|
|
37
|
+
toBeTypes: ['number']
|
|
38
|
+
},
|
|
39
|
+
listRectHeight: {
|
|
40
|
+
toBeTypes: ['number']
|
|
41
|
+
},
|
|
42
|
+
listRectRadius: {
|
|
43
|
+
toBeTypes: ['number']
|
|
44
|
+
},
|
|
45
|
+
textColorType: {
|
|
46
|
+
toBeOption: 'ColorType',
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
return result
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const TreeLegend = defineTreePlugin(pluginConfig)(({ selection, rootSelection, observer, subject }) => {
|
|
17
54
|
|
|
18
55
|
const destroy$ = new Subject()
|
|
19
56
|
|
|
@@ -9,17 +9,45 @@ import {
|
|
|
9
9
|
combineLatest,
|
|
10
10
|
debounceTime,
|
|
11
11
|
distinctUntilChanged } from 'rxjs'
|
|
12
|
+
import type { DefinePluginConfig } from '../../../lib/core-types'
|
|
12
13
|
import {
|
|
13
|
-
defineTreePlugin } from '
|
|
14
|
-
import type { Layout, ComputedDataTree, DataFormatterTree, ChartParams } from '
|
|
14
|
+
defineTreePlugin } from '../../../lib/core'
|
|
15
|
+
import type { Layout, ComputedDataTree, DataFormatterTree, ChartParams } from '../../../lib/core-types'
|
|
15
16
|
import type { TreeMapParams } from '../types'
|
|
16
17
|
import { DEFAULT_TREE_MAP_PARAMS } from '../defaults'
|
|
17
18
|
import { getClassName, getColor } from '../../utils/orbchartsUtils'
|
|
19
|
+
import { LAYER_INDEX_OF_GRAPHIC } from '../../const'
|
|
18
20
|
|
|
19
21
|
const pluginName = 'TreeMap'
|
|
20
22
|
const treeClassName = getClassName(pluginName, 'tree')
|
|
21
23
|
const tileClassName = getClassName(pluginName, 'tile')
|
|
22
24
|
|
|
25
|
+
const pluginConfig: DefinePluginConfig<typeof pluginName, typeof DEFAULT_TREE_MAP_PARAMS> = {
|
|
26
|
+
name: pluginName,
|
|
27
|
+
defaultParams: DEFAULT_TREE_MAP_PARAMS,
|
|
28
|
+
layerIndex: LAYER_INDEX_OF_GRAPHIC,
|
|
29
|
+
validator: (params, { validateColumns }) => {
|
|
30
|
+
const result = validateColumns(params, {
|
|
31
|
+
paddingInner: {
|
|
32
|
+
toBeTypes: ['number']
|
|
33
|
+
},
|
|
34
|
+
paddingOuter: {
|
|
35
|
+
toBeTypes: ['number']
|
|
36
|
+
},
|
|
37
|
+
labelColorType: {
|
|
38
|
+
toBeOption: 'ColorType'
|
|
39
|
+
},
|
|
40
|
+
squarifyRatio: {
|
|
41
|
+
toBeTypes: ['number']
|
|
42
|
+
},
|
|
43
|
+
sort: {
|
|
44
|
+
toBeTypes: ['Function']
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
return result
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
23
51
|
function renderTree ({ selection, treeData, fullParams, fullChartParams, textSizePx }: {
|
|
24
52
|
selection: d3.Selection<any, any, any, any>
|
|
25
53
|
treeData: d3.HierarchyRectangularNode<ComputedDataTree>[]
|
|
@@ -144,7 +172,7 @@ function highlight ({ selection, ids, fullChartParams }: {
|
|
|
144
172
|
})
|
|
145
173
|
}
|
|
146
174
|
|
|
147
|
-
export const TreeMap = defineTreePlugin(
|
|
175
|
+
export const TreeMap = defineTreePlugin(pluginConfig)(({ selection, name, subject, observer }) => {
|
|
148
176
|
const destroy$ = new Subject()
|
|
149
177
|
|
|
150
178
|
const treeData$ = combineLatest({
|
package/src/tree/types.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
ChartParams,
|
|
5
5
|
ComputedDatumBase,
|
|
6
6
|
ComputedDatumSeriesValue,
|
|
7
|
-
ComputedDatumCategoryValue } from '
|
|
7
|
+
ComputedDatumCategoryValue } from '../../lib/core-types'
|
|
8
8
|
import { getMinAndMax } from './commonUtils'
|
|
9
9
|
|
|
10
10
|
// 取得最小及最大值 - datum格式陣列資料
|