如何在图表点amCharts 4中添加圆或其他精灵,并在图表调整大小时调整其大小

amcharts 4 中,我想基于光标位置在图表点中创建形状。 我试过了并且有效。我使用以下代码跟踪鼠标位置:

cursorPosition = {
    point: null
}

chart.cursor.events.on("cursorpositionchanged",trackMouse);
function trackMouse(event){
    cursorPosition.point = event.target.point;
}

我绘制了一个这样的形状(在此情况下,为简单起见,为圆形,但我还需要绘制线条和矩形)

var temporaryPoint = thisChart.createChild(am4core.Circle);
temporaryPoint.nonScaling = false;
temporaryPoint.fillOpacity = 0;
temporaryPoint.stroke = "#5555FF";
temporaryPoint.strokeWidth = 1.5;
temporaryPoint.width = 10;
temporaryPoint.height = 10;
temporaryPoint.moveTo(cursorPosition.point);

现在,问题是每次我调整图表大小时,圆圈都不会停留在轴位置上。 我尝试使用this tutorial中的代码来更改行为,并将圆的x和y设置为轴的值,但这不起作用。

我怎样才能使形状坚持轴值而不是x和y位置? 替代方法是每次调整图表大小时都会调整大小和移动,但是我该如何精确地做到这一点?

fderfr 回答:如何在图表点amCharts 4中添加圆或其他精灵,并在图表调整大小时调整其大小

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3167979.html

大家都在问