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/10/12 10:43:51 UTC

[echarts] 01/01: fix(tooltip): format boolean in value #15809

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

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

commit 2f7c6fef2698a0ea01173dfb81b6e0c3bd0f087c
Author: Ovilia <zw...@gmail.com>
AuthorDate: Tue Oct 12 18:42:36 2021 +0800

    fix(tooltip): format boolean in value #15809
---
 src/util/format.ts             |  3 +++
 test/tooltip-axisPointer2.html | 19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/util/format.ts b/src/util/format.ts
index 1f9749e..75c8cb5 100644
--- a/src/util/format.ts
+++ b/src/util/format.ts
@@ -111,6 +111,9 @@ export function makeValueReadable(
             ? (isNumberUserReadable(value) ? value + '' : '-')
             : '-';
     }
+    if (typeof value === 'boolean') {
+        return value ? 'true' : 'false';
+    }
     // By default.
     const numericResult = numericToNumber(value);
     return isNumberUserReadable(numericResult)
diff --git a/test/tooltip-axisPointer2.html b/test/tooltip-axisPointer2.html
index ebafca8..dc458dd 100644
--- a/test/tooltip-axisPointer2.html
+++ b/test/tooltip-axisPointer2.html
@@ -1130,6 +1130,19 @@ under the License.
                     ['1997-10-13', 0.2]
                 ];
 
+                var data3 = [
+                    ['1997-10-4', true],
+                    ['1997-10-5', true],
+                    ['1997-10-6', false],
+                    ['1997-10-7', false],
+                    ['1997-10-8', false],
+                    ['1997-10-9', true],
+                    ['1997-10-10', true],
+                    ['1997-10-11', false],
+                    ['1997-10-12', true],
+                    ['1997-10-13', true]
+                ];
+
                 var option = {
                     tooltip: {
                         trigger: 'axis',
@@ -1152,13 +1165,17 @@ under the License.
                     }, {
                         type: 'line',
                         data: data2
+                    }, {
+                        type: 'line',
+                        data: data3
                     }]
                 };
 
                 var chart = testHelper.create(echarts, 'main1', {
                     title: [
                         'Two pionts on the same xAxis tick, both of them',
-                        'should be displayed in tooltip'
+                        'should be displayed in tooltip',
+                        'and boolean values should be displayed'
                     ],
                     option: option,
                     width: 800,

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