plainheart commented on code in PR #20703:
URL: https://github.com/apache/echarts/pull/20703#discussion_r2477229524


##########
src/component/visualMap/VisualMapModel.ts:
##########
@@ -247,6 +257,30 @@ class VisualMapModel<Opts extends VisualMapOption = 
VisualMapOption> extends Com
      * @return An array of series indices.
      */
     protected getTargetSeriesIndices(): number[] {
+        const seriesTargets = this.option.seriesTargets;
+        if (seriesTargets) {
+            // When seriesTargets is provided, collect all target series 
indices
+            const indices: number[] = [];
+            for (const target of seriesTargets) {

Review Comment:
   There seems to be no `const of` usage for the array iteration in the 
codebase. As the current coding style, maybe the `zrUtil.each` utility should 
be used here.



##########
src/component/visualMap/preprocessor.ts:
##########
@@ -53,6 +53,23 @@ export default function visualMapPreprocessor(option) {
                 }
             });
         }
+
+        // Validate seriesTargets
+        const seriesTargets = opt.seriesTargets;
+        if (seriesTargets && zrUtil.isArray(seriesTargets)) {
+            each(seriesTargets, function (target) {
+                if (!zrUtil.isObject(target) || target.dimension == null) {
+                    if (__DEV__) {

Review Comment:
   I noticed that this validation only outputs warnings during the development 
process. How about moving the `__DEV__` check outside? - This helps reduce the 
distribution file size.
   
   ```ts
   if (__DEV__) {
       const seriesTargets = opt.seriesTargets;
       if (seriesTargets && zrUtil.isArray(seriesTargets)) {
           each(seriesTargets, function (target) {
               if (!zrUtil.isObject(target) || target.dimension == null) {
                   console.warn('Each seriesTarget should have a dimension 
property');
               }
               if (target.seriesIndex == null && target.seriesId == null) {
                   console.warn('Each seriesTarget should have either 
seriesIndex or seriesId');
               }
           });
       }
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to