diff --git a/doc/example/scatter1.html b/doc/example/scatter1.html
index 20ad8e7f039763dd0049fef9102f3e44064a86e3..cd03f6795b8ff272f84393b0a36619867bb2a697 100644
--- a/doc/example/scatter1.html
+++ b/doc/example/scatter1.html
@@ -53,18 +53,6 @@ option = {
type : 'dashed',
width : 1
}
- },
- formatter : function (value) {
- if (value[2].length > 1) {
- return value[0] + ' :
'
- + value[2][0] + 'cm '
- + value[2][1] + 'kg ';
- }
- else {
- return value[0] + ' :
'
- + value[1] + ' : '
- + value[2] + 'kg ';
- }
}
},
legend: {
@@ -106,6 +94,21 @@ option = {
{
name:'女性',
type:'scatter',
+ tooltip : {
+ trigger: 'item',
+ formatter : function (value) {
+ if (value[2].length > 1) {
+ return value[0] + ' :
'
+ + value[2][0] + 'cm '
+ + value[2][1] + 'kg ';
+ }
+ else {
+ return value[0] + ' :
'
+ + value[1] + ' : '
+ + value[2] + 'kg ';
+ }
+ }
+ },
data: [[161.2, 51.6], [167.5, 59.0], [159.5, 49.2], [157.0, 63.0], [155.8, 53.6],
[170.0, 59.0], [159.1, 47.6], [166.0, 69.8], [176.2, 66.8], [160.2, 75.2],
[172.5, 55.2], [170.9, 54.2], [172.9, 62.5], [153.4, 42.0], [160.0, 50.0],
@@ -174,6 +177,21 @@ option = {
{
name:'男性',
type:'scatter',
+ tooltip : {
+ trigger: 'item',
+ formatter : function (value) {
+ if (value[2].length > 1) {
+ return value[0] + ' :
'
+ + value[2][0] + 'cm '
+ + value[2][1] + 'kg ';
+ }
+ else {
+ return value[0] + ' :
'
+ + value[1] + ' : '
+ + value[2] + 'kg ';
+ }
+ }
+ },
data: [[174.0, 65.6], [175.3, 71.8], [193.5, 80.7], [186.5, 72.6], [187.2, 78.8],
[181.5, 74.8], [184.0, 86.4], [184.5, 78.4], [175.0, 62.0], [184.0, 81.6],
[180.0, 76.6], [177.8, 83.6], [192.0, 90.0], [176.0, 74.6], [174.0, 71.0],
diff --git a/doc/example/tooltip.html b/doc/example/tooltip.html
index 0e1a7008a1dd92487d2719457f8e1eedb20f767a..6dca4c4f889509c5b34f8344ca622082eb8f8f1d 100644
--- a/doc/example/tooltip.html
+++ b/doc/example/tooltip.html
@@ -53,7 +53,7 @@ option = {
padding: 10, // [5, 10, 15, 20]
position : function(p) {
// 位置回调
- console.log && console.log(p);
+ // console.log && console.log(p);
return [p[0] + 10, p[1] - 10];
},
textStyle : {
@@ -65,6 +65,7 @@ option = {
fontWeight: 'bold'
},
formatter: function (params,ticket,callback) {
+ console.log(params)
var res = 'Function formatter :
' + params[0][1];
for (var i = 0, l = params.length; i < l; i++) {
res += '
' + params[i][0] + ' : ' + params[i][2];
@@ -98,7 +99,10 @@ option = {
{
name:'坐标轴触发1',
type:'bar',
- data:[320, 332, 301, 334, 390, 330, 320]
+ data:[
+ {value:320, extra:'Hello~'},
+ 332, 301, 334, 390, 330, 320
+ ]
},
{
name:'坐标轴触发2',
diff --git a/src/component/axis.js b/src/component/axis.js
index 99b54a00cdc6922c5259c43b8d88dad6dbd71251..b18a764cafbe937f652d3635bcbcc87911510cd4 100644
--- a/src/component/axis.js
+++ b/src/component/axis.js
@@ -217,14 +217,13 @@ define(function (require) {
// 最多两条,其他参数忽略
if (opt.length > 2) {
- opt = [opt[0],opt[1]];
+ opt = [opt[0], opt[1]];
}
if (this.axisType === 'xAxis') {
// 横轴位置默认配置
if (!opt[0].position // 没配置或配置错
- || (opt[0].position != 'bottom'
- && opt[0].position != 'top')
+ || (opt[0].position != 'bottom' && opt[0].position != 'top')
) {
opt[0].position = 'bottom';
}
@@ -243,8 +242,7 @@ define(function (require) {
else {
// 纵轴位置默认配置
if (!opt[0].position // 没配置或配置错
- || (opt[0].position != 'left'
- && opt[0].position != 'right')
+ || (opt[0].position != 'left' && opt[0].position != 'right')
) {
opt[0].position = 'left';
}