You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2018/04/18 17:35:43 UTC

[incubator-echarts] branch master updated (e5fdb08 -> 5f156ad)

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

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


    from e5fdb08  Expose api of auto tick strategy and tweak splitArea logic.
     new faa78f7  Disable visualMap for large mode. And add test case for bar stream.
     new 5f156ad  Fix remove of bar and candlestick.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/chart/bar/BarView.js                         | 20 +++--
 src/chart/candlestick/CandlestickView.js         | 15 ++--
 src/component/visualMap/visualEncoding.js        |  5 +-
 src/layout/barGrid.js                            |  1 -
 src/visual/visualSolution.js                     |  3 +-
 test/-cases.js                                   |  3 +
 test/bar-stream-large.html                       | 85 +++++++++++++++++++++
 test/{bar-large1.html => bar-stream-large1.html} | 26 +++++--
 test/candlestick-large2.html                     | 97 ++++++++++++------------
 9 files changed, 176 insertions(+), 79 deletions(-)
 create mode 100644 test/bar-stream-large.html
 rename test/{bar-large1.html => bar-stream-large1.html} (84%)

-- 
To stop receiving notification emails like this one, please contact
sushuang@apache.org.

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


[incubator-echarts] 02/02: Fix remove of bar and candlestick.

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5f156ad45f4ff03efe7812e525edabb5abef8747
Author: sushuang <su...@gmail.com>
AuthorDate: Thu Apr 19 01:35:09 2018 +0800

    Fix remove of bar and candlestick.
---
 src/chart/bar/BarView.js                         | 20 ++++++++----------
 src/chart/candlestick/CandlestickView.js         | 15 +++++---------
 test/-cases.js                                   |  1 +
 test/bar-stream-large.html                       | 16 +++++++++------
 test/{bar-large1.html => bar-stream-large1.html} | 26 +++++++++++++++++++-----
 5 files changed, 46 insertions(+), 32 deletions(-)

diff --git a/src/chart/bar/BarView.js b/src/chart/bar/BarView.js
index 01ad899..7ee5fc5 100644
--- a/src/chart/bar/BarView.js
+++ b/src/chart/bar/BarView.js
@@ -152,17 +152,15 @@ export default echarts.extendChartView({
     _clear: function (ecModel) {
         var group = this.group;
         var data = this._data;
-        if (ecModel && ecModel.get('animation')) {
-            if (data) {
-                data.eachItemGraphicEl(function (el) {
-                    if (el.type === 'sector') {
-                        removeSector(el.dataIndex, ecModel, el);
-                    }
-                    else {
-                        removeRect(el.dataIndex, ecModel, el);
-                    }
-                });
-            }
+        if (ecModel && ecModel.get('animation') && data && !this._isLargeDraw) {
+            data.eachItemGraphicEl(function (el) {
+                if (el.type === 'sector') {
+                    removeSector(el.dataIndex, ecModel, el);
+                }
+                else {
+                    removeRect(el.dataIndex, ecModel, el);
+                }
+            });
         }
         else {
             group.removeAll();
diff --git a/src/chart/candlestick/CandlestickView.js b/src/chart/candlestick/CandlestickView.js
index 511dcca..d2a96b8 100644
--- a/src/chart/candlestick/CandlestickView.js
+++ b/src/chart/candlestick/CandlestickView.js
@@ -39,11 +39,6 @@ var CandlestickView = ChartView.extend({
         }
     },
 
-    _clear: function () {
-        this.group.removeAll();
-        this._data = null;
-    },
-
     _renderNormal: function (seriesModel) {
         var data = seriesModel.getData();
         var oldData = this._data;
@@ -129,12 +124,12 @@ var CandlestickView = ChartView.extend({
     },
 
     remove: function (ecModel) {
-        var group = this.group;
-        var data = this._data;
+        this._clear();
+    },
+
+    _clear: function () {
+        this.group.removeAll();
         this._data = null;
-        data && data.eachItemGraphicEl(function (el) {
-            el && group.remove(el);
-        });
     },
 
     dispose: zrUtil.noop
diff --git a/test/-cases.js b/test/-cases.js
index a5fb568..38324e8 100644
--- a/test/-cases.js
+++ b/test/-cases.js
@@ -41,6 +41,7 @@
             'scatter-gps.html',
             'scatter-weibo.html',
             'bar-stream-large.html',
+            'bar-stream-large1.html',
             'candlestick-large1.html',
             'lines-flight.html',
             'lines-stream-large.html',
diff --git a/test/bar-stream-large.html b/test/bar-stream-large.html
index 9164410..00fa074 100644
--- a/test/bar-stream-large.html
+++ b/test/bar-stream-large.html
@@ -10,13 +10,15 @@
     </head>
     <body>
         <style>
-            html, body, #main0 {
-                width: 100%;
-                height: 100%;
-                margin: 0;
+            #snapshot {
+                width: 150;
+                height: 100;
+                background: #fff;
+                border: 5px solid rgba(0,0,0,0.5);
             }
         </style>
         <div id='main0'></div>
+        <img id="snapshot"/>
         <script>
 
         require(['echarts'], function (echarts) {
@@ -61,7 +63,7 @@
                     '(1) Check all bars rendered (full of xAxis)',
                     '(2) And check roam.',
                     '(3) Check click legend',
-                    '(4) "finished" should be printed on console'
+                    '(4) Check snapshot rendering when "finished"'
                 ],
                 option: option,
                 info: {
@@ -71,7 +73,9 @@
             });
 
             chart.on('finished', function () {
-                console.log('finished');
+                var url = chart.getDataURL();
+                var snapshotEl = document.getElementById('snapshot');
+                snapshotEl.src = url;
             });
 
         });
diff --git a/test/bar-large1.html b/test/bar-stream-large1.html
similarity index 84%
rename from test/bar-large1.html
rename to test/bar-stream-large1.html
index a2114b8..5ce604a 100644
--- a/test/bar-large1.html
+++ b/test/bar-stream-large1.html
@@ -15,9 +15,18 @@
                 background: #146402;
                 color: #fff;
             }
+
+            #snapshot {
+                width: 150;
+                height: 100;
+                background: #fff;
+                border: 5px solid rgba(0,0,0,0.5);
+            }
+
         </style>
 
         <div id="main0"></div>
+        <img id="snapshot"/>
 
         <script>
 
@@ -79,12 +88,8 @@
                         }
                     },
                     dataZoom: [{
-                        // startValue: 48,
-                        // endValue: 99,
                         type: 'inside'
                     }, {
-                        // startValue: 48,
-                        // endValue: 99,
                         type: 'slider'
                     }],
                     xAxis: {
@@ -122,10 +127,21 @@
                     }]
                 };
 
