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 2019/10/08 07:30:17 UTC

[incubator-echarts] 02/03: test(gauge): add test case for gauge #10945

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

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

commit 5c5ea1b0cb617a23b3590bf257496fc129bed93a
Author: Ovilia <zw...@gmail.com>
AuthorDate: Tue Oct 8 15:27:57 2019 +0800

    test(gauge): add test case for gauge #10945
---
 test/gauge-simple.html | 159 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 159 insertions(+)

diff --git a/test/gauge-simple.html b/test/gauge-simple.html
new file mode 100644
index 0000000..53c0931
--- /dev/null
+++ b/test/gauge-simple.html
@@ -0,0 +1,159 @@
+<!DOCTYPE html>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <script src="lib/esl.js"></script>
+    <script src="lib/config.js"></script>
+    <script src="lib/jquery.min.js"></script>
+    <script src="lib/facePrint.js"></script>
+    <script src="lib/testHelper.js"></script>
+    <!-- <script src="ut/lib/canteen.js"></script> -->
+    <link rel="stylesheet" href="lib/reset.css" />
+</head>
+
+<body>
+    <style>
+    </style>
+
+
+
+    <div id="main0"></div>
+
+    <div id="main1"></div>
+
+    <div id="main2"></div>
+
+
+
+
+
+
+
+
+
+    <script>
+        require(['echarts'], function (echarts) {
+            var option = {
+                tooltip: {
+                    formatter: "{a} <br/>{b} : {c}%"
+                },
+                series: [
+                    {
+                        name: 'Pressure',
+                        type: 'gauge',
+                        detail: {formatter: '{value}%'},
+                        data: [{value: 50, name: 'score'}]
+                    }
+                ]
+            };
+
+            var chart = testHelper.create(echarts, 'main0', {
+                title: [
+                    'Simple gauge',
+                    'Value should be 88 after clicking button'
+                ],
+                option: option,
+                buttons: [{
+                    text: 'Change data', onclick: function () {
+                        option.series[0].data[0].value = 88;
+                        chart.setOption(option, true);
+                    }
+                }]
+            });
+        });
+    </script>
+
+
+
+
+
+
+    <script>
+        require(['echarts'], function (echarts) {
+            var option = {
+                tooltip: {
+                    formatter: "{a} <br/>{b} : {c}%"
+                },
+                dataset: {
+                    source: [[10], [30]]
+                },
+                series: [
+                    {
+                        name: 'Pressure',
+                        type: 'gauge',
+                        detail: {formatter: '{value}%'}
+                    }
+                ]
+            };
+
+            var chart = testHelper.create(echarts, 'main1', {
+                title: [
+                    'Gauge with dataset',
+                    'Value should be 44 and 88 after clicking button'
+                ],
+                option: option,
+                buttons: [{
+                    text: 'Change data', onclick: function () {
+                        chart.setOption({
+                            dataset: {
+                                source: [[44], [88]]
+                            }
+                        });
+                    }
+                }]
+            });
+        });
+    </script>
+
+
+
+
+    <script>
+        require(['echarts'], function (echarts) {
+            var option = {
+                tooltip: {
+                    formatter: "{a} <br/>{b} : {c}%"
+                },
+                series: [
+                    {
+                        name: 'Pressure',
+                        type: 'gauge',
+                        data: []
+                    }
+                ]
+            };
+
+            var chart = testHelper.create(echarts, 'main2', {
+                title: [
+                    'Gauge with no data, should display NaN'
+                ],
+                option: option
+            });
+        });
+    </script>
+
+</body>
+
+</html>
\ No newline at end of file


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