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 2021/03/17 10:10:10 UTC

[echarts] 08/10: test(legend): update test cases

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

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

commit a654399b65aec562b316f2f8d068c904843022d0
Author: Ovilia <zw...@gmail.com>
AuthorDate: Wed Mar 17 15:54:21 2021 +0800

    test(legend): update test cases
---
 test/legend-style.html | 113 +++++++++++++++++++++++++++++++++++--------------
 1 file changed, 82 insertions(+), 31 deletions(-)

diff --git a/test/legend-style.html b/test/legend-style.html
index 70bd350..7c84811 100644
--- a/test/legend-style.html
+++ b/test/legend-style.html
@@ -35,17 +35,20 @@ under the License.
 
 
         <div id="main1"></div>
+        <div id="main2"></div>
 
         <script>
-        require(['echarts'], function (echarts) {
-            var getData = function (seriesId) {
+            function getData(seriesId) {
                 var data = [];
                 for (var i = 0; i < 7; ++i) {
                     data.push(Math.random() * 100 + (seriesId + 1) * 200);
                 }
                 return data;
-            };
+            }
+        </script>
 
+        <script>
+        require(['echarts'], function (echarts) {
             var option = {
                 xAxis: {
                     type: 'category',
@@ -54,48 +57,85 @@ under the License.
                 yAxis: {
                     type: 'value'
                 },
-                legend: {
-                    data: ['Default Line', 'Line with emptyCircle', 'Line with emptyCircle and color', 'Line with style', 'Line with visualMap', 'Pie A', 'Pie B', 'Pie C']
-                },
+                legend: [{
+                    data: [
+                        'Line A',
+                        'Line B',
+                    {
+                        name: 'Pie A',
+                        itemStyle: {
+                            // borderWidth:
+                        }
+                    },
+                    'Pie B', 'Pie C',
+                    {
+                        name: 'Line C',
+                        symbolSize: 'inherit'
+                    }, 'Line F'
+                ]
+                }, {
+                    bottom: 10,
+                    data: [{
+                        name: 'Line D'
+                    }, {
+                        name: 'Line E',
+                        itemStyle: {
+                            color: 'yellow'
+                        }
+                    }],
+                    itemStyle: {
+                        color: 'orange'
+                    }
+                }],
                 series: [{
                     data: getData(0),
                     type: 'line',
-                    name: 'Default Line'
+                    name: 'Line A'
                 }, {
                     data: getData(1),
                     type: 'line',
-                    name: 'Line with emptyCircle',
-                    symbol: 'emptyCircle'
+                    name: 'Line B',
+                    itemStyle: {
+                        color: 'red',
+                        borderWidth: 5
+                    },
+                    symbolSize: 10
                 }, {
                     data: getData(2),
                     type: 'line',
-                    name: 'Line with emptyCircle and color',
-                    symbol: 'emptyCircle',
+                    name: 'Line C',
+                    lineStyle: {
+                        color: 'green',
+                        width: 5,
+                        shadowBlur: 10,
+                        shadowColor: 'orange'
+                    },
                     itemStyle: {
-                        color: 'auto'
-                    }
+                        color: 'red'
+                    },
+                    symbolSize: 30
                 }, {
                     data: getData(3),
                     type: 'line',
-                    name: 'Line with style',
-                    symbolSize: 12,
+                    name: 'Line D',
                     itemStyle: {
-                        color: 'auto',
-                        borderColor: 'blue',
-                        borderWidth: 2,
-                        symbolSize: 25
-                    },
-                    lineStyle: {
-                        color: 'red',
-                        width: 4
+                        color: 'blue'
                     }
                 }, {
                     data: getData(4),
                     type: 'line',
-                    name: 'Line with visualMap',
-                    symbolSize: 30,
+                    name: 'Line E',
+                    itemStyle: {
+                        color: 'green'
+                    },
+                    symbolSize: 10
+                }, {
+                    data: getData(5),
+                    type: 'line',
+                    name: 'Line F',
+                    symbolSize: 10,
                     itemStyle: {
-                        borderColor: 'green'
+                        color: 'blue'
                     }
                 }, {
                     type: 'pie',
@@ -112,6 +152,10 @@ under the License.
                             color: 'blue'
                         }
                     }],
+                    itemStyle: {
+                        borderWidth: 5,
+                        borderColor: '#fff'
+                    },
                     center: ['80%', '50%']
                 }],
                 grid: {
@@ -120,19 +164,26 @@ under the License.
                 },
                 visualMap: {
                     type: 'continuous',
-                    min: 1000,
-                    max: 1100,
+                    min: 1200,
+                    max: 1300,
                     inRange: {
                         color: ['green', 'yellow', 'red']
                     },
                     show: false,
-                    seriesIndex: 4
-                }
+                    seriesIndex: 5
+                },
+                animation: 0
             };
 
             var chart = testHelper.create(echarts, 'main1', {
                 title: [
-                    'Legend icon being more intuitive'
+                    '**Legend icon being more intuitive**',
+                    'Line A: the style of the line and items should be the same in those in legend; all colored in the first theme color',
+                    'Line B: the style of the line and items should be the same in those in legend; all colored in red',
+                    'Line C: the style of the line and items should be the same in those in legend; items colored in red and line colored in green',
+                    'Line D: the style of the line should be the same in that in the legend; items colored orange in legend and blue in series',
+                    'Line E: the style of the line should be the same in that in the legend; items colored yellow in legend and green in series',
+                    'Line F: the colors in the legend should be blue'
                 ],
                 option: option
             });


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