Skip to content

S06: Add chart with advanced annotations#15

Open
dqmrf wants to merge 2 commits into
mainfrom
highcharts-stock/06-advanced-annotations
Open

S06: Add chart with advanced annotations#15
dqmrf wants to merge 2 commits into
mainfrom
highcharts-stock/06-advanced-annotations

Conversation

@dqmrf

@dqmrf dqmrf commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@dqmrf dqmrf requested a review from jedrzejruta July 2, 2026 06:25

@jedrzejruta jedrzejruta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this task! 👏

Minor things to adjust:

series: [{
data: data
}],
const chart = Highcharts.stockChart('container', {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking here, but you can safely remove the const assignment, since the variable isn't used anywhere later on.

x,
y
},
draggable: true,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +49 to +50
label.options.text = Math.trunc(rectY);
label.redraw(false);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
});

@dqmrf dqmrf requested a review from jedrzejruta July 2, 2026 12:41

@jedrzejruta jedrzejruta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done, thanks! 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants