diff --git a/src/chart/radar/RadarSeries.js b/src/chart/radar/RadarSeries.js index 8d6d7b4524..6bd5ee12e5 100644 --- a/src/chart/radar/RadarSeries.js +++ b/src/chart/radar/RadarSeries.js @@ -61,6 +61,28 @@ var RadarSeries = SeriesModel.extend({ }).join('
'); }, + /** + * @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, diff --git a/test/radar.html b/test/radar.html index 4ab8f19e30..c0714748a1 100644 --- a/test/radar.html +++ b/test/radar.html @@ -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--; + }); }); diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json index b1e898d2ee..f643c59ba4 100644 --- a/test/runTest/actions/__meta__.json +++ b/test/runTest/actions/__meta__.json @@ -112,7 +112,7 @@ "polar-rounded": 3, "polarLine": 1, "polarScatter": 1, - "radar": 1, + "radar": 2, "radar2": 1, "radar3": 1, "radar4": 1, diff --git a/test/runTest/actions/radar.json b/test/runTest/actions/radar.json index a7cb593248..78fd324c4e 100644 --- a/test/runTest/actions/radar.json +++ b/test/runTest/actions/radar.json @@ -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}] \ No newline at end of file +[{"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}] \ No newline at end of file