You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2018/09/03 07:30:40 UTC

[incubator-echarts] branch master updated: fix(dataset): empty dataset array #8395

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

ovilia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git


The following commit(s) were added to refs/heads/master by this push:
     new 11b9a06  fix(dataset): empty dataset array #8395
11b9a06 is described below

commit 11b9a062332c74a41e6ca9d221109d40c9b4d598
Author: Ovilia <zw...@gmail.com>
AuthorDate: Mon Sep 3 15:30:18 2018 +0800

    fix(dataset): empty dataset array #8395
---
 src/data/helper/sourceHelper.js |  4 ++++
 test/dataset-category.html      | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/src/data/helper/sourceHelper.js b/src/data/helper/sourceHelper.js
index 0b365dc..dc160a5 100644
--- a/src/data/helper/sourceHelper.js
+++ b/src/data/helper/sourceHelper.js
@@ -62,6 +62,10 @@ export function detectSourceFormat(datasetModel) {
     }
     else if (isArray(data)) {
         // FIXME Whether tolerate null in top level array?
+        if (data.length === 0) {
+            sourceFormat = SOURCE_FORMAT_ARRAY_ROWS;
+        }
+
         for (var i = 0, len = data.length; i < len; i++) {
             var item = data[i];
 
diff --git a/test/dataset-category.html b/test/dataset-category.html
index c7e7e68..8928db6 100644
--- a/test/dataset-category.html
+++ b/test/dataset-category.html
@@ -48,6 +48,7 @@ under the License.
         <div id="category"></div>
         <div id="two-value-axes"></div>
         <div id="empty-data"></div>
+        <div id="empty-source"></div>
         <div id="dynamic-category"></div>
         <div id="dynamic-time"></div>
         <div id="dimension-but-no-column1"></div>
@@ -710,6 +711,42 @@ under the License.
 
 
 
+        <script>
+            require([
+                'echarts'
+            ], function (echarts) {
+
+                var option = {
+                    xAxis: {},
+                    yAxis: {},
+                    series: [
+                        {
+                            type:'line'
+                        }
+                    ],
+                    dataset: {
+                        source: []
+                    }
+                };
+
+                testHelper.create(echarts, 'empty-source', {
+                    title: 'data.source = [], only axis shown.',
+                    option: option
+                });
+            });
+        </script>
+
+
+
+
+
+
+
+
+
+
+
+
 
 
         <script>


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