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/exercise4 #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

highcharts/exercise4 #3

wants to merge 1 commit into from

Conversation

marvin19
Copy link
Contributor

Added solution for Highcharts Exercise 4. I can not manage to get the labels on the YAxis to appear on the top instead of the bottom.

@marvin19 marvin19 self-assigned this Jan 30, 2023
Copy link
Collaborator

@K009 K009 left a comment

Choose a reason for hiding this comment

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

Good job, the exercise is done almost correctly.
Please take a look at the below comments.

nonData = [32, 43, 55, 78, 12]
max = 100,
maxColor = '#FF0000',
seriesColor = '#A1B5C9'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you swap the colors by mistake. In the image the actual series is red and the 'fake' one is gray. So lines 5 and six should look like this:
maxColor = '#A1B5C9',
seriesColor = '#FF0000';

@@ -0,0 +1,89 @@
const categories = ['Dep1','Dep2', 'Dep3', 'Dep4', 'Dep5'];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the semicolon and add a comma here 😄

@@ -0,0 +1,89 @@
const categories = ['Dep1','Dep2', 'Dep3', 'Dep4', 'Dep5'];
data = [50, 36, 50, 40, 14],
nonData = [32, 43, 55, 78, 12]
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing comma

nonData = [32, 43, 55, 78, 12]
max = 100,
maxColor = '#FF0000',
seriesColor = '#A1B5C9'
Copy link
Collaborator

Choose a reason for hiding this comment

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

semicolon at the end of the line

data = [50, 36, 50, 40, 14],
nonData = [32, 43, 55, 78, 12]
max = 100,
maxColor = '#FF0000',
Copy link
Collaborator

Choose a reason for hiding this comment

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

maxColor name might be confusing, I would change this variable name to something like fakeSeriesColor 😄

@@ -0,0 +1,89 @@
const categories = ['Dep1','Dep2', 'Dep3', 'Dep4', 'Dep5'];
data = [50, 36, 50, 40, 14],
nonData = [32, 43, 55, 78, 12]
Copy link
Collaborator

Choose a reason for hiding this comment

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

nonData name might be confusing, I would change this variable name to something like fakeSeriesData

type: 'bar',
marginTop: 50,
events: {
// Probably need to do something here with the labels
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good guess! By modyfing yAxis.title.y property you could change the position of the yAxis title. You can do it in the load event using the update method on the yAxis. Remember to not hardcoding the value but calculate it using such values as chart.plotTop or chart.chartHeight.

Useful links:
https://api.highcharts.com/highcharts/yAxis.title.y
https://api.highcharts.com/class-reference/Highcharts.Axis#update

If you need any help with that feel free to contact me here or on Slack. 😄

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