chfw commented on a change in pull request #8425: new
URL: https://github.com/apache/incubator-echarts/pull/8425#discussion_r195360769
##########
File path: src/chart/custom.js
##########
@@ -488,20 +510,27 @@ function wrapEncodeDef(data) {
}
function createOrUpdate(el, dataIndex, elOption, animatableModel, group, data)
{
- el = doCreateOrUpdate(el, dataIndex, elOption, animatableModel, group,
data);
+ el = doCreateOrUpdate(el, dataIndex, elOption, animatableModel, group,
data, true);
el && data.setItemGraphicEl(dataIndex, el);
return el;
}
-function doCreateOrUpdate(el, dataIndex, elOption, animatableModel, group,
data) {
+function doCreateOrUpdate(el, dataIndex, elOption, animatableModel, group,
data, isRoot) {
+ elOption = elOption || {};
+
var elOptionType = elOption.type;
- if (el
- && elOptionType !== el.__customGraphicType
- && (elOptionType !== 'path' || elOption.pathData !==
el.__customPathData)
- && (elOptionType !== 'image' || elOption.style.image !==
el.__customImagePath)
- && (elOptionType !== 'text' || elOption.style.text !== el.__customText)
- ) {
+ if (el && (
+ // Also consider that if `renderItem` returns nothing, the original
element
+ // (if exists) will be removed (elOption is an empty object in that
case).
+ elOptionType == null
Review comment:
if condition is too complex --> difficult to test --> difficult to maintain
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]