You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/02/10 02:48:00 UTC

[GitHub] [echarts] pissang commented on a change in pull request #16431: fix(line): using sampling with lttb, NaN point should not be filtered.

pissang commented on a change in pull request #16431:
URL: https://github.com/apache/echarts/pull/16431#discussion_r803258012



##########
File path: src/data/DataStore.ts
##########
@@ -983,6 +985,10 @@ class DataStore {
                 }
             }
 
+            if (appendNaNList.length && appendNaNList.length !== frameEnd - frameStart) {
+                newIndices[sampledIndex++] = appendNaNList[0]; // append first NaN point in every bucket

Review comment:
       If we only append the first NaN point. We should use a variable instead of an array because array will cost more. For example:
   
   ```ts
   let firstNaNIndex = -1;
   
   if (isNaN(y) && firstNaNIndex < 0) {
     firstNaNIndex = rawIndex.
   )
   ...
   if (firstNaNIndex >= 0) {
     newIndices[sampledIndex++] = firstNaNIndex;
   }
   ```
   
   The performance is one of the most important indicator when implementing the sampling algorithm. We can check if it's degenerated in the `test/sample-compare.html` case




-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org