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 2018/06/13 10:03:56 UTC

[incubator-echarts] branch master updated (6d89822 -> 46c4c3f)

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

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


    from 6d89822  [custom series] (1) add params.actionType (2) add params.coordSys.zoom for geo (3) enhance merge.
     new 1581dda  feat(tooltip): basic logic for non-html tooltip
     new 883e024  feat(tooltip): use non-html tooltip when document is not defined
     new 311df99  test(tooltip): test for non-html tooltip
     new c7d7d19  fix(tooltip): getOuterSize was removed by mistake
     new 46c4c3f  Merge branch 'master' of github.com:ecomfe/echarts

The 5 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/component/tooltip/TooltipContent.js            |  19 +++
 src/component/tooltip/TooltipModel.js              |   5 +
 src/component/tooltip/TooltipRichContent.js        | 138 +++++++++++++++++++++
 src/component/tooltip/TooltipView.js               | 107 ++++++++++------
 src/model/Series.js                                |  36 +++++-
 src/util/format.js                                 |  10 +-
 ...{bar-polar-null-data.html => tooltip-rich.html} |  40 +++---
 7 files changed, 292 insertions(+), 63 deletions(-)
 create mode 100644 src/component/tooltip/TooltipRichContent.js
 copy test/{bar-polar-null-data.html => tooltip-rich.html} (71%)

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

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


[incubator-echarts] 04/05: fix(tooltip): getOuterSize was removed by mistake

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

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

commit c7d7d19f075ae7b52f7027731327c8bb9252a8e0
Author: Ovilia <zw...@gmail.com>
AuthorDate: Wed Jun 13 17:24:54 2018 +0800

    fix(tooltip): getOuterSize was removed by mistake
---
 src/component/tooltip/TooltipContent.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/component/tooltip/TooltipContent.js b/src/component/tooltip/TooltipContent.js
index 110c604..ac0959b 100644
--- a/src/component/tooltip/TooltipContent.js
+++ b/src/component/tooltip/TooltipContent.js
@@ -273,6 +273,25 @@ TooltipContent.prototype = {
 
     isShow: function () {
         return this._show;
+    },
+
+    getOuterSize: function () {
+        var width = this.el.clientWidth;
+        var height = this.el.clientHeight;
+
+        // Consider browser compatibility.
+        // IE8 does not support getComputedStyle.
+        if (document.defaultView && document.defaultView.getComputedStyle) {
+            var stl = document.defaultView.getComputedStyle(this.el);
+            if (stl) {
+                width += parseInt(stl.paddingLeft, 10) + parseInt(stl.paddingRight, 10)
+                    + parseInt(stl.borderLeftWidth, 10) + parseInt(stl.borderRightWidth, 10);
+                height += parseInt(stl.paddingTop, 10) + parseInt(stl.paddingBottom, 10)
+                    + parseInt(stl.borderTopWidth, 10) + parseInt(stl.borderBottomWidth, 10);
+            }
+        }
+
+        return {width: width, height: height};
     }
 };
 

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

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


[incubator-echarts] 01/05: feat(tooltip): basic logic for non-html tooltip

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

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

commit 1581dda5a0d8a126d8ea48ce3cc0bb7396233ded
Author: Ovilia <zw...@gmail.com>
AuthorDate: Wed Jun 13 16:57:20 2018 +0800

    feat(tooltip): basic logic for non-html tooltip
---
 src/component/tooltip/TooltipModel.js       |   2 +
 src/component/tooltip/TooltipRichContent.js | 138 ++++++++++++++++++++++++++++
 src/component/tooltip/TooltipView.js        | 105 +++++++++++++--------
 src/model/Series.js                         |  36 ++++++--
 src/util/format.js                          |  10 +-
 test/tooltip-rich.html                      |  92 +++++++++++++++++++
 6 files changed, 338 insertions(+), 45 deletions(-)

