@orbcharts/presets-basic 3.0.6 → 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
+ }
@@ -1,11 +1,11 @@
1
- import type { PresetPartial } from '../../lib/core-types'
1
+ import type { PresetPartial, EventSeries } from '../../lib/core-types'
2
2
  import type { PresetSeriesPluginParams, PresetNoneDataPluginParams } from '../types'
3
3
 
4
- export const PRESET_PIE_GAUGE: PresetPartial<'series', Partial<PresetSeriesPluginParams>
4
+ export const PRESET_PIE_INDICATOR_PIN: PresetPartial<'series', Partial<PresetSeriesPluginParams>
5
5
  & Partial<PresetNoneDataPluginParams>> = {
6
- name: 'PRESET_PIE_GAUGE',
7
- description: 'Gauge chart',
8
- descriptionZh: '儀表圖',
6
+ name: 'PRESET_PIE_INDICATOR_PIN',
7
+ description: 'Pin indicator chart',
8
+ descriptionZh: '大頭指針圖',
9
9
  chartParams: {
10
10
  // 和 Rose 一樣的配色
11
11
  colors: {
@@ -44,6 +44,10 @@ export const PRESET_PIE_GAUGE: PresetPartial<'series', Partial<PresetSeriesPlugi
44
44
  bottom: 0,
45
45
  left: 60
46
46
  },
47
+ styles: {
48
+ // unhighlightedOpacity: 1
49
+ },
50
+ highlightTarget: 'datum',
47
51
  },
48
52
  pluginParams: {
49
53
  Pie: {
@@ -57,7 +61,7 @@ export const PRESET_PIE_GAUGE: PresetPartial<'series', Partial<PresetSeriesPlugi
57
61
  PieEventTexts: {
58
62
  textAttrs: [
59
63
  {
60
- "transform": "translate(0, -24)"
64
+ "transform": "translate(0, -36)"
61
65
  }
62
66
  ],
63
67
  textStyles: [
@@ -69,12 +73,18 @@ export const PRESET_PIE_GAUGE: PresetPartial<'series', Partial<PresetSeriesPlugi
69
73
  "font-size": 24,
70
74
  "fill": "#000"
71
75
  }
72
- ]
76
+ ],
77
+ renderFn: (eventData: EventSeries) => {
78
+ return eventData.mark ?? null
79
+ },
73
80
  },
74
81
  Indicator: {
75
82
  startAngle: - Math.PI / 2,
76
83
  endAngle: Math.PI / 2,
77
84
  radius: 0.65,
85
+ indicatorType: 'pin',
86
+ size: 15,
87
+ // autoHighlight: true,
78
88
  value: 0
79
89
  },
80
90
  SeriesLegend: {
@@ -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,7 +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_GAUGE } from './PRESET_PIE_GAUGE'
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'
11
14
  export { PRESET_PIE_HALF_DONUT } from './PRESET_PIE_HALF_DONUT'
12
15
  export { PRESET_PIE_WITH_INNER_LABELS } from './PRESET_PIE_WITH_INNER_LABELS'
13
16
  export { PRESET_PIE_SEPARATE_SERIES } from './PRESET_PIE_SEPARATE_SERIES'
@@ -1,4 +0,0 @@
1
- import { PresetPartial } from '../../lib/core-types';
2
- import { PresetSeriesPluginParams, PresetNoneDataPluginParams } from '../types';
3
-
4
- export declare const PRESET_PIE_GAUGE: PresetPartial<'series', Partial<PresetSeriesPluginParams> & Partial<PresetNoneDataPluginParams>>;