-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/add configurable graph domain (#136)
* Added additional configuration to the horizontal barchart Can now specify the minX and maxX values * Adding missing keys to chartConfiguration previously the expectation was that all keys were present if a custom config was provided via the api * Refactored chart code and allowed additional graph configuration Some cleanup of chart.js. Removed some if statement that checked for percentage or value - this is now driven from the config. Also added the ability to set the domain of the axis. This allows users to for instance for the percentage graphs to range between 0 and 100 * Fixed test and replaced custom object merge function in utils with lodash Lodash has a better deep merge function which deals with cases that the existing code didn't. Co-authored-by: Adi Eyal <adi@openup.org.za> Co-authored-by: Mila Frerichs <mila.frerichs@gmail.com>
- Loading branch information
1 parent
0709a80
commit 471df61
Showing
10 changed files
with
116 additions
and
64 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
let chartConfiguration = [{"label": "Value", "formatting": "~s"}]; | ||
|
||
const DEFAULT_CONFIG = 'default' | ||
let chartConfiguration = { | ||
types: { | ||
Value: {formatting: '~s', minX: DEFAULT_CONFIG, maxX: DEFAULT_CONFIG}, | ||
Percentage: {formatting: '.0%', minX: DEFAULT_CONFIG, maxX: DEFAULT_CONFIG} | ||
} | ||
}; | ||
export const defaultValues = { | ||
chartConfiguration | ||
chartConfiguration, | ||
DEFAULT_CONFIG | ||
} |
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
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