最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

highcharts - Wind Rose with pulsating marker? - Stack Overflow

programmeradmin0浏览0评论

I am having some difficulties using the pulsating marker you can see on this example, but on a wind rose in highchart.

When trying to recreate it, it looks like the animation only shows on the left side of the container?

Here's my fiddle to illustrate my problem.

        series.pulse
        .attr({
            x: series.xAxis.toPixels(point.x, true),
            y: series.yAxis.toPixels(point.y, true),
            r: series.options.marker.radius,
            opacity: 1,
            fill: series.color
        })
        .animate({
            r: 20,
            opacity: 0
        }, {
            duration: 1000
        });

I am having some difficulties using the pulsating marker you can see on this example, but on a wind rose in highchart.

When trying to recreate it, it looks like the animation only shows on the left side of the container?

Here's my fiddle to illustrate my problem.

        series.pulse
        .attr({
            x: series.xAxis.toPixels(point.x, true),
            y: series.yAxis.toPixels(point.y, true),
            r: series.options.marker.radius,
            opacity: 1,
            fill: series.color
        })
        .animate({
            r: 20,
            opacity: 0
        }, {
            duration: 1000
        });
Share Improve this question asked Mar 3 at 11:50 AlphaFr34kAlphaFr34k 111 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

You need to convert cartesian coordinates to the polar ones in your plugin, something along these lines:

    ...
    const point = e.point,
        series = e.target,
        chart = series.chart,
        renderer = chart.renderer,
        angle = point.x,
        radius = point.y;

    const centerX = chart.plotWidth / 2 + chart.plotLeft;
    const centerY = chart.plotHeight / 2 + chart.plotTop;
    const radians = deg2rad(angle); //you can easily define such helper
    const x = centerX + radius * Math.cos(radians);
    const y = centerY + radius * Math.sin(radians);

That change should help to position the pulsating point within the plot area, then, you need to find a way to connect the pulse with the new points.

Happy charting!

发布评论

评论列表(0)

  1. 暂无评论