-
Notifications
You must be signed in to change notification settings - Fork 27
Feature : [DEV-10497] - Add Line chart suppression for Dynamic Series #2075
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
base: dev
Are you sure you want to change the base?
Conversation
dynamicCategory, | ||
originalSeriesKey | ||
} = props | ||
const dynamicData = data.filter(d => { |
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.
Add checks for data before filtering.
Add checks for preliminaryData before running forEach
Add checks for dynamicCategory before attemptying to acces d[dynamicCategory]
// Find applicable suppression data for the first item | ||
const suppressionData = preliminaryData.find(isSuppressed) | ||
const suppressionData = preliminaryData.find(item => isSuppressed(item, firstIndexDataItem)) | ||
console.log(firstIndexDataItem, 'firstIndexDataItem') |
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.
Remove
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.
Fixed!
// Find applicable suppression data for the first item | ||
const suppressionData = preliminaryData.find(isSuppressed) | ||
const suppressionData = preliminaryData.find(item => isSuppressed(item, firstIndexDataItem)) |
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.
Check for preliminaryData before running any functions on it.
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.
Fixed!
result.data[pairCount].push(modifiedItem) | ||
result.style = suppressionData.style | ||
result.color = colorScale(modifiedItem[dynamicCategory]) |
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.
Check for dynamicCategory before accessing it.
siblingBefore = data[i] | ||
break // Stop searching once a valid sibling is found | ||
} | ||
} | ||
|
||
// Find the nearest numeric sibling after the current index | ||
for (let j = index + 1; j < data.length; j++) { | ||
if (isCalculable(data[j][seriesKey])) { | ||
if (isCalculable(data[j][dynamicSeriesKey])) { |
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.
Throughout the rest of this PR, continue adding checks before accessing values that could potentially be undefined.
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.
it is checking here : const dynamicSeriesKey = dynamicCategory ? originalSeriesKey : seriesKey
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.
I added a test to the PR that will show the issue. Can you make sure that gets satisfied?
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.
Satisfy the test on the PR
Summary
Testing Steps
Open Line chart

Configure Dynamic series
On Data series panel there a button "Add Special Line"
Add suppression line while series are dynamic
Note: For best results use Dynamic series mock data from story book as it is configured to render all lines while dynamic
Note: if data set has number values eg:100,500 etc you cannot suppress them, use values like "Abc, ZZZ etc.
Added a story as well, see attcahed image:
Optional
Storybook Links
Screenshots