(
api: ExtensionAPI,
existsEl: Element,
dataIndex: number,
elOption: CustomRootElementOption,
seriesModel: CustomSeriesModel,
group: ViewRootGroup,
data: SeriesData<CustomSeriesModel>
)
| 961 | } |
| 962 | |
| 963 | function createOrUpdateItem( |
| 964 | api: ExtensionAPI, |
| 965 | existsEl: Element, |
| 966 | dataIndex: number, |
| 967 | elOption: CustomRootElementOption, |
| 968 | seriesModel: CustomSeriesModel, |
| 969 | group: ViewRootGroup, |
| 970 | data: SeriesData<CustomSeriesModel> |
| 971 | ): Element { |
| 972 | // [Rule] |
| 973 | // If `renderItem` returns `null`/`undefined`/`false`, remove the previous el if existing. |
| 974 | // (It seems that violate the "merge" principle, but most of users probably intuitively |
| 975 | // regard "return;" as "show nothing element whatever", so make a exception to meet the |
| 976 | // most cases.) |
| 977 | // The rule or "merge" see [STRATEGY_MERGE]. |
| 978 | |
| 979 | // If `elOption` is `null`/`undefined`/`false` (when `renderItem` returns nothing). |
| 980 | if (!elOption) { |
| 981 | group.remove(existsEl); |
| 982 | return; |
| 983 | } |
| 984 | const el = doCreateOrUpdateEl(api, existsEl, dataIndex, elOption, seriesModel, group); |
| 985 | el && data.setItemGraphicEl(dataIndex, el); |
| 986 | |
| 987 | el && toggleHoverEmphasis( |
| 988 | el, |
| 989 | elOption.focus, |
| 990 | elOption.blurScope, |
| 991 | elOption.emphasisDisabled |
| 992 | ); |
| 993 | |
| 994 | return el; |
| 995 | } |
| 996 | |
| 997 | function doCreateOrUpdateEl( |
| 998 | api: ExtensionAPI, |
no test coverage detected
searching dependent graphs…