@orbcharts/plugins-basic 3.0.0-alpha.38 → 3.0.0-alpha.40
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/orbcharts-plugins-basic/src/base/BaseBarStack.d.ts +1 -1
- package/dist/orbcharts-plugins-basic/src/base/BaseBars.d.ts +1 -1
- package/dist/orbcharts-plugins-basic/src/base/BaseBarsTriangle.d.ts +1 -1
- package/dist/orbcharts-plugins-basic/src/base/BaseDots.d.ts +1 -1
- package/dist/orbcharts-plugins-basic/src/base/BaseLegend.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/base/BaseLineAreas.d.ts +30 -0
- package/dist/orbcharts-plugins-basic/src/base/BaseLines.d.ts +1 -1
- package/dist/orbcharts-plugins-basic/src/grid/defaults.d.ts +2 -1
- package/dist/orbcharts-plugins-basic/src/grid/gridObservables.d.ts +2 -2
- package/dist/orbcharts-plugins-basic/src/grid/index.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/grid/plugins/LineAreas.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/grid/types.d.ts +5 -0
- package/dist/orbcharts-plugins-basic/src/multiGrid/types.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/series/types.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/tree/types.d.ts +2 -2
- package/dist/orbcharts-plugins-basic/src/utils/orbchartsUtils.d.ts +7 -2
- package/dist/orbcharts-plugins-basic.es.js +7449 -7078
- package/dist/orbcharts-plugins-basic.umd.js +12 -9
- package/package.json +2 -2
- package/src/base/BaseBarStack.ts +7 -3
- package/src/base/BaseBars.ts +7 -3
- package/src/base/BaseBarsTriangle.ts +52 -135
- package/src/base/BaseDots.ts +7 -3
- package/src/base/BaseLegend.ts +16 -1
- package/src/base/BaseLineAreas.ts +625 -0
- package/src/base/BaseLines.ts +12 -12
- package/src/base/BaseValueAxis.ts +0 -1
- package/src/grid/defaults.ts +7 -0
- package/src/grid/gridObservables.ts +5 -5
- package/src/grid/index.ts +1 -0
- package/src/grid/plugins/BarStack.ts +1 -1
- package/src/grid/plugins/Bars.ts +1 -1
- package/src/grid/plugins/BarsDiverging.ts +1 -1
- package/src/grid/plugins/BarsTriangle.ts +1 -1
- package/src/grid/plugins/Dots.ts +1 -1
- package/src/grid/plugins/GroupAux.ts +8 -0
- package/src/grid/plugins/LineAreas.ts +37 -0
- package/src/grid/plugins/Lines.ts +1 -1
- package/src/grid/plugins/ScalingArea.ts +11 -7
- package/src/grid/types.ts +6 -1
- package/src/multiGrid/defaults.ts +2 -1
- package/src/multiGrid/multiGridObservables.ts +6 -6
- package/src/multiGrid/plugins/MultiBarStack.ts +1 -1
- package/src/multiGrid/plugins/MultiBars.ts +1 -1
- package/src/multiGrid/plugins/MultiBarsTriangle.ts +1 -1
- package/src/multiGrid/plugins/MultiDots.ts +1 -1
- package/src/multiGrid/plugins/MultiLines.ts +1 -1
- package/src/multiGrid/types.ts +1 -0
- package/src/noneData/defaults.ts +21 -7
- package/src/series/defaults.ts +1 -0
- package/src/series/types.ts +1 -0
- package/src/tree/defaults.ts +1 -0
- package/src/tree/plugins/TreeMap.ts +7 -5
- package/src/tree/types.ts +2 -2
- package/src/utils/orbchartsUtils.ts +22 -8
- package/tsconfig.json +4 -1
@@ -11,13 +11,14 @@ import {
|
|
11
11
|
distinctUntilChanged } from 'rxjs'
|
12
12
|
import {
|
13
13
|
defineTreePlugin } from '@orbcharts/core'
|
14
|
-
import type { Layout, ComputedDataTree, DataFormatterTree, ChartParams } from '
|
14
|
+
import type { Layout, ComputedDataTree, DataFormatterTree, ChartParams } from '@orbcharts/core'
|
15
15
|
import type { TreeMapParams } from '../types'
|
16
16
|
import { DEFAULT_TREE_MAP_PARAMS } from '../defaults'
|
17
17
|
import { getClassName, getColor } from '../../utils/orbchartsUtils'
|
18
18
|
|
19
19
|
const pluginName = 'TreeMap'
|
20
20
|
const treeClassName = getClassName(pluginName, 'tree')
|
21
|
+
const tileClassName = getClassName(pluginName, 'tile')
|
21
22
|
|
22
23
|
function renderTree ({ selection, treeData, fullParams, fullChartParams }: {
|
23
24
|
selection: d3.Selection<any, any, any, any>
|
@@ -40,11 +41,12 @@ function renderTree ({ selection, treeData, fullParams, fullChartParams }: {
|
|
40
41
|
const eachCell = d3.select(nodes[i])
|
41
42
|
|
42
43
|
const tile = eachCell
|
43
|
-
.selectAll<SVGRectElement, d3.HierarchyRectangularNode<ComputedDataTree>>(
|
44
|
+
.selectAll<SVGRectElement, d3.HierarchyRectangularNode<ComputedDataTree>>(`rect.${tileClassName}`)
|
44
45
|
.data([d], d => d.data.id)
|
45
46
|
.join('rect')
|
46
47
|
.attr("id", d => d.data.id)
|
47
|
-
.attr("class",
|
48
|
+
.attr("class", tileClassName)
|
49
|
+
.attr('cursor', 'pointer')
|
48
50
|
.attr("width", (d) => d.x1 - d.x0)
|
49
51
|
.attr("height", (d) => d.y1 - d.y0)
|
50
52
|
.attr('fill', d => d.data.color)
|
@@ -80,7 +82,7 @@ function renderTree ({ selection, treeData, fullParams, fullChartParams }: {
|
|
80
82
|
let tspan = textElement
|
81
83
|
.text(null)
|
82
84
|
.append("tspan")
|
83
|
-
.attr('cursor', '
|
85
|
+
.attr('cursor', 'pointer')
|
84
86
|
.attr('fill', getColor(fullParams.labelColorType, fullChartParams))
|
85
87
|
.attr('font-size', fullChartParams.styles.textSize)
|
86
88
|
.attr("x", x)
|
@@ -96,7 +98,7 @@ function renderTree ({ selection, treeData, fullParams, fullChartParams }: {
|
|
96
98
|
dy += lineHeight
|
97
99
|
tspan = textElement
|
98
100
|
.append("tspan")
|
99
|
-
.attr('cursor', '
|
101
|
+
.attr('cursor', 'pointer')
|
100
102
|
.attr('fill', getColor(fullParams.labelColorType, fullChartParams))
|
101
103
|
.attr('font-size', fullChartParams.styles.textSize)
|
102
104
|
.attr("x", x)
|
package/src/tree/types.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import type { ColorType } from '@orbcharts/core'
|
2
|
-
import type { ComputedDataTree } from '../../../orbcharts-core/src'
|
1
|
+
import type { ColorType, ComputedDataTree } from '@orbcharts/core'
|
3
2
|
|
4
3
|
export interface TreeMapParams {
|
5
4
|
paddingInner: number
|
@@ -19,5 +18,6 @@ export interface TreeLegendParams {
|
|
19
18
|
listRectWidth: number
|
20
19
|
listRectHeight: number
|
21
20
|
listRectRadius: number
|
21
|
+
textColorType: ColorType
|
22
22
|
}
|
23
23
|
|
@@ -1,4 +1,10 @@
|
|
1
|
-
import type {
|
1
|
+
import type {
|
2
|
+
AxisPosition,
|
3
|
+
ColorType,
|
4
|
+
ChartParams,
|
5
|
+
ComputedDatumBase,
|
6
|
+
ComputedDatumSeriesValue,
|
7
|
+
ComputedDatumCategoryValue } from '@orbcharts/core'
|
2
8
|
import { getMinAndMax } from './commonUtils'
|
3
9
|
|
4
10
|
// 取得最小及最大值 - datum格式陣列資料
|
@@ -27,15 +33,23 @@ export function getColor (colorType: ColorType, fullChartParams: ChartParams) {
|
|
27
33
|
: colors.primary // 如果比對不到
|
28
34
|
}
|
29
35
|
|
30
|
-
|
31
|
-
|
32
|
-
const colorIndex = seriesIndex < fullChartParams.colors[fullChartParams.colorScheme].series.length
|
33
|
-
? seriesIndex
|
34
|
-
: seriesIndex % fullChartParams.colors[fullChartParams.colorScheme].series.length
|
35
|
-
return fullChartParams.colors[fullChartParams.colorScheme].series[colorIndex]
|
36
|
+
export function getSeriesValueColor () {
|
37
|
+
|
36
38
|
}
|
37
39
|
|
38
|
-
|
40
|
+
export function getCategoryValueColor ({ datum, colorType, fullChartParams }: { datum: ComputedDatumCategoryValue, colorType: ColorType, fullChartParams: ChartParams }) {
|
41
|
+
|
42
|
+
}
|
43
|
+
|
44
|
+
// // 取得Series顏色 @Q@ 待重構完後刪除
|
45
|
+
// export function getSeriesColor (seriesIndex: number, fullChartParams: ChartParams) {
|
46
|
+
// const colorIndex = seriesIndex < fullChartParams.colors[fullChartParams.colorScheme].series.length
|
47
|
+
// ? seriesIndex
|
48
|
+
// : seriesIndex % fullChartParams.colors[fullChartParams.colorScheme].series.length
|
49
|
+
// return fullChartParams.colors[fullChartParams.colorScheme].series[colorIndex]
|
50
|
+
// }
|
51
|
+
|
52
|
+
// 取得Datum顏色 @Q@ 待重構完後刪除
|
39
53
|
export function getDatumColor ({ datum, colorType, fullChartParams }: { datum: ComputedDatumBase, colorType: ColorType, fullChartParams: ChartParams }) {
|
40
54
|
// 對應series資料中的顏色
|
41
55
|
if (colorType === 'series') {
|