@orbcharts/plugins-basic 3.0.0-alpha.75 → 3.0.0-alpha.76

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.
Files changed (81) hide show
  1. package/LICENSE +200 -200
  2. package/dist/orbcharts-plugins-basic.es.js +3461 -3468
  3. package/dist/orbcharts-plugins-basic.umd.js +17 -17
  4. package/lib/core-types.ts +7 -7
  5. package/lib/core.ts +6 -6
  6. package/package.json +43 -43
  7. package/src/base/BaseBarStack.ts +779 -779
  8. package/src/base/BaseBars.ts +764 -764
  9. package/src/base/BaseBarsTriangle.ts +672 -672
  10. package/src/base/BaseDots.ts +513 -513
  11. package/src/base/BaseGroupAxis.ts +678 -678
  12. package/src/base/BaseLegend.ts +642 -642
  13. package/src/base/BaseLineAreas.ts +627 -627
  14. package/src/base/BaseLines.ts +704 -704
  15. package/src/base/BaseValueAxis.ts +578 -578
  16. package/src/base/types.ts +2 -2
  17. package/src/const.ts +30 -30
  18. package/src/grid/defaults.ts +128 -128
  19. package/src/grid/gridObservables.ts +545 -545
  20. package/src/grid/index.ts +15 -15
  21. package/src/grid/plugins/BarStack.ts +64 -64
  22. package/src/grid/plugins/Bars.ts +69 -69
  23. package/src/grid/plugins/BarsPN.ts +66 -66
  24. package/src/grid/plugins/BarsTriangle.ts +73 -73
  25. package/src/grid/plugins/Dots.ts +68 -68
  26. package/src/grid/plugins/GridLegend.ts +96 -96
  27. package/src/grid/plugins/GroupAux.ts +1098 -1098
  28. package/src/grid/plugins/GroupAxis.ts +97 -97
  29. package/src/grid/plugins/LineAreas.ts +65 -65
  30. package/src/grid/plugins/Lines.ts +59 -59
  31. package/src/grid/plugins/ScalingArea.ts +218 -218
  32. package/src/grid/plugins/ValueAxis.ts +93 -93
  33. package/src/grid/plugins/ValueStackAxis.ts +95 -95
  34. package/src/grid/types.ts +123 -123
  35. package/src/index.ts +9 -9
  36. package/src/multiGrid/defaults.ts +158 -158
  37. package/src/multiGrid/index.ts +13 -13
  38. package/src/multiGrid/multiGridObservables.ts +49 -49
  39. package/src/multiGrid/plugins/MultiBarStack.ts +106 -106
  40. package/src/multiGrid/plugins/MultiBars.ts +108 -108
  41. package/src/multiGrid/plugins/MultiBarsTriangle.ts +114 -114
  42. package/src/multiGrid/plugins/MultiDots.ts +102 -102
  43. package/src/multiGrid/plugins/MultiGridLegend.ts +148 -148
  44. package/src/multiGrid/plugins/MultiGroupAxis.ts +137 -137
  45. package/src/multiGrid/plugins/MultiLineAreas.ts +107 -107
  46. package/src/multiGrid/plugins/MultiLines.ts +101 -101
  47. package/src/multiGrid/plugins/MultiValueAxis.ts +133 -133
  48. package/src/multiGrid/plugins/MultiValueStackAxis.ts +133 -133
  49. package/src/multiGrid/plugins/OverlappingValueAxes.ts +299 -299
  50. package/src/multiGrid/plugins/OverlappingValueStackAxes.ts +298 -298
  51. package/src/multiGrid/types.ts +72 -72
  52. package/src/noneData/defaults.ts +102 -102
  53. package/src/noneData/index.ts +3 -3
  54. package/src/noneData/plugins/Container.ts +27 -27
  55. package/src/noneData/plugins/Tooltip.ts +373 -373
  56. package/src/noneData/types.ts +26 -26
  57. package/src/series/defaults.ts +149 -149
  58. package/src/series/index.ts +9 -9
  59. package/src/series/plugins/Bubbles.ts +603 -603
  60. package/src/series/plugins/Pie.ts +623 -623
  61. package/src/series/plugins/PieEventTexts.ts +283 -283
  62. package/src/series/plugins/PieLabels.ts +640 -640
  63. package/src/series/plugins/Rose.ts +516 -516
  64. package/src/series/plugins/RoseLabels.ts +600 -600
  65. package/src/series/plugins/SeriesLegend.ts +96 -96
  66. package/src/series/seriesObservables.ts +145 -145
  67. package/src/series/seriesUtils.ts +51 -51
  68. package/src/series/types.ts +87 -87
  69. package/src/tree/defaults.ts +23 -23
  70. package/src/tree/index.ts +3 -3
  71. package/src/tree/plugins/TreeLegend.ts +96 -96
  72. package/src/tree/plugins/TreeMap.ts +333 -333
  73. package/src/tree/types.ts +23 -23
  74. package/src/utils/commonUtils.ts +21 -21
  75. package/src/utils/d3Graphics.ts +174 -174
  76. package/src/utils/d3Utils.ts +73 -73
  77. package/src/utils/observables.ts +14 -14
  78. package/src/utils/orbchartsUtils.ts +100 -100
  79. package/tsconfig.base.json +13 -13
  80. package/tsconfig.json +2 -2
  81. package/vite.config.js +22 -22
