[incubator-echarts] 02/02: test: add test case for b3a25482 #10202

2019-04-10 Thread ovilia
This is an automated email from the ASF dual-hosted git repository.

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

commit b6cb7bd122eff590696e9e44817410ba58baaf84
Author: Ovilia 
AuthorDate: Wed Apr 10 15:50:32 2019 +0800

test: add test case for b3a25482 #10202
---
 test/toolbox-tooltip.html | 130 ++
 1 file changed, 130 insertions(+)

diff --git a/test/toolbox-tooltip.html b/test/toolbox-tooltip.html
new file mode 100644
index 000..6abd4a5
--- /dev/null
+++ b/test/toolbox-tooltip.html
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+html,
+body,
+#main {
+width: 80%;
+height: 100%;
+margin: 0;
+}
+
+#main {
+background: #fff;
+}
+
+
+
+
+require([
+'echarts'
+// 'echarts/chart/bar',
+// 'echarts/component/polar',
+// 'zrender/vml/vml'
+], function (echarts) {
+
+var chart = echarts.init(document.getElementById('main'), null, {
+// renderer: 'svg'
+});
+option = {
+color: ['#3398DB'],
+legend: {
+show: true,
+data: ['Bar'],
+tooltip: {
+show: true,
+backgroundColor: 'red'
+}
+},
+tooltip: {
+show: true
+},
+toolbox: {
+show: true,
+showTitle: false,
+feature: {
+saveAsImage: {
+show: true,
+title: 'Save As Image'
+},
+dataView: {
+show: true,
+title: 'Data View'
+},
+},
+tooltip: {
+show: true,
+formatter: function (param) {
+return param.title;
+},
+backgroundColor: '#222',
+textStyle: {
+fontSize: 12,
+},
+extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);'
+}
+},
+grid: {
+left: '3%',
+right: '4%',
+bottom: '3%',
+containLabel: true
+},
+xAxis : [
+{
+type : 'category',
+data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 
'Sun'],
+axisTick: {
+alignWithLabel: true
+}
+}
+],
+yAxis : [
+{
+type : 'value'
+}
+],
+series : [
+{
+name:'Bar',
+type:'bar',
+barWidth: '60%',
+data:[10, 52, 200, 334, 390, 330, 220]
+}
+]
+};
+
+chart.setOption(option, true);
+
+});
+
+
+
+
\ No newline at end of file


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



[incubator-echarts] branch fix-10202-tooltip created (now b6cb7bd)

2019-04-10 Thread ovilia
This is an automated email from the ASF dual-hosted git repository.

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


  at b6cb7bd  test: add test case for b3a25482 #10202

This branch includes the following new commits:

 new b3a2548  feat: support tooltip for toolbox #10202
 new b6cb7bd  test: add test case for b3a25482 #10202

The 2 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.



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



[incubator-echarts] 01/02: feat: support tooltip for toolbox #10202

2019-04-10 Thread ovilia
This is an automated email from the ASF dual-hosted git repository.

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

commit b3a2548242869479f9a846ef78b6dac48da9de1f
Author: Ovilia 
AuthorDate: Wed Apr 10 15:48:30 2019 +0800

feat: support tooltip for toolbox #10202
---
 src/component/toolbox/ToolboxModel.js |  6 +-
 src/component/toolbox/ToolboxView.js  | 17 +
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/component/toolbox/ToolboxModel.js 
b/src/component/toolbox/ToolboxModel.js
index fadf2a1..f647409 100644
--- a/src/component/toolbox/ToolboxModel.js
+++ b/src/component/toolbox/ToolboxModel.js
@@ -80,10 +80,14 @@ var ToolboxModel = echarts.extendComponentModel({
 iconStyle: {
 borderColor: '#3E98C5'
 }
-}
+},
 // textStyle: {},
 
 // feature
+
+tooltip: {
+show: false
+}
 }
 });
 
diff --git a/src/component/toolbox/ToolboxView.js 
b/src/component/toolbox/ToolboxView.js
index 1f99178..43c12c9 100644
--- a/src/component/toolbox/ToolboxView.js
+++ b/src/component/toolbox/ToolboxView.js
@@ -157,6 +157,23 @@ export default echarts.extendComponentView({
 path.setStyle(iconStyleModel.getItemStyle());
 path.hoverStyle = iconStyleEmphasisModel.getItemStyle();
 
+var tooltipModel = toolboxModel.getModel('tooltip');
+if (tooltipModel && tooltipModel.get('show')) {
+path.attr('tooltip', zrUtil.extend({
+content: titles[iconName],
+formatter: tooltipModel.get('formatter', true)
+|| function () {
+return titles[iconName];
+},
+formatterParams: {
+componentType: 'toolbox',
+name: iconName,
+title: titles[iconName],
+$vars: ['name', 'title']
+}
+}, tooltipModel.option));
+}
+
 graphic.setHoverStyle(path);
 
 if (toolboxModel.get('showTitle')) {


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