17
17
* under the License.
18
18
*/
19
19
20
- // @ts -nocheck
20
+ import BaseBarSeriesModel , { BaseBarSeriesOption } from './BaseBarSeries' ;
21
+ import SeriesModel from '../../model/Series' ;
22
+ import { ItemStyleOption , OptionDataValue , LabelOption } from '../../util/types' ;
23
+ import type Cartesian2D from '../../coord/cartesian/Cartesian2D' ;
24
+ import type Polar from '../../coord/polar/Polar' ;
21
25
22
- import BaseBarSeries from './BaseBarSeries' ;
26
+ type BarDataValue = OptionDataValue | OptionDataValue [ ]
23
27
24
- export default BaseBarSeries . extend ( {
28
+ export interface BarItemStyleOption extends ItemStyleOption {
29
+ /**
30
+ * Border radius is not supported for bar on polar
31
+ */
32
+ barBorderRadius ?: number | number [ ]
33
+ }
34
+ export interface BarDataItemOption {
35
+ name ?: string
36
+
37
+ value ?: BarDataValue
38
+
39
+ itemStyle ?: BarItemStyleOption
40
+ label ?: LabelOption
41
+
42
+ cursor ?: string
43
+
44
+ emphasis ?: {
45
+ itemStyle ?: BarItemStyleOption
46
+ label ?: LabelOption
47
+ }
48
+ }
49
+
50
+ export interface BarSeriesOption extends BaseBarSeriesOption {
51
+ coordinateSystem ?: 'cartesian2d' | 'polar'
52
+
53
+ clip ?: boolean
54
+
55
+ stack ?: string
56
+
57
+ /**
58
+ * If use caps on two sides of bars
59
+ * Only available on tangential polar bar
60
+ */
61
+ roundCap ?: boolean
62
+
63
+ showBackground ?: boolean
25
64
26
- type : 'series.bar' ,
65
+ backgroundStyle ?: ItemStyleOption & {
66
+ borderRadius ?: number | number [ ]
67
+ }
68
+
69
+ data ?: ( BarDataItemOption | BarDataValue ) [ ]
70
+
71
+ label ?: LabelOption
72
+
73
+ itemStyle ?: BarItemStyleOption
74
+
75
+ emphasis ?: {
76
+ label ?: LabelOption
77
+ itemStyle ?: BarItemStyleOption
78
+ }
79
+
80
+ }
27
81
28
- dependencies : [ 'grid' , 'polar' ] ,
82
+ class BarSeriesModel extends BaseBarSeriesModel < BarSeriesOption > {
83
+ static type = 'series.bar'
84
+ type = BarSeriesModel . type
29
85
30
- brushSelector : 'rect' ,
86
+ static dependencies = [ 'grid' , 'polar' ]
87
+
88
+ readonly brushSelector = 'rect'
89
+
90
+ coordinateSystem : Cartesian2D | Polar
31
91
32
92
/**
33
93
* @override
34
94
*/
35
- getProgressive : function ( ) {
95
+ getProgressive ( ) {
36
96
// Do not support progressive in normal mode.
37
97
return this . get ( 'large' )
38
98
? this . get ( 'progressive' )
39
99
: false ;
40
- } ,
100
+ }
41
101
42
102
/**
43
103
* @override
44
104
*/
45
- getProgressiveThreshold : function ( ) {
105
+ getProgressiveThreshold ( ) {
46
106
// Do not support progressive in normal mode.
47
107
var progressiveThreshold = this . get ( 'progressiveThreshold' ) ;
48
108
var largeThreshold = this . get ( 'largeThreshold' ) ;
49
109
if ( largeThreshold > progressiveThreshold ) {
50
110
progressiveThreshold = largeThreshold ;
51
111
}
52
112
return progressiveThreshold ;
53
- } ,
113
+ }
54
114
55
- defaultOption : {
115
+ static defaultOption : BarSeriesOption = {
56
116
// If clipped
57
117
// Only available on cartesian2d
58
118
clip : true ,
59
119
60
- // If use caps on two sides of bars
61
- // Only available on tangential polar bar
62
120
roundCap : false ,
63
121
64
122
showBackground : false ,
@@ -75,4 +133,9 @@ export default BaseBarSeries.extend({
75
133
opacity : 1
76
134
}
77
135
}
78
- } ) ;
136
+
137
+ }
138
+
139
+ SeriesModel . registerClass ( BarSeriesModel ) ;
140
+
141
+ export default BarSeriesModel ;
0 commit comments