@orbcharts/plugins-basic 3.0.0-alpha.43 → 3.0.0-alpha.44
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +200 -200
- package/dist/orbcharts-plugins-basic.es.js +5611 -5571
- package/dist/orbcharts-plugins-basic.umd.js +7 -7
- package/dist/src/base/BaseLegend.d.ts +1 -0
- package/package.json +42 -42
- package/src/base/BaseBarStack.ts +881 -881
- package/src/base/BaseBars.ts +750 -750
- package/src/base/BaseBarsTriangle.ts +659 -659
- package/src/base/BaseDots.ts +639 -639
- package/src/base/BaseGroupAxis.ts +496 -496
- package/src/base/BaseLegend.ts +641 -636
- package/src/base/BaseLineAreas.ts +621 -621
- package/src/base/BaseLines.ts +692 -692
- package/src/base/BaseValueAxis.ts +479 -479
- package/src/base/types.ts +2 -2
- package/src/grid/defaults.ts +121 -121
- package/src/grid/gridObservables.ts +263 -263
- package/src/grid/index.ts +15 -15
- package/src/grid/plugins/BarStack.ts +37 -37
- package/src/grid/plugins/Bars.ts +37 -37
- package/src/grid/plugins/BarsDiverging.ts +39 -39
- package/src/grid/plugins/BarsTriangle.ts +34 -34
- package/src/grid/plugins/Dots.ts +35 -35
- package/src/grid/plugins/GridLegend.ts +59 -58
- package/src/grid/plugins/GroupAux.ts +646 -643
- package/src/grid/plugins/GroupAxis.ts +30 -30
- package/src/grid/plugins/LineAreas.ts +36 -36
- package/src/grid/plugins/Lines.ts +35 -35
- package/src/grid/plugins/ScalingArea.ts +174 -174
- package/src/grid/plugins/ValueAxis.ts +31 -31
- package/src/grid/plugins/ValueStackAxis.ts +70 -70
- package/src/grid/types.ts +120 -120
- package/src/index.ts +9 -9
- package/src/multiGrid/defaults.ts +147 -147
- package/src/multiGrid/index.ts +11 -11
- package/src/multiGrid/multiGridObservables.ts +289 -289
- package/src/multiGrid/plugins/MultiBarStack.ts +60 -60
- package/src/multiGrid/plugins/MultiBars.ts +59 -59
- package/src/multiGrid/plugins/MultiBarsTriangle.ts +58 -58
- package/src/multiGrid/plugins/MultiDots.ts +58 -58
- package/src/multiGrid/plugins/MultiGridLegend.ts +89 -88
- package/src/multiGrid/plugins/MultiGroupAxis.ts +53 -53
- package/src/multiGrid/plugins/MultiLineAreas.ts +59 -59
- package/src/multiGrid/plugins/MultiLines.ts +58 -58
- package/src/multiGrid/plugins/MultiValueAxis.ts +53 -53
- package/src/multiGrid/plugins/OverlappingValueAxes.ts +164 -164
- package/src/multiGrid/types.ts +67 -67
- package/src/noneData/defaults.ts +61 -61
- package/src/noneData/index.ts +3 -3
- package/src/noneData/plugins/Container.ts +10 -10
- package/src/noneData/plugins/Tooltip.ts +310 -304
- package/src/noneData/types.ts +26 -26
- package/src/series/defaults.ts +99 -99
- package/src/series/index.ts +6 -6
- package/src/series/plugins/Bubbles.ts +551 -551
- package/src/series/plugins/Pie.ts +600 -600
- package/src/series/plugins/PieEventTexts.ts +194 -194
- package/src/series/plugins/PieLabels.ts +288 -288
- package/src/series/plugins/SeriesLegend.ts +59 -58
- package/src/series/seriesUtils.ts +50 -50
- package/src/series/types.ts +67 -67
- package/src/tree/defaults.ts +22 -22
- package/src/tree/index.ts +3 -3
- package/src/tree/plugins/TreeLegend.ts +59 -58
- package/src/tree/plugins/TreeMap.ts +305 -302
- package/src/tree/types.ts +23 -23
- package/src/utils/commonUtils.ts +21 -21
- package/src/utils/d3Graphics.ts +124 -124
- package/src/utils/d3Utils.ts +73 -73
- package/src/utils/observables.ts +14 -14
- package/src/utils/orbchartsUtils.ts +100 -100
- package/tsconfig.dev.json +16 -16
- package/tsconfig.json +13 -13
- package/tsconfig.prod.json +13 -13
- package/vite.config.js +49 -49
@@ -1,100 +1,100 @@
|
|
1
|
-
import type {
|
2
|
-
AxisPosition,
|
3
|
-
ColorType,
|
4
|
-
ChartParams,
|
5
|
-
ComputedDatumBase,
|
6
|
-
ComputedDatumSeriesValue,
|
7
|
-
ComputedDatumCategoryValue } from '@orbcharts/core'
|
8
|
-
import { getMinAndMax } from './commonUtils'
|
9
|
-
|
10
|
-
// 取得最小及最大值 - datum格式陣列資料
|
11
|
-
export function getMinAndMaxValue (data: ComputedDatumBase[]): [number, number] {
|
12
|
-
const arr = data
|
13
|
-
.filter(d => d.value != null && d.visible != false)
|
14
|
-
.map(d => d.value as number)
|
15
|
-
return getMinAndMax(arr)
|
16
|
-
}
|
17
|
-
|
18
|
-
// 取得colorType顏色
|
19
|
-
export function getColor (colorType: ColorType, fullChartParams: ChartParams) {
|
20
|
-
const colors = fullChartParams.colors[fullChartParams.colorScheme]
|
21
|
-
// 對應series資料中第1個顏色
|
22
|
-
if (colorType === 'series') {
|
23
|
-
return colors.series[0]
|
24
|
-
}
|
25
|
-
// 對應colorType設定的顏色
|
26
|
-
// return colors[colorType] != null
|
27
|
-
// ? colors[colorType]
|
28
|
-
// : colors.primary
|
29
|
-
return colorType == 'none'
|
30
|
-
? 'none'
|
31
|
-
: colors[colorType] != undefined
|
32
|
-
? colors[colorType]
|
33
|
-
: colors.primary // 如果比對不到
|
34
|
-
}
|
35
|
-
|
36
|
-
export function getSeriesValueColor () {
|
37
|
-
|
38
|
-
}
|
39
|
-
|
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@ 待重構完後刪除
|
53
|
-
export function getDatumColor ({ datum, colorType, fullChartParams }: { datum: ComputedDatumBase, colorType: ColorType, fullChartParams: ChartParams }) {
|
54
|
-
// 對應series資料中的顏色
|
55
|
-
if (colorType === 'series') {
|
56
|
-
if ((datum as unknown as ComputedDatumSeriesValue).color) {
|
57
|
-
return (datum as unknown as ComputedDatumSeriesValue).color
|
58
|
-
} else {
|
59
|
-
// 非series類型的資料則回傳陣列中第1個顏色
|
60
|
-
return fullChartParams.colors[fullChartParams.colorScheme].series[0]
|
61
|
-
}
|
62
|
-
}
|
63
|
-
// 對應colorType設定的顏色
|
64
|
-
return colorType == 'none'
|
65
|
-
? 'none'
|
66
|
-
: fullChartParams.colors[fullChartParams.colorScheme][colorType] != undefined
|
67
|
-
? fullChartParams.colors[fullChartParams.colorScheme][colorType]
|
68
|
-
: fullChartParams.colors[fullChartParams.colorScheme].primary
|
69
|
-
}
|
70
|
-
|
71
|
-
export function getClassName (pluginName: string, elementName: string, modifier?: string) {
|
72
|
-
const modifierText = modifier ? `--${modifier}` : ''
|
73
|
-
return `orbcharts-${pluginName}__${elementName}${modifierText}`
|
74
|
-
}
|
75
|
-
|
76
|
-
export function getUniID (pluginName: string, elementName: string) {
|
77
|
-
const textLength = 5
|
78
|
-
// 英文+數字
|
79
|
-
const randomText: string = Math.random().toString(36).substr(2, textLength)
|
80
|
-
|
81
|
-
return getClassName(pluginName, elementName, randomText)
|
82
|
-
}
|
83
|
-
|
84
|
-
|
85
|
-
export function calcAxesSize ({ xAxisPosition, yAxisPosition, width, height }: {
|
86
|
-
xAxisPosition: AxisPosition
|
87
|
-
yAxisPosition: AxisPosition
|
88
|
-
width: number
|
89
|
-
height: number
|
90
|
-
}) {
|
91
|
-
if ((xAxisPosition === 'bottom' || xAxisPosition === 'top') && (yAxisPosition === 'left' || yAxisPosition === 'right')) {
|
92
|
-
return { width, height }
|
93
|
-
} else if ((xAxisPosition === 'left' || xAxisPosition === 'right') && (yAxisPosition === 'bottom' || yAxisPosition === 'top')) {
|
94
|
-
return {
|
95
|
-
width: height,
|
96
|
-
height: width
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
100
|
-
|
1
|
+
import type {
|
2
|
+
AxisPosition,
|
3
|
+
ColorType,
|
4
|
+
ChartParams,
|
5
|
+
ComputedDatumBase,
|
6
|
+
ComputedDatumSeriesValue,
|
7
|
+
ComputedDatumCategoryValue } from '@orbcharts/core'
|
8
|
+
import { getMinAndMax } from './commonUtils'
|
9
|
+
|
10
|
+
// 取得最小及最大值 - datum格式陣列資料
|
11
|
+
export function getMinAndMaxValue (data: ComputedDatumBase[]): [number, number] {
|
12
|
+
const arr = data
|
13
|
+
.filter(d => d.value != null && d.visible != false)
|
14
|
+
.map(d => d.value as number)
|
15
|
+
return getMinAndMax(arr)
|
16
|
+
}
|
17
|
+
|
18
|
+
// 取得colorType顏色
|
19
|
+
export function getColor (colorType: ColorType, fullChartParams: ChartParams) {
|
20
|
+
const colors = fullChartParams.colors[fullChartParams.colorScheme]
|
21
|
+
// 對應series資料中第1個顏色
|
22
|
+
if (colorType === 'series') {
|
23
|
+
return colors.series[0]
|
24
|
+
}
|
25
|
+
// 對應colorType設定的顏色
|
26
|
+
// return colors[colorType] != null
|
27
|
+
// ? colors[colorType]
|
28
|
+
// : colors.primary
|
29
|
+
return colorType == 'none'
|
30
|
+
? 'none'
|
31
|
+
: colors[colorType] != undefined
|
32
|
+
? colors[colorType]
|
33
|
+
: colors.primary // 如果比對不到
|
34
|
+
}
|
35
|
+
|
36
|
+
export function getSeriesValueColor () {
|
37
|
+
|
38
|
+
}
|
39
|
+
|
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@ 待重構完後刪除
|
53
|
+
export function getDatumColor ({ datum, colorType, fullChartParams }: { datum: ComputedDatumBase, colorType: ColorType, fullChartParams: ChartParams }) {
|
54
|
+
// 對應series資料中的顏色
|
55
|
+
if (colorType === 'series') {
|
56
|
+
if ((datum as unknown as ComputedDatumSeriesValue).color) {
|
57
|
+
return (datum as unknown as ComputedDatumSeriesValue).color
|
58
|
+
} else {
|
59
|
+
// 非series類型的資料則回傳陣列中第1個顏色
|
60
|
+
return fullChartParams.colors[fullChartParams.colorScheme].series[0]
|
61
|
+
}
|
62
|
+
}
|
63
|
+
// 對應colorType設定的顏色
|
64
|
+
return colorType == 'none'
|
65
|
+
? 'none'
|
66
|
+
: fullChartParams.colors[fullChartParams.colorScheme][colorType] != undefined
|
67
|
+
? fullChartParams.colors[fullChartParams.colorScheme][colorType]
|
68
|
+
: fullChartParams.colors[fullChartParams.colorScheme].primary
|
69
|
+
}
|
70
|
+
|
71
|
+
export function getClassName (pluginName: string, elementName: string, modifier?: string) {
|
72
|
+
const modifierText = modifier ? `--${modifier}` : ''
|
73
|
+
return `orbcharts-${pluginName}__${elementName}${modifierText}`
|
74
|
+
}
|
75
|
+
|
76
|
+
export function getUniID (pluginName: string, elementName: string) {
|
77
|
+
const textLength = 5
|
78
|
+
// 英文+數字
|
79
|
+
const randomText: string = Math.random().toString(36).substr(2, textLength)
|
80
|
+
|
81
|
+
return getClassName(pluginName, elementName, randomText)
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
export function calcAxesSize ({ xAxisPosition, yAxisPosition, width, height }: {
|
86
|
+
xAxisPosition: AxisPosition
|
87
|
+
yAxisPosition: AxisPosition
|
88
|
+
width: number
|
89
|
+
height: number
|
90
|
+
}) {
|
91
|
+
if ((xAxisPosition === 'bottom' || xAxisPosition === 'top') && (yAxisPosition === 'left' || yAxisPosition === 'right')) {
|
92
|
+
return { width, height }
|
93
|
+
} else if ((xAxisPosition === 'left' || xAxisPosition === 'right') && (yAxisPosition === 'bottom' || yAxisPosition === 'top')) {
|
94
|
+
return {
|
95
|
+
width: height,
|
96
|
+
height: width
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
package/tsconfig.dev.json
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"outDir": "./dist/",
|
4
|
-
"sourceMap": true,
|
5
|
-
"noImplicitAny": true,
|
6
|
-
"module": "es6",
|
7
|
-
"target": "es5",
|
8
|
-
"jsx": "react",
|
9
|
-
"allowJs": true,
|
10
|
-
"moduleResolution": "node",
|
11
|
-
"allowSyntheticDefaultImports" : true,
|
12
|
-
"esModuleInterop" : true,
|
13
|
-
"paths":{
|
14
|
-
"@orbcharts/core": ["./../orbcharts-core/src"]
|
15
|
-
}
|
16
|
-
}
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"outDir": "./dist/",
|
4
|
+
"sourceMap": true,
|
5
|
+
"noImplicitAny": true,
|
6
|
+
"module": "es6",
|
7
|
+
"target": "es5",
|
8
|
+
"jsx": "react",
|
9
|
+
"allowJs": true,
|
10
|
+
"moduleResolution": "node",
|
11
|
+
"allowSyntheticDefaultImports" : true,
|
12
|
+
"esModuleInterop" : true,
|
13
|
+
"paths":{
|
14
|
+
"@orbcharts/core": ["./../orbcharts-core/src"]
|
15
|
+
}
|
16
|
+
}
|
17
17
|
}
|
package/tsconfig.json
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"outDir": "./dist/",
|
4
|
-
"sourceMap": true,
|
5
|
-
"noImplicitAny": true,
|
6
|
-
"module": "es6",
|
7
|
-
"target": "es5",
|
8
|
-
"jsx": "react",
|
9
|
-
"allowJs": true,
|
10
|
-
"moduleResolution": "node",
|
11
|
-
"allowSyntheticDefaultImports" : true,
|
12
|
-
"esModuleInterop" : true,
|
13
|
-
}
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"outDir": "./dist/",
|
4
|
+
"sourceMap": true,
|
5
|
+
"noImplicitAny": true,
|
6
|
+
"module": "es6",
|
7
|
+
"target": "es5",
|
8
|
+
"jsx": "react",
|
9
|
+
"allowJs": true,
|
10
|
+
"moduleResolution": "node",
|
11
|
+
"allowSyntheticDefaultImports" : true,
|
12
|
+
"esModuleInterop" : true,
|
13
|
+
}
|
14
14
|
}
|
package/tsconfig.prod.json
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"outDir": "./dist/",
|
4
|
-
"sourceMap": true,
|
5
|
-
"noImplicitAny": true,
|
6
|
-
"module": "es6",
|
7
|
-
"target": "es5",
|
8
|
-
"jsx": "react",
|
9
|
-
"allowJs": true,
|
10
|
-
"moduleResolution": "node",
|
11
|
-
"allowSyntheticDefaultImports" : true,
|
12
|
-
"esModuleInterop" : true
|
13
|
-
}
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"outDir": "./dist/",
|
4
|
+
"sourceMap": true,
|
5
|
+
"noImplicitAny": true,
|
6
|
+
"module": "es6",
|
7
|
+
"target": "es5",
|
8
|
+
"jsx": "react",
|
9
|
+
"allowJs": true,
|
10
|
+
"moduleResolution": "node",
|
11
|
+
"allowSyntheticDefaultImports" : true,
|
12
|
+
"esModuleInterop" : true
|
13
|
+
}
|
14
14
|
}
|
package/vite.config.js
CHANGED
@@ -1,50 +1,50 @@
|
|
1
|
-
// import { fileURLToPath, URL } from 'node:url'
|
2
|
-
|
3
|
-
// import { resolve } from 'path'
|
4
|
-
import { defineConfig } from 'vite'
|
5
|
-
import dts from 'vite-plugin-dts'
|
6
|
-
|
7
|
-
const releaseConfig = {
|
8
|
-
plugins: [
|
9
|
-
dts({
|
10
|
-
insertTypesEntry: true
|
11
|
-
})
|
12
|
-
],
|
13
|
-
compilerOptions: {
|
14
|
-
composite: true
|
15
|
-
},
|
16
|
-
// resolve: {
|
17
|
-
// alias: {
|
18
|
-
// '@core': '@orbcharts/core'
|
19
|
-
// }
|
20
|
-
// },
|
21
|
-
build: {
|
22
|
-
lib: {
|
23
|
-
entry: "src/index.ts",
|
24
|
-
name: 'orbcharts-plugins-basic',
|
25
|
-
formats: ["es", "umd"],
|
26
|
-
fileName: format => `orbcharts-plugins-basic.${format}.js`
|
27
|
-
},
|
28
|
-
// rollupOptions: {
|
29
|
-
// input: {
|
30
|
-
// main: resolve(__dirname, "src/index.ts")
|
31
|
-
// },
|
32
|
-
// external: ['vue'],
|
33
|
-
// output: {
|
34
|
-
// assetFileNames: 'my-library.css',
|
35
|
-
// exports: "named",
|
36
|
-
// globals: {
|
37
|
-
// vue: 'Vue',
|
38
|
-
// },
|
39
|
-
// },
|
40
|
-
// },
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
export default defineConfig(({ command, mode }) => {
|
45
|
-
if (mode === 'release') {
|
46
|
-
return releaseConfig
|
47
|
-
} else {
|
48
|
-
return releaseConfig
|
49
|
-
}
|
1
|
+
// import { fileURLToPath, URL } from 'node:url'
|
2
|
+
|
3
|
+
// import { resolve } from 'path'
|
4
|
+
import { defineConfig } from 'vite'
|
5
|
+
import dts from 'vite-plugin-dts'
|
6
|
+
|
7
|
+
const releaseConfig = {
|
8
|
+
plugins: [
|
9
|
+
dts({
|
10
|
+
insertTypesEntry: true
|
11
|
+
})
|
12
|
+
],
|
13
|
+
compilerOptions: {
|
14
|
+
composite: true
|
15
|
+
},
|
16
|
+
// resolve: {
|
17
|
+
// alias: {
|
18
|
+
// '@core': '@orbcharts/core'
|
19
|
+
// }
|
20
|
+
// },
|
21
|
+
build: {
|
22
|
+
lib: {
|
23
|
+
entry: "src/index.ts",
|
24
|
+
name: 'orbcharts-plugins-basic',
|
25
|
+
formats: ["es", "umd"],
|
26
|
+
fileName: format => `orbcharts-plugins-basic.${format}.js`
|
27
|
+
},
|
28
|
+
// rollupOptions: {
|
29
|
+
// input: {
|
30
|
+
// main: resolve(__dirname, "src/index.ts")
|
31
|
+
// },
|
32
|
+
// external: ['vue'],
|
33
|
+
// output: {
|
34
|
+
// assetFileNames: 'my-library.css',
|
35
|
+
// exports: "named",
|
36
|
+
// globals: {
|
37
|
+
// vue: 'Vue',
|
38
|
+
// },
|
39
|
+
// },
|
40
|
+
// },
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
export default defineConfig(({ command, mode }) => {
|
45
|
+
if (mode === 'release') {
|
46
|
+
return releaseConfig
|
47
|
+
} else {
|
48
|
+
return releaseConfig
|
49
|
+
}
|
50
50
|
})
|