S06: Add chart with advanced annotations#15
Conversation
jedrzejruta
left a comment
There was a problem hiding this comment.
Great work on this task! 👏
Minor things to adjust:
| series: [{ | ||
| data: data | ||
| }], | ||
| const chart = Highcharts.stockChart('container', { |
There was a problem hiding this comment.
Nitpicking here, but you can safely remove the const assignment, since the variable isn't used anywhere later on.
| x, | ||
| y | ||
| }, | ||
| draggable: true, |
There was a problem hiding this comment.
This assignment is not needed, since the default option is set to 'xy': https://api.highcharts.com/highcharts/annotations.draggable
| y: 30, | ||
| shape: 'rect', | ||
| text: Math.trunc(y), | ||
| align: 'center', |
There was a problem hiding this comment.
| label.options.text = Math.trunc(rectY); | ||
| label.redraw(false); |
There was a problem hiding this comment.
This is an interesting option to update the props of the label, as it directly saves the prop into options and later redraws it. There is another way worth mentioning, by simply updating the label using label.update:
label.update({
text: y
});
jedrzejruta
left a comment
There was a problem hiding this comment.
Nicely done, thanks! 👏
No description provided.