@@ -1,100 +1,100 @@
1
- import type {
2
- AxisPosition,
3
- ColorType,
4
- ChartParams,
5
- ComputedDatumBase,
6
- ComputedDatumSeriesValue,
7
- ComputedDatumCategoryValue } from '../../lib/core-types'
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 '../../lib/core-types'
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,14 +1,14 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "./dist/",
4
- "sourceMap": true,
5
- "noImplicitAny": true,
6
- "module": "esnext",
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": "esnext",
7
+ "target": "es5",
8
+ "jsx": "react",
9
+ "allowJs": true,
10
+ "moduleResolution": "node",
11
+ "allowSyntheticDefaultImports" : true,
12
+ "esModuleInterop" : true
13
+ }
14
14
  }
package/tsconfig.json CHANGED
@@ -1,3 +1,3 @@
1
- {
2
- "extends": "./tsconfig.base.json"
1
+ {
2
+ "extends": "./tsconfig.base.json"
3
3
  }
package/vite.config.js CHANGED
@@ -1,23 +1,23 @@
1
- import { defineConfig } from 'vite'
2
- import dts from 'vite-plugin-dts'
3
-
4
- export default defineConfig(({ command, mode }) => {
5
- return {
6
- plugins: [
7
- dts({
8
- insertTypesEntry: true
9
- })
10
- ],
11
- compilerOptions: {
12
- composite: true
13
- },
14
- build: {
15
- lib: {
16
- entry: "src/index.ts",
17
- name: 'orbcharts-plugins-basic',
18
- formats: ["es", "umd"],
19
- fileName: format => `orbcharts-plugins-basic.${format}.js`
20
- },
21
- }
22
- }
1
+ import { defineConfig } from 'vite'
2
+ import dts from 'vite-plugin-dts'
3
+
4
+ export default defineConfig(({ command, mode }) => {
5
+ return {
6
+ plugins: [
7
+ dts({
8
+ insertTypesEntry: true
9
+ })
10
+ ],
11
+ compilerOptions: {
12
+ composite: true
13
+ },
14
+ build: {
15
+ lib: {
16
+ entry: "src/index.ts",
17
+ name: 'orbcharts-plugins-basic',
18
+ formats: ["es", "umd"],
19
+ fileName: format => `orbcharts-plugins-basic.${format}.js`
20
+ },
21
+ }
22
+ }
23
23
  })