@@ -21,7 +21,7 @@ import type { GenerateChartCellContext } from '../type';
21
21
import { getFieldByDataType , getFieldIdInCell } from '../../../utils/field' ;
22
22
import { isValidDataTable } from '../../../utils/dataTable' ;
23
23
import { DataType , ChartType , ROLE } from '../../../types' ;
24
- import type { DataCell , DataTable , FieldInfo } from '../../../types' ;
24
+ import type { DataCell , DataTable } from '../../../types' ;
25
25
import { builtinThemeMap } from '../const' ;
26
26
27
27
const chartTypeMap : { [ chartName : string ] : string } = {
@@ -919,7 +919,7 @@ export const axis = (context: GenerateChartCellContext) => {
919
919
const { y : celly } = cell ;
920
920
const yFields = isArray ( celly ) ? celly : [ celly ] ;
921
921
const yFieldsInfo = yFields . map ( field => fieldInfo . find ( v => v . fieldName === field ) ) ;
922
- const isAllRatio = yFieldsInfo . every ( v => ! ! v . ratioGranularity ) ;
922
+ const isAllRatio = yFieldsInfo . every ( v => ! ! v ? .ratioGranularity ) ;
923
923
const isSameUnit = uniqArray ( yFieldsInfo . map ( v => v ?. unit ) . filter ( v => ! ! v ) ) . length === 1 ;
924
924
925
925
spec . axes = [
@@ -975,7 +975,7 @@ export const commonLabel = (context: GenerateChartCellContext) => {
975
975
} else if ( celly ) {
976
976
const field = isArray ( celly ) ? celly [ 0 ] : celly ;
977
977
const info = fieldInfo . find ( v => v . fieldName === field ) ;
978
- if ( info . ratioGranularity ) {
978
+ if ( info ? .ratioGranularity ) {
979
979
spec . label . formatter = `{${ field } :~%}` ;
980
980
}
981
981
}
@@ -1066,7 +1066,7 @@ export const scatterAxis = (context: GenerateChartCellContext) => {
1066
1066
spec . axes = [
1067
1067
{
1068
1068
orient : 'bottom' ,
1069
- type : [ DataType . DATE , DataType . STRING ] . includes ( xFieldInfo . type ) ? 'band' : 'linear' ,
1069
+ type : [ DataType . DATE , DataType . STRING ] . includes ( xFieldInfo ? .type ) ? 'band' : 'linear' ,
1070
1070
label : {
1071
1071
style : {
1072
1072
//fill: '#FFFFFF'
@@ -1081,7 +1081,7 @@ export const scatterAxis = (context: GenerateChartCellContext) => {
1081
1081
} ,
1082
1082
{
1083
1083
orient : 'left' ,
1084
- type : [ DataType . DATE , DataType . STRING ] . includes ( yFieldInfo . type ) ? 'band' : 'linear' ,
1084
+ type : [ DataType . DATE , DataType . STRING ] . includes ( yFieldInfo ? .type ) ? 'band' : 'linear' ,
1085
1085
label : {
1086
1086
style : {
1087
1087
//fill: '#FFFFFF'
0 commit comments