-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add getColorScale to enable displaying multiple lines in LineChart #11
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
6dab9bb
Add sequential colors in theme
chenesan d760dd0
Make getRecordFieldSelector accept all Scale argument
chenesan a4d8664
Add getColorScale
chenesan ba64566
Add multiple color charts in LineChart
chenesan 2417573
Add color scale on TooltipLayer and HoverIndicator
chenesan 5d911a9
Refactor dataGroup logic
chenesan 3a329c5
Extract DataLine component
chenesan 415c7e0
Fix linter issue of TooltipLayer
chenesan 43bec01
Fix linter issue of getColorScale
chenesan b5b09db
Fix linter issue of getDataGroup
chenesan ef76ce8
Fix linter issue of themes
chenesan 5a8b112
Fix sorting issue of DataGroup
chenesan 77245f7
Add quantitative example for multi lines
chenesan 321eb57
Fix undefined type error of LineChart
chenesan ccebf77
Rename GetColorScaleArgs as ColorScaleArgs
chenesan dfed6f6
Use d3-array extent in getColorScale
chenesan b395275
Fix type definition of getColorScale args
chenesan d7eadb1
Add comment on getColorScale
chenesan 4e47016
Rename getDataGroup as getDataGroupByFields
chenesan f2bfe00
Extract getDataGroupByEncodings
chenesan d81d659
Simplify getColrScaleSetting with lodash.map
chenesan 5f7f4e5
Fix documentation of getdataGroupByEncodings
chenesan 57bad27
Simplify getNumericDomain logic
chenesan c804601
Fix LineChart.tsx formatting
chenesan 805c85f
Update CHANGELOG.md
chenesan c60681d
Merge branch 'develop' into feature/color-scale
chenesan 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const mutliLinesData = [ | ||
{ x: 0, y: 9, type: "type1", date: '2019/01/21 00:00:00', weekday: 'Mon' }, | ||
{ x: 1, y: 5, type: "type2", date: '2019/01/22 00:00:00', weekday: 'Tue' }, | ||
{ x: 2, y: 5, type: "type2", date: '2019/01/23 00:00:00', weekday: 'Wed' }, | ||
{ x: 3, y: 3, type: "type1", date: '2019/01/24 00:00:00', weekday: 'Thu'}, | ||
{ x: 4, y: 1, type: "type2", date: '2019/01/25 00:00:00', weekday: 'Fri' }, | ||
{ x: 10, y: 9, type: "type1", date: '2019/01/21 00:00:00', weekday: 'Mon' }, | ||
{ x: 6, y: 5, type: "type2", date: '2019/01/22 00:00:00', weekday: 'Tue' }, | ||
{ x: 7, y: 5, type: "type2", date: '2019/01/23 00:00:00', weekday: 'Wed' }, | ||
{ x: 2, y: 3, type: "type1", date: '2019/01/24 00:00:00', weekday: 'Thu'}, | ||
{ x: 8, y: 1, type: "type2", date: '2019/01/25 00:00:00', weekday: 'Fri' }, | ||
]; | ||
|
||
export default mutliLinesData; |
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 |
---|---|---|
|
@@ -34,7 +34,7 @@ export interface Scale { | |
/** | ||
* Range of input channel | ||
*/ | ||
range: [any, any]; | ||
range?: ReadonlyArray<any>; | ||
|
||
/** Returns the formatted value according to the type of the axis */ | ||
getValue: (val: any) => any; | ||
|
@@ -55,10 +55,13 @@ export interface AxisScale extends Scale { | |
* Range of the axis: [min, max] | ||
* it should match the inner width and height of the graph | ||
*/ | ||
range: [number, number]; | ||
range?: [number, number]; | ||
} | ||
|
||
export type EncodingDataType = 'nominal' | 'ordinal' | 'quantitative' | 'temporal'; | ||
export interface ColorScale extends Scale { | ||
range?: [string, string] | ReadonlyArray<string> | ||
} | ||
|
||
export interface Encoding { | ||
field: string; | ||
|
@@ -70,6 +73,8 @@ export interface AxisEncoding extends Encoding { | |
scale?: AxisScaleType; | ||
} | ||
|
||
export type ColorEncoding = Encoding; | ||
|
||
export interface Margin { | ||
top: number; | ||
right: number; | ||
|
@@ -93,6 +98,10 @@ export interface Theme { | |
colors: { | ||
/** colors used for nominal data */ | ||
category: ReadonlyArray<string>; | ||
sequential: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
scheme: ReadonlyArray<string>; | ||
interpolator: (val: number) => string; | ||
} | ||
}; | ||
/** x-axis theme config */ | ||
xAxis: AxisTheme; | ||
|
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
Oops, something went wrong.
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.
Nice use of
ReadonlyArray
👍