-                testHelper.create(echarts, 'main0', {
+                var chart = testHelper.create(echarts, 'main0', {
+                    title: [
+                        '(1) Check legend click',
+                        '(2) Check `progressiveChunkMode: "mod"` render correct',
+                        '(3) Check snapshot rendering when "finished"'
+                    ],
                     option: option
                 });
 
+                chart.on('finished', function () {
+                    var url = chart.getDataURL();
+                    var snapshotEl = document.getElementById('snapshot');
+                    snapshotEl.src = url;
+                });
+
             });
         </script>
     </body>

-- 
To stop receiving notification emails like this one, please contact
sushuang@apache.org.

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


[incubator-echarts] 01/02: Disable visualMap for large mode. And add test case for bar stream.

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit faa78f738a722d7f2173fe765b654dbe4bae25d9
Author: sushuang <su...@gmail.com>
AuthorDate: Thu Apr 19 01:11:17 2018 +0800

    Disable visualMap for large mode. And add test case for bar stream.
---
 src/component/visualMap/visualEncoding.js |  5 +-
 src/layout/barGrid.js                     |  1 -
 src/visual/visualSolution.js              |  3 +-
 test/-cases.js                            |  2 +
 test/bar-stream-large.html                | 81 ++++++++++++++++++++++++++
 test/candlestick-large2.html              | 97 +++++++++++++++----------------
 6 files changed, 136 insertions(+), 53 deletions(-)

