@orbcharts/presets-basic 3.0.5 → 3.0.7

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.
@@ -0,0 +1,95 @@
1
+ import type { PresetPartial, EventSeries } from '../../lib/core-types'
2
+ import type { PresetSeriesPluginParams, PresetNoneDataPluginParams } from '../types'
3
+
4
+ export const PRESET_PIE_INDICATOR_NEEDLE: PresetPartial<'series', Partial<PresetSeriesPluginParams>
5
+ & Partial<PresetNoneDataPluginParams>> = {
6
+ name: 'PRESET_PIE_INDICATOR_NEEDLE',
7
+ description: 'Needle indicator chart',
8
+ descriptionZh: '指針圖',
9
+ chartParams: {
10
+ // 和 Rose 一樣的配色
11
+ colors: {
12
+ light: {
13
+ label: [
14
+ "#4BABFF",
15
+ "#0088FF",
16
+ "#435399",
17
+ "#86DC72",
18
+ "#42C724",
19
+ "#16B59B",
20
+ "#F9B052",
21
+ "#F4721B",
22
+ "#FF3232",
23
+ "#7E7D7D"
24
+ ]
25
+ },
26
+ dark: {
27
+ label: [
28
+ "#8BC8FF",
29
+ "#4BABFF",
30
+ "#0088FF",
31
+ "#55D339",
32
+ "#29AB0C",
33
+ "#16B59B",
34
+ "#FCDCAD",
35
+ "#F9B052",
36
+ "#FF6C6C",
37
+ "#C4C4C4"
38
+ ]
39
+ }
40
+ },
41
+ padding: {
42
+ top: 120,
43
+ right: 60,
44
+ bottom: 0,
45
+ left: 60
46
+ },
47
+ styles: {
48
+ // unhighlightedOpacity: 1
49
+ },
50
+ highlightTarget: 'datum',
51
+ },
52
+ pluginParams: {
53
+ Pie: {
54
+ outerRadius: 1,
55
+ outerRadiusWhileHighlight: 1,
56
+ innerRadius: 0.75,
57
+ startAngle: - Math.PI / 2,
58
+ endAngle: Math.PI / 2,
59
+ },
60
+ PieLabels: {},
61
+ PieEventTexts: {
62
+ textAttrs: [
63
+ {
64
+ "transform": "translate(0, -36)"
65
+ }
66
+ ],
67
+ textStyles: [
68
+ {
69
+ "font-weight": "bold",
70
+ "text-anchor": "middle",
71
+ "pointer-events": "none",
72
+ "dominant-baseline": "middle",
73
+ "font-size": 24,
74
+ "fill": "#000"
75
+ }
76
+ ],
77
+ renderFn: (eventData: EventSeries) => {
78
+ return eventData.mark ?? null
79
+ },
80
+ },
81
+ Indicator: {
82
+ startAngle: - Math.PI / 2,
83
+ endAngle: Math.PI / 2,
84
+ radius: 0.65,
85
+ indicatorType: 'needle',
86
+ size: 10,
87
+ // autoHighlight: true,
88
+ value: 0
89
+ },
90
+ SeriesLegend: {
91
+ placement: 'bottom',
92
+ listRectRadius: 7 // 圓型圖例列點
93
+ }
94
+ }
95
+ }
@@ -0,0 +1,95 @@
1
+ import type { PresetPartial, EventSeries } from '../../lib/core-types'
2
+ import type { PresetSeriesPluginParams, PresetNoneDataPluginParams } from '../types'
3
+
4
+ export const PRESET_PIE_INDICATOR_PIN: PresetPartial<'series', Partial<PresetSeriesPluginParams>
5
+ & Partial<PresetNoneDataPluginParams>> = {
6
+ name: 'PRESET_PIE_INDICATOR_PIN',
7
+ description: 'Pin indicator chart',
8
+ descriptionZh: '大頭指針圖',
9
+ chartParams: {
10
+ // 和 Rose 一樣的配色
11
+ colors: {
12
+ light: {
13
+ label: [
14
+ "#4BABFF",
15
+ "#0088FF",
16
+ "#435399",
17
+ "#86DC72",
18
+ "#42C724",
19
+ "#16B59B",
20
+ "#F9B052",
21
+ "#F4721B",
22
+ "#FF3232",
23
+ "#7E7D7D"
24
+ ]
25
+ },
26
+ dark: {
27
+ label: [
28
+ "#8BC8FF",
29
+ "#4BABFF",
30
+ "#0088FF",
31
+ "#55D339",
32
+ "#29AB0C",
33
+ "#16B59B",
34
+ "#FCDCAD",
35
+ "#F9B052",
36
+ "#FF6C6C",
37
+ "#C4C4C4"
38
+ ]
39
+ }
40
+ },
41
+ padding: {
42
+ top: 120,
43
+ right: 60,
44
+ bottom: 0,
45
+ left: 60
46
+ },
47
+ styles: {
48
+ // unhighlightedOpacity: 1
49
+ },
50
+ highlightTarget: 'datum',
51
+ },
52
+ pluginParams: {
53
+ Pie: {
54
+ outerRadius: 1,
55
+ outerRadiusWhileHighlight: 1,
56
+ innerRadius: 0.75,
57
+ startAngle: - Math.PI / 2,
58
+ endAngle: Math.PI / 2,
59
+ },
60
+ PieLabels: {},
61
+ PieEventTexts: {
62
+ textAttrs: [
63
+ {
64
+ "transform": "translate(0, -36)"
65
+ }
66
+ ],
67
+ textStyles: [
68
+ {
69
+ "font-weight": "bold",
70
+ "text-anchor": "middle",
71
+ "pointer-events": "none",
72
+ "dominant-baseline": "middle",
73
+ "font-size": 24,
74
+ "fill": "#000"
75
+ }
76
+ ],
77
+ renderFn: (eventData: EventSeries) => {
78
+ return eventData.mark ?? null
79
+ },
80
+ },
81
+ Indicator: {
82
+ startAngle: - Math.PI / 2,
83
+ endAngle: Math.PI / 2,
84
+ radius: 0.65,
85
+ indicatorType: 'pin',
86
+ size: 15,
87
+ // autoHighlight: true,
88
+ value: 0
89
+ },
90
+ SeriesLegend: {
91
+ placement: 'bottom',
92
+ listRectRadius: 7 // 圓型圖例列點
93
+ }
94
+ }
95
+ }
@@ -0,0 +1,95 @@
1
+ import type { PresetPartial, EventSeries } from '../../lib/core-types'
2
+ import type { PresetSeriesPluginParams, PresetNoneDataPluginParams } from '../types'
3
+
4
+ export const PRESET_PIE_INDICATOR_TRIANGLE: PresetPartial<'series', Partial<PresetSeriesPluginParams>
5
+ & Partial<PresetNoneDataPluginParams>> = {
6
+ name: 'PRESET_PIE_INDICATOR_TRIANGLE',
7
+ description: 'Triangle indicator chart',
8
+ descriptionZh: '三角指針圖',
9
+ chartParams: {
10
+ // 和 Rose 一樣的配色
11
+ colors: {
12
+ light: {
13
+ label: [
14
+ "#4BABFF",
15
+ "#0088FF",
16
+ "#435399",
17
+ "#86DC72",
18
+ "#42C724",
19
+ "#16B59B",
20
+ "#F9B052",
21
+ "#F4721B",
22
+ "#FF3232",
23
+ "#7E7D7D"
24
+ ]
25
+ },
26
+ dark: {
27
+ label: [
28
+ "#8BC8FF",
29
+ "#4BABFF",
30
+ "#0088FF",
31
+ "#55D339",
32
+ "#29AB0C",
33
+ "#16B59B",
34
+ "#FCDCAD",
35
+ "#F9B052",
36
+ "#FF6C6C",
37
+ "#C4C4C4"
38
+ ]
39
+ }
40
+ },
41
+ padding: {
42
+ top: 120,
43
+ right: 60,
44
+ bottom: 0,
45
+ left: 60
46
+ },
47
+ styles: {
48
+ // unhighlightedOpacity: 1
49
+ },
50
+ highlightTarget: 'datum',
51
+ },
52
+ pluginParams: {
53
+ Pie: {
54
+ outerRadius: 1,
55
+ outerRadiusWhileHighlight: 1,
56
+ innerRadius: 0.75,
57
+ startAngle: - Math.PI / 2,
58
+ endAngle: Math.PI / 2,
59
+ },
60
+ PieLabels: {},
61
+ PieEventTexts: {
62
+ textAttrs: [
63
+ {
64
+ "transform": "translate(0, -36)"
65
+ }
66
+ ],
67
+ textStyles: [
68
+ {
69
+ "font-weight": "bold",
70
+ "text-anchor": "middle",
71
+ "pointer-events": "none",
72
+ "dominant-baseline": "middle",
73
+ "font-size": 24,
74
+ "fill": "#000"
75
+ }
76
+ ],
77
+ renderFn: (eventData: EventSeries) => {
78
+ return eventData.mark ?? null
79
+ },
80
+ },
81
+ Indicator: {
82
+ startAngle: - Math.PI / 2,
83
+ endAngle: Math.PI / 2,
84
+ radius: 0.65,
85
+ indicatorType: 'triangle',
86
+ size: 20,
87
+ // autoHighlight: true,
88
+ value: 0
89
+ },
90
+ SeriesLegend: {
91
+ placement: 'bottom',
92
+ listRectRadius: 7 // 圓型圖例列點
93
+ }
94
+ }
95
+ }
@@ -7,6 +7,10 @@ export { PRESET_BUBBLES_SIMPLE } from './PRESET_BUBBLES_SIMPLE'
7
7
  export { PRESET_BUBBLES_SUM_SERIES } from './PRESET_BUBBLES_SUM_SERIES'
