You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/07/12 04:12:12 UTC

[echarts] branch dataset-perf updated: refact(data): fix chunk not exists when data is empty.

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch dataset-perf
in repository https://gitbox.apache.org/repos/asf/echarts.git


The following commit(s) were added to refs/heads/dataset-perf by this push:
     new 2a8b198  refact(data): fix chunk not exists when data is empty.
2a8b198 is described below

commit 2a8b198ce1dc3e2a326349c6af0f622e90576ef1
Author: pissang <bm...@gmail.com>
AuthorDate: Mon Jul 12 12:07:05 2021 +0800

    refact(data): fix chunk not exists when data is empty.
    
     fix dimSize param for typedarray to provider
---
 src/data/DataStorage.ts          | 11 ++++++-----
 src/data/helper/sourceManager.ts |  8 ++++++--
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/data/DataStorage.ts b/src/data/DataStorage.ts
index 2cfc133..953083e 100644
--- a/src/data/DataStorage.ts
+++ b/src/data/DataStorage.ts
@@ -238,6 +238,7 @@ class DataStorage {
         if (dim.ordinalMeta) {
             return;
         }
+
         for (let i = 0; i < chunk.length; i++) {
             (chunk as any)[i] = ordinalMeta.parseAndCollect(chunk[i]);
         }
@@ -292,7 +293,10 @@ class DataStorage {
         if (!provider.persistent) {
             end += start;
         }
-        this._initDataFromProvider(start, end, true);
+
+        if (start < end) {
+            this._initDataFromProvider(start, end, true);
+        }
 
         return [start, end];
     }
@@ -302,10 +306,6 @@ class DataStorage {
         end: number,
         append?: boolean
     ): void {
-        if (start >= end) {
-            return;
-        }
-
         const provider = this._provider;
         const chunks = this._chunks;
         const dimensions = this._dimensions;
@@ -321,6 +321,7 @@ class DataStorage {
             prepareStorage(chunks, i, dim.type, end, append);
         }
 
+
         if (provider.fillStorage) {
             provider.fillStorage(start, end, chunks, rawExtent);
         }
diff --git a/src/data/helper/sourceManager.ts b/src/data/helper/sourceManager.ts
index a5f3a9d..4d0e941 100644
--- a/src/data/helper/sourceManager.ts
+++ b/src/data/helper/sourceManager.ts
@@ -391,11 +391,15 @@ export class SourceManager {
                 cachedStore = upSourceMgr._innerGetDataStorage(endSource);
             }
             else {
+                const dimensionsDefine = source.dimensionsDefine;
                 // Can't create a store if don't know dimension..
-                if (source && source.dimensionsDefine) {
+                if (source && dimensionsDefine) {
                     cachedStore = new DataStorage();
                     // Always create storage from source of series.
-                    cachedStore.initData(new DefaultDataProvider((sourceToInit)), sourceToInit.dimensionsDefine);
+                    cachedStore.initData(
+                        new DefaultDataProvider(sourceToInit, dimensionsDefine.length),
+                        dimensionsDefine
+                    );
                 }
             }
             cachedStoreMap[sourceReadKey] = cachedStore;

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