diff --git a/src/component/visualMap/visualEncoding.js b/src/component/visualMap/visualEncoding.js
index f19c78c..45be9fb 100644
--- a/src/component/visualMap/visualEncoding.js
+++ b/src/component/visualMap/visualEncoding.js
@@ -10,7 +10,10 @@ echarts.registerVisual(VISUAL_PRIORITY, {
     reset: function (seriesModel, ecModel) {
         var resetDefines = [];
         ecModel.eachComponent('visualMap', function (visualMapModel) {
-            if (!visualMapModel.isTargetSeries(seriesModel)) {
+            var pipelineContext = seriesModel.pipelineContext;
+            if (!visualMapModel.isTargetSeries(seriesModel)
+                || (pipelineContext && pipelineContext.large)
+            ) {
                 return;
             }
 
diff --git a/src/layout/barGrid.js b/src/layout/barGrid.js
index f23c3fb..2dab497 100644
--- a/src/layout/barGrid.js
+++ b/src/layout/barGrid.js
@@ -367,7 +367,6 @@ export var largeLayout = {
         return {progress: progress};
 
         function progress(params, data) {
-
             var largePoints = new LargeArr(params.count * 2);
             var dataIndex;
             var coord = [];
diff --git a/src/visual/visualSolution.js b/src/visual/visualSolution.js
index 13446c6..80de6d4 100644
--- a/src/visual/visualSolution.js
+++ b/src/visual/visualSolution.js
@@ -170,7 +170,8 @@ export function incrementalApplyVisual(stateList, visualMappings, getValueState,
             data.setItemVisual(dataIndex, key, value);
         }
 
-        for (var dataIndex = params.start; dataIndex < params.end; dataIndex++) {
+        var dataIndex;
+        while ((dataIndex = params.next()) != null) {
             var rawDataItem = data.getRawDataItem(dataIndex);
 
             // Consider performance
diff --git a/test/-cases.js b/test/-cases.js
index 826f18d..a5fb568 100644
--- a/test/-cases.js
+++ b/test/-cases.js
@@ -40,6 +40,8 @@
             'scatter-random-stream-fix-axis.html',
             'scatter-gps.html',
             'scatter-weibo.html',
+            'bar-stream-large.html',
+            'candlestick-large1.html',
             'lines-flight.html',
             'lines-stream-large.html',
             'lines-stream-not-large.html',
diff --git a/test/bar-stream-large.html b/test/bar-stream-large.html
new file mode 100644
index 0000000..9164410
--- /dev/null
+++ b/test/bar-stream-large.html
@@ -0,0 +1,81 @@
+<html>
+    <head>
+        <meta charset='utf-8'>
+        <script src='lib/esl.js'></script>
+        <script src='lib/config.js'></script>
+        <script src='lib/jquery.min.js'></script>
+        <script src='lib/testHelper.js'></script>
+        <link rel="stylesheet" href="lib/reset.css" />
+        <meta name='viewport' content='width=device-width, initial-scale=1' />
+    </head>
+    <body>
+        <style>
+            html, body, #main0 {
+                width: 100%;
+                height: 100%;
+                margin: 0;
+            }
+        </style>
+        <div id='main0'></div>
+        <script>
+
+        require(['echarts'], function (echarts) {
+
+            var count = 2e5;
+
+            var data = [];
+
+            for (var i = 0; i < count; i++) {
+                data.push(['c' + i, Math.sin(i / 180 * Math.PI)]);
+            }
+
+            var option = {
+                tooltip: {
+                    trigger: 'axis'
+                },
+                legend: {},
+                xAxis: {
+                    type: 'category',
+                    min: 0,
+                    max: count - 1,
+                    axisLabel: {
+                        showMaxLabel: true,
+                        showMinLabel: true
+                    }
+                },
+                yAxis: {},
+                dataZoom: [{}, {type: 'inside'}],
+                series: [{
+                    type: 'bar',
+                    name: 'bar',
+                    color: ['green'],
+                    progressiveChunkMode: 'sequential',
+                    large: true,
+                    data: data
+                }]
+            };
+
+            var chart = testHelper.create(echarts, 'main0', {
+                title: [
+                    count + ' points should be rendered from left to right.',
+                    '(1) Check all bars rendered (full of xAxis)',
+                    '(2) And check roam.',
+                    '(3) Check click legend',
+                    '(4) "finished" should be printed on console'
+                ],
+                option: option,
+                info: {
+                    xAxis: option.xAxis,
+                    series: {progressiveChunkMode: 'sequential'}
+                }
+            });
+
+            chart.on('finished', function () {
+                console.log('finished');
+            });
+
+        });
+
+        </script>
+    </body>
+</html>
\ No newline at end of file
diff --git a/test/candlestick-large2.html b/test/candlestick-large2.html
index e91528f..9a8262b 100644
--- a/test/candlestick-large2.html
+++ b/test/candlestick-large2.html
@@ -38,7 +38,6 @@
 
             function run() {
                 var data = generateOHLC(rawDataCount);
-                // var result = reorder(data);
                 init(data);
             }
 
@@ -69,17 +68,37 @@
 
                     // ['open', 'close', 'lowest', 'highest', 'volumn']
                     // [1, 4, 3, 2]
-                    data.push([
+                    data[i] = [
                         echarts.format.formatTime('yyyy-MM-dd hh:mm:ss', xValue += minute),
                         +boxVals[openIdx].toFixed(2), // open
                         +boxVals[3].toFixed(2), // highest
                         +boxVals[0].toFixed(2), // lowest
                         +boxVals[closeIdx].toFixed(2),  // close
-                        volumn.toFixed(0)
-                    ]);
+                        volumn.toFixed(0),
+                        getSign(data, i, +boxVals[openIdx], +boxVals[closeIdx], 4) // sign
+                    ];
                 }
 
                 return data;
+
+                function getSign(data, dataIndex, openVal, closeVal, closeDimIdx) {
+                    var sign;
+                    if (openVal > closeVal) {
+                        sign = -1;
+                    }
+                    else if (openVal < closeVal) {
+                        sign = 1;
+                    }
+                    else {
+                        sign = dataIndex > 0
+                            // If close === open, compare with close of last record
+                            ? (data[dataIndex - 1][closeDimIdx] <= closeVal ? 1 : -1)
+                            // No record of previous, set to be positive
+                            : 1;
+                    }
+
+                    return sign;
+                }
             }
 
             function calculateMA(dayCount, data) {
@@ -112,7 +131,6 @@
                         source: rawData
                     },
                     backgroundColor: '#eee',
-                    // animation: false,
                     legend: {
                         left: 0
                     },
@@ -127,9 +145,9 @@
                             dataZoom: {
                                 yAxisIndex: false
                             },
-                            brush: {
-                                type: ['polygon', 'rect', 'lineX', 'lineY', 'keep', 'clear']
-                            }
+                            // brush: {
+                            //     type: ['polygon', 'rect', 'lineX', 'lineY', 'keep', 'clear']
+                            // }
                         }
                     },
                     // brush: {
@@ -211,12 +229,22 @@
                             end: 100
                         }
                     ],
+                    visualMap: {
+                        show: false,
+                        seriesIndex: 1,
+                        dimension: 6,
+                        pieces: [{
+                            value: 1,
+                            color: downColor
+                        }, {
+                            value: -1,
+                            color: upColor
+                        }]
+                    },
                     series: [
                         {
                             name: 'Data Amount: ' + echarts.format.addCommas(rawDataCount),
                             type: 'candlestick',
-                            // progressiveMode: 'linear',
-                            // data: data,
                             itemStyle: {
                                 color: upColor,
                                 color0: downColor,
@@ -226,51 +254,16 @@
                             encode: {
                                 x: 0,
                                 y: [1, 4, 3, 2]
-                            },
-                            // progressive: false
-                            // progressive: progressive
+                            }
                         },
-                        // {
-                        //     name: 'MA5',
-                        //     type: 'line',
-                        //     data: calculateMA(5, data),
-                        //     smooth: true,
-                        //     lineStyle: {
-                        //         normal: {opacity: 0.5}
-                        //     }
-                        // },
-                        // {
-                        //     name: 'MA10',
-                        //     type: 'line',
-                        //     data: calculateMA(10, data),
-                        //     smooth: true,
-                        //     lineStyle: {
-                        //         normal: {opacity: 0.5}
-                        //     }
-                        // },
-                        // {
-                        //     name: 'MA20',
-                        //     type: 'line',
-                        //     data: calculateMA(20, data),
-                        //     smooth: true,
-                        //     lineStyle: {
-                        //         normal: {opacity: 0.5}
-                        //     }
-                        // },
-                        // {
-                        //     name: 'MA30',
-                        //     type: 'line',
-                        //     data: calculateMA(30, data),
-                        //     smooth: true,
-                        //     lineStyle: {
-                        //         normal: {opacity: 0.5}
-                        //     }
-                        // },
                         {
                             name: 'Volumn',
                             type: 'bar',
                             xAxisIndex: 1,
                             yAxisIndex: 1,
+                            itemStyle: {
+                                color: '#7fbe9e'
+                            },
                             large: true,
                             encode: {
                                 x: 0,
@@ -282,7 +275,11 @@
 
                 var panel = document.getElementById('panel0');
                 var chart = testHelper.create(echarts, 'main0', {
-                    title: 'Progressive by mod',
+                    title: [
+                        'Progressive by mod',
+                        '(1) Check click legend',
+                        '(2) Check visualMap after zoomed to normal mode'
+                    ],
                     option: option,
                     height: 550
                 });

-- 
To stop receiving notification emails like this one, please contact
sushuang@apache.org.

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