@@ -30,6 +30,7 @@ import {
3030 FontStyle ,
3131 GridStyle ,
3232 IFieldFormatConfig ,
33+ LineStyle ,
3334 MarkArea ,
3435 MarkDataConfig ,
3536 MarkLine ,
@@ -297,9 +298,9 @@ function dateFormater(
297298 * console.log(colorList); // ["#298ffe","#dae9ff","#fe705a","#ffdcdc","#751adb","#8663d7","#15AD31","#FAD414","#E62412"]
298299 *
299300 * @export
300- * @return {* } default color array
301+ * @return {string[] } default color array
301302 */
302- export function getDefaultThemeColor ( ) {
303+ export function getDefaultThemeColor ( ) : string [ ] {
303304 return echartsDefaultTheme . color ;
304305}
305306
@@ -936,11 +937,11 @@ export function getAxisLine(show: boolean, lineStyle?): AxisLineStyle {
936937}
937938
938939export function getAxisLabel (
939- show ,
940+ show : boolean ,
940941 font : FontStyle ,
941- interval = null ,
942- rotate = null ,
943- overflow = null ,
942+ interval : string | null = null ,
943+ rotate : number | null = null ,
944+ overflow : string | null = null ,
944945) : AxisLabel {
945946 return {
946947 show,
@@ -951,24 +952,30 @@ export function getAxisLabel(
951952 } ;
952953}
953954
954- export function getSplitLine ( show , lineStyle ) : AxisLineStyle {
955+ export function getSplitLine (
956+ show : boolean ,
957+ lineStyle : LineStyle ,
958+ ) : AxisLineStyle {
955959 return {
956960 show,
957961 lineStyle,
958962 } ;
959963}
960964
961- export function getAxisTick ( show , lineStyle ) : AxisLineStyle {
965+ export function getAxisTick (
966+ show : boolean ,
967+ lineStyle : LineStyle ,
968+ ) : AxisLineStyle {
962969 return {
963970 show,
964971 lineStyle,
965972 } ;
966973}
967974
968975export function getNameTextStyle (
969- fontFamily ,
970- fontSize ,
971- color ,
976+ fontFamily : string ,
977+ fontSize : number ,
978+ color : string ,
972979) : { fontFamily : string ; fontSize : number ; color : string } {
973980 return {
974981 fontFamily,
@@ -1126,7 +1133,7 @@ export function getDataColumnMaxAndMin(
11261133export function getDataColumnMaxAndMin2 (
11271134 chartDataSetRows : IChartDataSetRow < string > [ ] ,
11281135 config ?: ChartDataSectionField ,
1129- ) {
1136+ ) : { min : number ; max : number } {
11301137 if ( ! config || ! chartDataSetRows ?. length ) {
11311138 return { min : 0 , max : 100 } ;
11321139 }
@@ -1139,10 +1146,10 @@ export function getDataColumnMaxAndMin2(
11391146}
11401147
11411148export function getSeriesTooltips4Scatter (
1142- params ,
1143- tooltipItemConfigs ,
1149+ params : Array < { value : string | number } > ,
1150+ tooltipItemConfigs : ChartDataSectionField [ ] ,
11441151 start ?: number ,
1145- ) {
1152+ ) : string [ ] {
11461153 const dataValues = params ?. [ 0 ] ?. value ;
11471154 return tooltipItemConfigs . map ( ( config , index ) =>
11481155 valueFormatter ( config , dataValues ?. [ ! ! start ? start + index : index ] ) ,
@@ -1269,10 +1276,10 @@ export function valueFormatter(
12691276
12701277export function getScatterSymbolSizeFn (
12711278 valueIndex : number ,
1272- max ,
1273- min ,
1279+ max : number ,
1280+ min : number ,
12741281 cycleRatio ?: number ,
1275- ) {
1282+ ) : ( val ) => number {
12761283 min = Math . min ( 0 , min ) ;
12771284 const scaleRatio = cycleRatio || 1 ;
12781285 const defaultScatterPointPixelSize = 10 ;
@@ -1324,7 +1331,7 @@ export function getExtraSeriesDataFormat(format?: IFieldFormatConfig): {
13241331export function getColorizeGroupSeriesColumns (
13251332 chartDataSet : IChartDataSet < string > ,
13261333 groupConfig : ChartDataSectionField ,
1327- ) {
1334+ ) : { [ x : string ] : IChartDataSet < string > } [ ] {
13281335 return Object . entries ( chartDataSet . groupBy ( groupConfig ) ) . map ( ( [ k , v ] ) => {
13291336 let a = { } ;
13301337 a [ k ] = v ;
@@ -1400,14 +1407,14 @@ export function isMatchRequirement(
14001407}
14011408
14021409// 获取是否展示刻度
1403- export const getIntervalShow = interval =>
1410+ export const getIntervalShow = ( interval ) : boolean =>
14041411 interval !== 'auto' && interval !== null ;
14051412
14061413// 判断overflow 条件是否已生效
14071414export function hadAxisLabelOverflowConfig (
14081415 options ?: ECBasicOption ,
14091416 horizon : boolean = false ,
1410- ) {
1417+ ) : boolean {
14111418 if ( ! options ) return false ;
14121419 const axisName = ! horizon ? 'xAxis' : 'yAxis' ;
14131420
@@ -1416,7 +1423,7 @@ export function hadAxisLabelOverflowConfig(
14161423
14171424 const { overflow, interval, show } = axisLabelOpts ;
14181425
1419- return show && overflow && getIntervalShow ( interval ) ;
1426+ return ! ! ( show && overflow && getIntervalShow ( interval ) ) ;
14201427}
14211428
14221429// 处理溢出情况
0 commit comments