Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

highcharts/3-stacked-bar #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

jszuminski
Copy link
Collaborator

Created chart (first attempt)

@jszuminski jszuminski self-assigned this Dec 8, 2022
highcharts-api/highcharts/3-stacked-bar/main.js Outdated Show resolved Hide resolved
highcharts-api/highcharts/3-stacked-bar/main.js Outdated Show resolved Hide resolved
highcharts-api/highcharts/3-stacked-bar/main.js Outdated Show resolved Hide resolved
highcharts-api/highcharts/3-stacked-bar/main.js Outdated Show resolved Hide resolved
Comment on lines 19 to 23
chart.buttons = Array.from({ length: chart.yAxis[0].series.length }, () => 0);
chart.yAxis[0].series.forEach((_, ind) => {
chart.buttons[ind] = chart.renderer.button('How to fix', chart.plotWidth, chart.plotTop + axisHeight * (ind * 4 + 1) / 4,
() => console.log('Button clicked!')).add();
});

Choose a reason for hiding this comment

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

Wouldn't it be possible to assign buttons to category objects? And try using forEach to refer to them using the first parameter instead of the index, I think it would be clearer and it would take less code. What catches my eye is the _ in forEach((_, ind)

highcharts-api/highcharts/3-stacked-bar/index.html Outdated Show resolved Hide resolved
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