Skip to content

Commit

Permalink
Merge pull request #11985 from apache/fix-11801
Browse files Browse the repository at this point in the history
fix bug #11801 Throw error when the action 'showTip' dispatched in radar chart
  • Loading branch information
pissang authored Jan 7, 2020
2 parents 7d23849 + 2039e1d commit f2927d3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
22 changes: 22 additions & 0 deletions src/chart/radar/RadarSeries.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,28 @@ var RadarSeries = SeriesModel.extend({
}).join('<br />');
},

/**
* @implement
*/
getTooltipPosition: function (dataIndex) {
if (dataIndex != null) {
var data = this.getData();
var coordSys = this.coordinateSystem;
var values = data.getValues(
zrUtil.map(coordSys.dimensions, function (dim) {
return data.mapDimension(dim);
}), dataIndex, true
);

for (var i = 0, len = values.length; i < len; i++) {
if (!isNaN(values[i])) {
var indicatorAxis = coordSys._indicatorAxes[i];
return coordSys.coordToPoint(indicatorAxis.dataToCoord(values[i]), i);
}
}
}
},

defaultOption: {
zlevel: 0,
z: 2,
Expand Down
15 changes: 12 additions & 3 deletions test/radar.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,19 @@
]
}]
});

var theIndex = 2;
chart.on('click', function (params) {
console.log(params)
})
console.log(params);
if (theIndex < 0) {
theIndex = 2;
}
chart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: theIndex
});
theIndex--;
});
});

</script>
Expand Down
2 changes: 1 addition & 1 deletion test/runTest/actions/__meta__.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"polar-rounded": 3,
"polarLine": 1,
"polarScatter": 1,
"radar": 1,
"radar": 2,
"radar2": 1,
"radar3": 1,
"radar4": 1,
Expand Down
2 changes: 1 addition & 1 deletion test/runTest/actions/radar.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"Action 1","ops":[{"type":"mousedown","time":340,"x":163,"y":20},{"type":"mouseup","time":450,"x":163,"y":20},{"time":451,"delay":500,"type":"screenshot-auto"},{"type":"mousemove","time":510,"x":168,"y":20},{"type":"mousemove","time":711,"x":320,"y":20},{"type":"mousemove","time":916,"x":339,"y":19},{"type":"mousedown","time":967,"x":339,"y":19},{"type":"mouseup","time":1060,"x":339,"y":19},{"time":1061,"delay":500,"type":"screenshot-auto"},{"type":"mousemove","time":1161,"x":341,"y":19},{"type":"mousemove","time":1361,"x":613,"y":16},{"type":"mousemove","time":1567,"x":643,"y":16},{"type":"mousedown","time":1619,"x":643,"y":16},{"type":"mouseup","time":1704,"x":643,"y":16},{"time":1705,"delay":500,"type":"screenshot-auto"},{"type":"mousedown","time":2574,"x":643,"y":16},{"type":"mouseup","time":2684,"x":643,"y":16},{"time":2685,"delay":500,"type":"screenshot-auto"},{"type":"mousemove","time":2761,"x":642,"y":16},{"type":"mousemove","time":2963,"x":564,"y":22},{"type":"mousemove","time":3163,"x":520,"y":20},{"type":"mousedown","time":3306,"x":517,"y":18},{"type":"mousemove","time":3372,"x":517,"y":18},{"type":"mouseup","time":3391,"x":517,"y":18},{"time":3392,"delay":500,"type":"screenshot-auto"},{"type":"mousemove","time":3820,"x":508,"y":19},{"type":"mousemove","time":4020,"x":227,"y":17},{"type":"mousedown","time":4182,"x":226,"y":17},{"type":"mousemove","time":4229,"x":226,"y":17},{"type":"mouseup","time":4285,"x":226,"y":17},{"time":4286,"delay":500,"type":"screenshot-auto"}],"scrollY":0,"scrollX":0,"timestamp":1568043188752}]
[{"name":"Action 1","ops":[{"type":"mousedown","time":340,"x":163,"y":20},{"type":"mouseup","time":450,"x":163,"y":20},{"time":451,"delay":500,"type":"screenshot-auto"},{"type":"mousemove","time":510,"x":168,"y":20},{"type":"mousemove","time":711,"x":320,"y":20},{"type":"mousemove","time":916,"x":339,"y":19},{"type":"mousedown","time":967,"x":339,"y":19},{"type":"mouseup","time":1060,"x":339,"y":19},{"time":1061,"delay":500,"type":"screenshot-auto"},{"type":"mousemove","time":1161,"x":341,"y":19},{"type":"mousemove","time":1361,"x":613,"y":16},{"type":"mousemove","time":1567,"x":643,"y":16},{"type":"mousedown","time":1619,"x":643,"y":16},{"type":"mouseup","time":1704,"x":643,"y":16},{"time":1705,"delay":500,"type":"screenshot-auto"},{"type":"mousedown","time":2574,"x":643,"y":16},{"type":"mouseup","time":2684,"x":643,"y":16},{"time":2685,"delay":500,"type":"screenshot-auto"},{"type":"mousemove","time":2761,"x":642,"y":16},{"type":"mousemove","time":2963,"x":564,"y":22},{"type":"mousemove","time":3163,"x":520,"y":20},{"type":"mousedown","time":3306,"x":517,"y":18},{"type":"mousemove","time":3372,"x":517,"y":18},{"type":"mouseup","time":3391,"x":517,"y":18},{"time":3392,"delay":500,"type":"screenshot-auto"},{"type":"mousemove","time":3820,"x":508,"y":19},{"type":"mousemove","time":4020,"x":227,"y":17},{"type":"mousedown","time":4182,"x":226,"y":17},{"type":"mousemove","time":4229,"x":226,"y":17},{"type":"mouseup","time":4285,"x":226,"y":17},{"time":4286,"delay":500,"type":"screenshot-auto"}],"scrollY":0,"scrollX":0,"timestamp":1568043188752},{"name":"Action 2","ops":[{"type":"mousemove","time":600,"x":777,"y":264},{"type":"mousemove","time":806,"x":704,"y":236},{"type":"mousemove","time":933,"x":703,"y":232},{"type":"mousemove","time":1135,"x":688,"y":208},{"type":"mousemove","time":1333,"x":682,"y":201},{"type":"mousemove","time":1533,"x":682,"y":200},{"type":"mousemove","time":1737,"x":682,"y":197},{"type":"mousedown","time":1745,"x":682,"y":197},{"type":"mouseup","time":1908,"x":682,"y":197},{"time":1909,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":2283,"x":682,"y":197},{"type":"mousedown","time":2325,"x":682,"y":196},{"type":"mouseup","time":2489,"x":682,"y":196},{"time":2490,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":2497,"x":682,"y":196},{"type":"mousemove","time":2900,"x":682,"y":196},{"type":"mousedown","time":2940,"x":682,"y":196},{"type":"mouseup","time":3111,"x":682,"y":196},{"time":3112,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":3499,"x":688,"y":199},{"type":"mousemove","time":3708,"x":798,"y":281}],"scrollY":0,"scrollX":0,"timestamp":1578309102517}]

0 comments on commit f2927d3

Please sign in to comment.