8
8
  export { PRESET_PIE_BASIC } from './PRESET_PIE_BASIC'
9
9
  export { PRESET_PIE_DONUT } from './PRESET_PIE_DONUT'
10
+ export { PRESET_PIE_INDICATOR_LINE } from './PRESET_PIE_INDICATOR_LINE'
11
+ export { PRESET_PIE_INDICATOR_NEEDLE } from './PRESET_PIE_INDICATOR_NEEDLE'
12
+ export { PRESET_PIE_INDICATOR_PIN } from './PRESET_PIE_INDICATOR_PIN'
13
+ export { PRESET_PIE_INDICATOR_TRIANGLE } from './PRESET_PIE_INDICATOR_TRIANGLE'
10
14
  export { PRESET_PIE_HALF_DONUT } from './PRESET_PIE_HALF_DONUT'
11
15
  export { PRESET_PIE_WITH_INNER_LABELS } from './PRESET_PIE_WITH_INNER_LABELS'
12
16
  export { PRESET_PIE_SEPARATE_SERIES } from './PRESET_PIE_SEPARATE_SERIES'
package/src/types.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type {
2
2
  // -- series --
3
3
  BubblesParams,
4
+ IndicatorParams,
4
5
  PieParams,
5
6
  PieEventTextsParams,
6
7
  PieLabelsParams,
@@ -77,6 +78,7 @@ import type { DeepPartial } from '../lib/core-types'
77
78
  // -- series --
78
79
  // series的全部plugin參數
79
80
  export type PresetSeriesPluginParams = PresetBubblesParams
81
+ & PresetIndicatorParams
80
82
  & PresetPieParams
81
83
  & PresetPieEventTextsParams
82
84
  & PresetPieLabelsParams
@@ -89,6 +91,10 @@ export interface PresetBubblesParams {
89
91
  Bubbles: DeepPartial<BubblesParams>
90
92
  }
91
93
 
94
+ export interface PresetIndicatorParams {
95
+ Indicator: DeepPartial<IndicatorParams>
96
+ }
97
+
92
98
  export interface PresetPieParams {
93
99
  Pie: Partial<PieParams>
94
100
  }