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 2020/05/19 09:38:57 UTC

[incubator-echarts] 01/01: fix(tooltip): fix map and marker

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

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

commit e5123a26e7c18411d092d6dda06826077e323280
Author: Ovilia <zw...@gmail.com>
AuthorDate: Tue May 19 17:38:17 2020 +0800

    fix(tooltip): fix map and marker
---
 src/chart/map/MapSeries.js          | 5 +++--
 src/component/marker/MarkerModel.js | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/chart/map/MapSeries.js b/src/chart/map/MapSeries.js
index f0a0a6c..f2376da 100644
--- a/src/chart/map/MapSeries.js
+++ b/src/chart/map/MapSeries.js
@@ -131,7 +131,7 @@ var MapSeries = SeriesModel.extend({
      *
      * @param {number} dataIndex
      */
-    formatTooltip: function (dataIndex) {
+    formatTooltip: function (dataIndex, multipleSeries, dataType, renderMode) {
         // FIXME orignalData and data is a bit confusing
         var data = this.getData();
         var formattedValue = addCommas(this.getRawValue(dataIndex));
@@ -149,7 +149,8 @@ var MapSeries = SeriesModel.extend({
             }
         }
 
-        return seriesNames.join(', ') + '<br />'
+        var newLine = renderMode === 'html' ? '<br/>' : '\n';
+        return seriesNames.join(', ') + newLine
             + encodeHTML(name + ' : ' + formattedValue);
     },
 
diff --git a/src/component/marker/MarkerModel.js b/src/component/marker/MarkerModel.js
index 8c3a314..f89c52d 100644
--- a/src/component/marker/MarkerModel.js
+++ b/src/component/marker/MarkerModel.js
@@ -121,15 +121,16 @@ var MarkerModel = echarts.extendComponentModel({
         }
     },
 
-    formatTooltip: function (dataIndex) {
+    formatTooltip: function (dataIndex, multipleSeries, dataType, renderMode) {
         var data = this.getData();
         var value = this.getRawValue(dataIndex);
         var formattedValue = zrUtil.isArray(value)
             ? zrUtil.map(value, addCommas).join(', ') : addCommas(value);
         var name = data.getName(dataIndex);
         var html = encodeHTML(this.name);
+        var newLine = renderMode === 'html' ? '<br/>' : '\n';
         if (value != null || name) {
-            html += '<br />';
+            html += newLine;
         }
         if (name) {
             html += encodeHTML(name);


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