amcharts5 icon indicating copy to clipboard operation
amcharts5 copied to clipboard

Incorrect value in legendLabelText placeholder

Open olimexsmart opened this issue 1 year ago • 4 comments

I've modified the Step Line Chart example to include a legend that updates its text to the Y value currently pointed by the cursor:

Here the jsfiddle

The problem is that the value is correct only in the first half of the step, while in the second half it updates already to the next value.

correct wrong

olimexsmart avatar Jul 29 '22 12:07 olimexsmart

Both of your screenshots show same value in series tooltip and legend. Same thing in the jsFiddle.

What am I missing?

martynasma avatar Jul 29 '22 12:07 martynasma

The problem is that in both screenshots the cursor is on the same "step".

The expected behavior is that the value (in tooltip and legend both) is 0.019 in both screenshots.

I did not notice that the same problem is on the tooltip too, my guess at this point is that the bug is not on the legend but rather on the cursor or placeholder.

olimexsmart avatar Jul 29 '22 15:07 olimexsmart

This is how ValueAxis works, it shows tooltip of the nearest data point. To solve your problem, you should change your xAxis type to DateAxis and then set xAxis for your cursor. This way the line will snap to the position where the tooltip is: https://codepen.io/team/amcharts/pen/rNdJWzG

I don't see a way to solve this with ValueAxis.

zeroin avatar Aug 02 '22 07:08 zeroin

Thanks, let's see what the authors decide to do about this

olimexsmart avatar Aug 04 '22 12:08 olimexsmart

This issue is stale because it has been open 30 days with no activity. It will be closed in 5 days unless a new comment is added.

github-actions[bot] avatar Sep 04 '22 00:09 github-actions[bot]