diff --git a/src/component/tooltip/TooltipModel.js b/src/component/tooltip/TooltipModel.js
index cdebf29..3161aaa 100644
--- a/src/component/tooltip/TooltipModel.js
+++ b/src/component/tooltip/TooltipModel.js
@@ -46,6 +46,8 @@ export default echarts.extendComponentModel({
 
         displayMode: 'single', // 'single' | 'multipleByCoordSys'
 
+        useHtml: true,
+
         // 位置 {Array} | {Function}
         // position: null
         // Consider triggered from axisPointer handle, verticalAlign should be 'middle'
diff --git a/src/component/tooltip/TooltipRichContent.js b/src/component/tooltip/TooltipRichContent.js
new file mode 100644
index 0000000..b5f8078
--- /dev/null
+++ b/src/component/tooltip/TooltipRichContent.js
@@ -0,0 +1,138 @@
+/*
+* 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.
+*/
+
+import Group from 'zrender/src/container/Group';
+import Text from 'zrender/src/graphic/Text';
+
+/**
+ * @alias module:echarts/component/tooltip/TooltipRichContent
+ * @constructor
+ */
+function TooltipRichContent(api) {
+    // this.el = new Group();
+
+    var zr = this._zr = api.getZr();
+    // zr.add(this.el);
+
+    this._x = api.getWidth() / 2;
+    this._y = api.getHeight() / 2;
+
+    this._show = false;
+
+    /**
+     * @private
+     */
+    this._hideTimeout;
+}
+
+TooltipRichContent.prototype = {
+
+    constructor: TooltipRichContent,
+
+    /**
+     * @private
+     * @type {boolean}
+     */
+    _enterable: true,
+
+    /**
+     * Update when tooltip is rendered
+     */
+    update: function () {
+    },
+
+    show: function (tooltipModel) {
+        if (this._hideTimeout) {
+            clearTimeout(this._hideTimeout);
+        }
+
+        this.el.attr('show', true);
+        this._show = true;
+    },
+
+    setContent: function (content, markerRich, tooltipModel) {
+        if (this.el) {
+            this._zr.remove(this.el);
+        }
+
+        var markers = {};
+        var text = content;
+        var prefix = '{marker';
+        var suffix = '|}';
+        var startId = text.indexOf(prefix);
+        while (startId >= 0) {
+            var endId = text.indexOf(suffix);
+            var name = text.substr(startId + prefix.length, endId - startId - prefix.length);
+            markers['marker' + name] = {
+                textWidth: 12,
+                textHeight: 12,
+                textBorderRadius: 6,
+                textBackgroundColor: markerRich[name]
+            };
+
+            text = text.substr(endId + 1);
+            startId = text.indexOf('{marker');
+        }
+
+        this.el = new Text({
+            style: {
+                rich: markers,
+                text: content,
+                textLineHeight: 20,
+                textBackgroundColor: tooltipModel.get('backgroundColor'),
+                textBorderRadius: tooltipModel.get('borderRadius'),
+                textFill: tooltipModel.get('textStyle.color'),
+                textPadding: tooltipModel.get('padding')
+            },
+            z: tooltipModel.get('z')
+        });
+        this._zr.add(this.el);
+    },
+
+    setEnterable: function (enterable) {
+        this._enterable = enterable;
+    },
+
+    getSize: function () {
+        var bounding = this.el.getBoundingRect();
+        return [bounding.width, bounding.height];
+    },
+
+    moveTo: function (x, y) {
+        if (this.el) {
+            this.el.attr('position', [x, y]);
+        }
+    },
+
+    hide: function () {
+    },
+
+    hideLater: function (time) {
+    },
+
+    isShow: function () {
+        return this._show;
+    },
+
+    getOuterSize: function () {
+        return this.getSize();
+    }
+};
+
+export default TooltipRichContent;
diff --git a/src/component/tooltip/TooltipView.js b/src/component/tooltip/TooltipView.js
index 4c21a24..ebf737d 100644
--- a/src/component/tooltip/TooltipView.js
+++ b/src/component/tooltip/TooltipView.js
@@ -21,6 +21,7 @@ import * as echarts from '../../echarts';
 import * as zrUtil from 'zrender/src/core/util';
 import env from 'zrender/src/core/env';
 import TooltipContent from './TooltipContent';
+import TooltipRichContent from './TooltipRichContent';
 import * as formatUtil from '../../util/format';
 import * as numberUtil from '../../util/number';
 import * as graphic from '../../util/graphic';
@@ -47,7 +48,23 @@ export default echarts.extendComponentView({
         if (env.node) {
             return;
         }
-        var tooltipContent = new TooltipContent(api.getDom(), api);
+        var tooltip = ecModel.get('tooltip');
+
+        this._isRich = false;
+        if (tooltip.length && tooltip[0].useHtml === false) {
+            this._isRich = true;
+        }
+
+        var tooltipContent
+        if (this._isRich) {
+            tooltipContent = new TooltipRichContent(api);
+        }
+        else {
+            tooltipContent = new TooltipContent(api.getDom(), api);
+        }
+
+        this._newLine = this._isRich ? '\n' : '<br/>';
+
         this._tooltipContent = tooltipContent;
     },
 
@@ -345,6 +362,11 @@ export default echarts.extendComponentView({
             globalTooltipModel
         ]);
 
+        var isRich = this._isRich;
+        var newLine = this._newLine;
+
+        var markers = {};
+
         each(dataByCoordSys, function (itemCoordSys) {
             // var coordParamList = [];
             // var coordDefaultHTML = [];
@@ -385,7 +407,18 @@ export default echarts.extendComponentView({
 
                     if (dataParams) {
                         singleParamsList.push(dataParams);
-                        seriesDefaultHTML.push(series.formatTooltip(dataIndex, true));
+                        var seriesTooltip = series.formatTooltip(dataIndex, true, null, isRich);
+
+                        var html;
+                        if (zrUtil.isObject(seriesTooltip)) {
+                            html = seriesTooltip.html;
+                            var newMarkers = seriesTooltip.markers;
+                            zrUtil.merge(markers, newMarkers);
+                        }
+                        else {
+                            html = seriesTooltip;
+                        }
+                        seriesDefaultHTML.push(html);
                     }
                 });
 
@@ -394,16 +427,21 @@ export default echarts.extendComponentView({
                 // (1) shold be the first data which has name?
                 // (2) themeRiver, firstDataIndex is array, and first line is unnecessary.
                 var firstLine = valueLabel;
-                singleDefaultHTML.push(
-                    (firstLine ? formatUtil.encodeHTML(firstLine) + '<br />' : '')
-                    + seriesDefaultHTML.join('<br />')
-                );
+                if (isRich) {
+                    singleDefaultHTML.push(seriesDefaultHTML.join(newLine))
+                }
+                else {
+                    singleDefaultHTML.push(
+                        (firstLine ? formatUtil.encodeHTML(firstLine) + newLine : '')
+                        + seriesDefaultHTML.join(newLine)
+                    );
+                }
             });
         }, this);
 
         // In most case, the second axis is shown upper than the first one.
         singleDefaultHTML.reverse();
-        singleDefaultHTML = singleDefaultHTML.join('<br /><br />');
+        singleDefaultHTML = singleDefaultHTML.join(this._newLine + this._newLine);
 
         var positionExpr = e.position;
         this._showOrMove(singleTooltipModel, function () {
@@ -419,7 +457,7 @@ export default echarts.extendComponentView({
             else {
                 this._showTooltipContent(
                     singleTooltipModel, singleDefaultHTML, singleParamsList, Math.random(),
-                    point[0], point[1], positionExpr
+                    point[0], point[1], positionExpr, undefined, markers
                 );
             }
         });
@@ -455,13 +493,23 @@ export default echarts.extendComponentView({
         }
 
         var params = dataModel.getDataParams(dataIndex, dataType);
-        var defaultHtml = dataModel.formatTooltip(dataIndex, false, dataType);
+        var seriesTooltip = dataModel.formatTooltip(dataIndex, false, dataType, this._isRich);
+        var defaultHtml, markers;
+        if (zrUtil.isObject(seriesTooltip)) {
+            defaultHtml = seriesTooltip.html;
+            markers = seriesTooltip.markers;
+        }
+        else {
+            defaultHtml = seriesTooltip;
+            markers = null;
+        }
+
         var asyncTicket = 'item_' + dataModel.name + '_' + dataIndex;
 
         this._showOrMove(tooltipModel, function () {
             this._showTooltipContent(
                 tooltipModel, defaultHtml, params, asyncTicket,
-                e.offsetX, e.offsetY, e.position, e.target
+                e.offsetX, e.offsetY, e.position, e.target, markers
             );
         });
 
@@ -509,7 +557,7 @@ export default echarts.extendComponentView({
     },
 
     _showTooltipContent: function (
-        tooltipModel, defaultHtml, params, asyncTicket, x, y, positionExpr, el
+        tooltipModel, defaultHtml, params, asyncTicket, x, y, positionExpr, el, markers
     ) {
         // Reset ticket
         this._ticket = '';
@@ -530,7 +578,7 @@ export default echarts.extendComponentView({
         else if (typeof formatter === 'function') {
             var callback = bind(function (cbTicket, html) {
                 if (cbTicket === this._ticket) {
-                    tooltipContent.setContent(html);
+                    tooltipContent.setContent(html, markers, tooltipModel);
                     this._updatePosition(
                         tooltipModel, positionExpr, x, y, tooltipContent, params, el
                     );
@@ -540,7 +588,7 @@ export default echarts.extendComponentView({
             html = formatter(params, asyncTicket, callback);
         }
 
-        tooltipContent.setContent(html);
+        tooltipContent.setContent(html, markers, tooltipModel);
         tooltipContent.show(tooltipModel);
 
         this._updatePosition(
@@ -604,7 +652,7 @@ export default echarts.extendComponentView({
         }
         else {
             var pos = refixTooltipPosition(
-                x, y, content.el, viewWidth, viewHeight, align ? null : 20, vAlign ? null : 20
+                x, y, content, viewWidth, viewHeight, align ? null : 20, vAlign ? null : 20
             );
             x = pos[0];
             y = pos[1];
@@ -615,7 +663,7 @@ export default echarts.extendComponentView({
 
         if (tooltipModel.get('confine')) {
             var pos = confineTooltipPosition(
-                x, y, content.el, viewWidth, viewHeight
+                x, y, content, viewWidth, viewHeight
             );
             x = pos[0];
             y = pos[1];
@@ -715,8 +763,8 @@ function makeDispatchAction(payload, api) {
     return payload.dispatchAction || zrUtil.bind(api.dispatchAction, api);
 }
 
-function refixTooltipPosition(x, y, el, viewWidth, viewHeight, gapH, gapV) {
-    var size = getOuterSize(el);
+function refixTooltipPosition(x, y, content, viewWidth, viewHeight, gapH, gapV) {
+    var size = content.getOuterSize();
     var width = size.width;
     var height = size.height;
 
@@ -739,8 +787,8 @@ function refixTooltipPosition(x, y, el, viewWidth, viewHeight, gapH, gapV) {
     return [x, y];
 }
 
-function confineTooltipPosition(x, y, el, viewWidth, viewHeight) {
-    var size = getOuterSize(el);
+function confineTooltipPosition(x, y, content, viewWidth, viewHeight) {
+    var size = content.getOuterSize();
     var width = size.width;
     var height = size.height;
 
@@ -752,25 +800,6 @@ function confineTooltipPosition(x, y, el, viewWidth, viewHeight) {
     return [x, y];
 }
 
-function getOuterSize(el) {
-    var width = el.clientWidth;
-    var height = el.clientHeight;
-
-    // Consider browser compatibility.
-    // IE8 does not support getComputedStyle.
-    if (document.defaultView && document.defaultView.getComputedStyle) {
-        var stl = document.defaultView.getComputedStyle(el);
-        if (stl) {
-            width += parseInt(stl.paddingLeft, 10) + parseInt(stl.paddingRight, 10)
-                + parseInt(stl.borderLeftWidth, 10) + parseInt(stl.borderRightWidth, 10);
-            height += parseInt(stl.paddingTop, 10) + parseInt(stl.paddingBottom, 10)
-                + parseInt(stl.borderTopWidth, 10) + parseInt(stl.borderBottomWidth, 10);
-        }
-    }
-
-    return {width: width, height: height};
-}
-
 function calcTooltipPosition(position, rect, contentSize) {
     var domWidth = contentSize[0];
     var domHeight = contentSize[1];
diff --git a/src/model/Series.js b/src/model/Series.js
index e3f8520..32db075 100644
--- a/src/model/Series.js
+++ b/src/model/Series.js
@@ -303,8 +303,15 @@ var SeriesModel = ComponentModel.extend({
      * @param {number} dataIndex
      * @param {boolean} [multipleSeries=false]
      * @param {number} [dataType]
+     * @param {boolean} [isRich=false]
+     * @return {Object} formatted tooltip with `html` and `markers`
      */
-    formatTooltip: function (dataIndex, multipleSeries, dataType) {
+    formatTooltip: function (dataIndex, multipleSeries, dataType, isRich) {
+
+        var series = this;
+        var newLine = isRich ? '\n' : '<br/>';
+        var markers = {};
+        var markerId = 0;
 
         function formatArrayValue(value) {
             // ??? TODO refactor these logic.
@@ -330,7 +337,8 @@ var SeriesModel = ComponentModel.extend({
                     return;
                 }
                 var dimType = dimInfo.type;
-                var dimHead = getTooltipMarker({color: color, type: 'subItem'});
+                var markName = series.seriesIndex + 'at' + markerId;
+                var dimHead = getTooltipMarker({color: color, type: 'subItem', isRich: isRich, markerId: markName});
                 var valStr = (vertially
                         ? dimHead + encodeHTML(dimInfo.displayName || '-') + ': '
                         : ''
@@ -343,9 +351,17 @@ var SeriesModel = ComponentModel.extend({
                         : addCommas(val)
                     );
                 valStr && result.push(valStr);
+
+                if (isRich) {
+                    markers[markName] = color;
+                    ++markerId;
+                }
             }
 
-            return (vertially ? '<br/>' : '') + result.join(vertially ? '<br/>' : ', ');
+            return {
+                html: (vertially ? isRich : '') + result.join(vertially ? isRich : ', '),
+                markers: markers
+            };
         }
 
         function formatSingleValue(val) {
@@ -371,7 +387,10 @@ var SeriesModel = ComponentModel.extend({
             ? formatSingleValue(retrieveRawValue(data, dataIndex, tooltipDims[0]))
             : formatSingleValue(isValueArr ? value[0] : value);
 
-        var colorEl = getTooltipMarker(color);
+        var markName = series.seriesIndex + 'at' + markerId;
+        var colorEl = getTooltipMarker({ color: color, type: 'item', isRich: isRich, markerId: markName });
+        markers[markName] = color;
+        ++markerId;
 
         var name = data.getName(dataIndex);
 
@@ -380,16 +399,21 @@ var SeriesModel = ComponentModel.extend({
             seriesName = '';
         }
         seriesName = seriesName
-            ? encodeHTML(seriesName) + (!multipleSeries ? '<br/>' : ': ')
+            ? encodeHTML(seriesName) + (!multipleSeries ? newLine : ': ')
             : '';
 
-        return !multipleSeries
+        var html = !multipleSeries
             ? seriesName + colorEl
                 + (name
                     ? encodeHTML(name) + ': ' + formattedValue
                     : formattedValue
                 )
             : colorEl + seriesName + formattedValue;
+
+        return {
+            html: html,
+            markers: markers
+        };
     },
 
     /**
diff --git a/src/util/format.js b/src/util/format.js
index 7f20623..119756b 100644
--- a/src/util/format.js
+++ b/src/util/format.js
@@ -135,6 +135,7 @@ export function formatTplSimple(tpl, param, encode) {
  * @param {string} [opt.color]
  * @param {string} [opt.extraCssText]
  * @param {string} [opt.type='item'] 'item' or 'subItem'
+ * @param {boolean} [opt.isRich=false] if renders with rich text
  * @return {string}
  */
 export function getTooltipMarker(opt, extraCssText) {
@@ -142,18 +143,25 @@ export function getTooltipMarker(opt, extraCssText) {
     var color = opt.color;
     var type = opt.type;
     var extraCssText = opt.extraCssText;
+    var isRich = opt.isRich == null ? false : opt.isRich;
 
     if (!color) {
         return '';
     }
 
-    return type === 'subItem'
+    if (isRich) {
+        // Space for rich element marker
+        return '{marker' + opt.markerId + '|}  ';
+    }
+    else {
+        return type === 'subItem'
         ? '<span style="display:inline-block;vertical-align:middle;margin-right:8px;margin-left:3px;'
             + 'border-radius:4px;width:4px;height:4px;background-color:'
             + encodeHTML(color) + ';' + (extraCssText || '') + '"></span>'
         : '<span style="display:inline-block;margin-right:5px;'
             + 'border-radius:10px;width:10px;height:10px;background-color:'
             + encodeHTML(color) + ';' + (extraCssText || '') + '"></span>';
+    }
 }
 
 function pad(str, len) {
diff --git a/test/tooltip-rich.html b/test/tooltip-rich.html
new file mode 100644
index 0000000..275dead
--- /dev/null
+++ b/test/tooltip-rich.html
@@ -0,0 +1,92 @@
+
+<!--
+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">
+        <script src="lib/esl.js"></script>
+        <script src="lib/config.js"></script>
+        <meta name="viewport" content="width=device-width, initial-scale=1" />
+    </head>
+    <body>
+        <style>
+            html, body, #main {
+                width: 100%;
+                height: 100%;
+                margin: 0;
+            }
+            #main {
+                background: #fff;
+            }
+        </style>
+        <div id="main"></div>
+        <script>
+
+            require([
+                'echarts'
+                // 'echarts/chart/bar',
+                // 'echarts/chart/line',
+                // 'echarts/component/legend',
+                // 'echarts/component/grid',
+                // 'echarts/component/tooltip',
+                // 'echarts/component/toolbox',
+                // 'echarts/component/title',
+                // 'zrender/vml/vml'
+            ], function (echarts) {
+
+                var chart = echarts.init(document.getElementById('main'));
+
+                chart.setOption({
+                    backgroundColor: '#eee',
+                    title: {
+                        text: '我是柱状图',
+                        padding: 20
+                    },
+                    tooltip: {
+                        show: true,
+                        // useHtml: false
+                    },
+                    yAxis: {
+                        type: 'value'
+                    },
+                    xAxis: {
+                        type: 'category',
+                        data: ['A', 'B', 'C']
+                    },
+                    series: [{
+                        name: 'bar0',
+                        type: 'bar',
+                        data: [2, 3, 6]
+                    }, {
+                        name: 'bar1',
+                        type: 'bar',
+                        data: [1, 0, 9]
+                    }, {
+                        name: 'bar2',
+                        type: 'bar',
+                        data: ['-', 2, 1]
+                    }]
+                });
+
+                window.onresize = chart.resize;
+            });
+        </script>
+    </body>
+</html>
\ No newline at end of file

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

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


[incubator-echarts] 03/05: test(tooltip): test for non-html tooltip

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

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

commit 311df99772d7f9c378ad2af7183ecc121d292418
Author: Ovilia <zw...@gmail.com>
AuthorDate: Wed Jun 13 17:11:54 2018 +0800

    test(tooltip): test for non-html tooltip
---
 test/tooltip-rich.html | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/test/tooltip-rich.html b/test/tooltip-rich.html
index 275dead..82f3e96 100644
--- a/test/tooltip-rich.html
+++ b/test/tooltip-rich.html
@@ -55,13 +55,10 @@ under the License.
 
                 chart.setOption({
                     backgroundColor: '#eee',
-                    title: {
-                        text: '我是柱状图',
-                        padding: 20
-                    },
                     tooltip: {
                         show: true,
-                        // useHtml: false
+                        useHtml: false,
+                        trigger: 'axis'
                     },
                     yAxis: {
                         type: 'value'

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

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


[incubator-echarts] 05/05: Merge branch 'master' of github.com:ecomfe/echarts

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

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

commit 46c4c3f2af10c71aa136ca81981c57fb6b5d48b8
Merge: c7d7d19 6d89822
Author: Ovilia <zw...@gmail.com>
AuthorDate: Wed Jun 13 17:25:40 2018 +0800

    Merge branch 'master' of github.com:ecomfe/echarts

 .rat-excludes => .headerignore                     |  11 +-
 LICENSE                                            |  36 +-
 README.md                                          |   7 +
 build/addHeader.js                                 |  12 +-
 build/preamble.js                                  |   3 +-
 build/rat/apache-rat-0.12.jar                      | Bin 1592593 -> 0 bytes
 build/rat/build-run-rat.sh                         |  25 -
 build/rat/javassist.jar                            | Bin 759215 -> 0 bytes
 build/rat/rat.sh                                   |  63 ---
 build/rat/runrat.jar                               | Bin 2561 -> 0 bytes
 build/rat/src/MANIFEST.txt                         |   2 -
 build/rat/src/RunRat.class                         | Bin 3914 -> 0 bytes
 build/rat/src/RunRat.java                          | 184 --------
 build/rat/src/report.xsl                           |  88 ----
 extension-src/dataTool/prepareBoxplotData.js       |   7 +-
 extension-src/dataTool/quantile.js                 |  60 ---
 src/chart/custom.js                                |  63 ++-
 src/chart/graph/GraphView.js                       |  20 +-
 src/chart/graph/graphAction.js                     |  26 +-
 .../focusNodeAdjacencyAction.js}                   |  33 +-
 src/chart/sankey/SankeySeries.js                   |   2 +
 src/chart/sankey/SankeyView.js                     | 162 ++++++-
 src/chart/sankey/sankeyAction.js                   |   6 +
 src/chart/themeRiver/themeRiverVisual.js           |   2 +-
 src/chart/tree.js                                  |   2 +-
 src/chart/tree/TreeSeries.js                       |  20 +-
 src/chart/tree/TreeView.js                         | 127 ++++-
 src/chart/tree/layoutHelper.js                     |   2 +-
 src/chart/tree/treeAction.js                       |  19 +
 src/chart/treemap/TreemapView.js                   |  13 +-
 src/component/axisPointer/IAxisPointer             |  20 +
 src/component/dataZoom/InsideZoomModel.js          |   1 +
 src/component/dataZoom/InsideZoomView.js           |  92 ++--
 src/component/dataZoom/roams.js                    |  87 ++--
 src/component/helper/MapDraw.js                    | 103 +++--
 src/component/helper/RoamController.js             |  91 +++-
 src/component/tooltip/TooltipContent.js            |   7 +
 src/coord/ICoordinateSystem                        |  19 +
 src/coord/axisHelper.js                            |   3 +
 src/coord/geo/Geo.js                               | 126 ++---
 src/coord/geo/GeoModel.js                          |   5 +-
 src/coord/geo/Region.js                            |  10 +-
 src/coord/geo/fix/diaoyuIsland.js                  |  16 +-
 src/coord/geo/fix/geoCoord.js                      |   8 +-
 src/coord/geo/fix/nanhai.js                        |   6 +-
 src/coord/geo/fix/textCoord.js                     |   8 +-
 src/coord/geo/geoCreator.js                        |  80 ++--
 src/coord/geo/geoJSONLoader.js                     |  94 ++++
 src/coord/geo/geoSVGLoader.js                      | 143 ++++++
 src/coord/geo/geoSourceManager.js                  | 126 +++++
 src/coord/geo/mapDataStorage.js                    | 104 +++++
 src/coord/geo/prepareCustom.js                     |   3 +-
 src/echarts.js                                     |  38 +-
 src/scale/Time.js                                  |   4 +-
 src/util/number.js                                 |  44 ++
 src/view/Chart.js                                  |   1 +
 test/axis-interval.html                            |  71 +++
 test/axisLabel.html                                |  71 ++-
 test/dataZoom-scroll.html                          | 145 ++++++
 test/geoScatter.html                               |  11 +-
 test/sankey-test.html                              | 314 +++++++------
 test/sankey.html                                   |   1 +
 test/tooltip-event.html                            | 151 ++++++
 test/touch-slide.html                              | 509 +++++++++++++++++++++
 test/tree-image.html                               |   2 +-
 test/{sankey.html => tree-roam.html}               |  59 ++-
 66 files changed, 2495 insertions(+), 1073 deletions(-)


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

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


[incubator-echarts] 02/05: feat(tooltip): use non-html tooltip when document is not defined

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

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

commit 883e024737c1151ae5d40c39506ec0525c161f40
Author: Ovilia <zw...@gmail.com>
AuthorDate: Wed Jun 13 17:10:53 2018 +0800

    feat(tooltip): use non-html tooltip when document is not defined
---
 src/component/tooltip/TooltipModel.js | 5 ++++-
 src/component/tooltip/TooltipView.js  | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/component/tooltip/TooltipModel.js b/src/component/tooltip/TooltipModel.js
index 3161aaa..5fe862b 100644
--- a/src/component/tooltip/TooltipModel.js
+++ b/src/component/tooltip/TooltipModel.js
@@ -46,7 +46,10 @@ export default echarts.extendComponentModel({
 
         displayMode: 'single', // 'single' | 'multipleByCoordSys'
 
-        useHtml: true,
+        useHtml: 'auto', // 'auto', true, or false
+        // 'auto': use html by default, and use non-html if `document` is not defined
+        // true: use html for tooltip
+        // false: use canvas, svg, and etc. for tooltip
 
         // 位置 {Array} | {Function}
         // position: null
diff --git a/src/component/tooltip/TooltipView.js b/src/component/tooltip/TooltipView.js
index ebf737d..0427904 100644
--- a/src/component/tooltip/TooltipView.js
+++ b/src/component/tooltip/TooltipView.js
@@ -51,7 +51,9 @@ export default echarts.extendComponentView({
         var tooltip = ecModel.get('tooltip');
 
         this._isRich = false;
-        if (tooltip.length && tooltip[0].useHtml === false) {
+        if (tooltip.length && (tooltip[0].useHtml === false // force using non-html
+            || tooltip[0].useHtml === 'auto' && !document)) // auto using non-html when no `document`
+        {
             this._isRich = true;
         }
 

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

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