-
Notifications
You must be signed in to change notification settings - Fork 236
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
[RFR] Responsive chart #249
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d98f6d9
responsive chart resize event
zyhou 3afe593
add removeEventListener event
zyhou 5935c75
remove ie9 condition + add doc removeOnResize function
zyhou 953e672
apply review
zyhou 6a437fd
add breakpoint and display count tick config
zyhou d5f3d5f
add doc
zyhou 34a2036
add test getBreakpointLabel
zyhou 569054a
fix test
zyhou d04a819
add test display tick
zyhou ed82c73
review doc
zyhou 9b7dee7
review initChart
zyhou de5fb75
Typo fix s/redraw/redraws/
sedy-bot 36ffb89
add breakpoint in doc
zyhou 871acb9
fix generate ticks + test
zyhou fdbf768
remove duplicate test
zyhou 91f2365
add breakpoints in config
zyhou eacc059
calcul breakpoint on redraw
zyhou 2be4abb
review about breakpointLabel
zyhou fd56c95
Typo fix s/methods/members/
sedy-bot 1ff0a37
Typo fix s/returns a label of current breakpoint, [list of breakpoint…
sedy-bot f18f262
Typo fix s/destroy/destroy()/
sedy-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const getBreakpointLabel = (breakpoints, point) => { | ||
for (const label in breakpoints) { | ||
if (point <= breakpoints[label]) { | ||
return label; | ||
} | ||
} | ||
|
||
return 'extra'; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { getBreakpointLabel } from './breakpoint'; | ||
|
||
const defaultConfig = { | ||
breakpoints: { | ||
small: 576, | ||
medium: 768, | ||
large: 992, | ||
extra: 1200, | ||
}, | ||
}; | ||
|
||
describe('Breakpoint Label', () => { | ||
it('should return breakpoint label correctly depending of current point', () => { | ||
expect(getBreakpointLabel(defaultConfig.breakpoints, 400)).toBe( | ||
'small' | ||
); | ||
expect(getBreakpointLabel(defaultConfig.breakpoints, 600)).toBe( | ||
'medium' | ||
); | ||
expect(getBreakpointLabel(defaultConfig.breakpoints, 800)).toBe( | ||
'large' | ||
); | ||
expect(getBreakpointLabel(defaultConfig.breakpoints, 1000)).toBe( | ||
'extra' | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not the default value. Display default value only here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done