Skip to content

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

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

Atash3000
Copy link
Collaborator

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:
Screenshot 2025-04-21 at 09 26 25

Optional

Storybook Links

Screenshots

@Atash3000 Atash3000 added this to the 4.25.4 milestone Apr 21, 2025
@Atash3000 Atash3000 requested review from adamdoe and joshlacey April 21, 2025 13:31
dynamicCategory,
originalSeriesKey
} = props
const dynamicData = data.filter(d => {
Copy link
Collaborator

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')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove

Copy link
Collaborator Author

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))
Copy link
Collaborator

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.

Copy link
Collaborator Author

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])
Copy link
Collaborator

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])) {
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator

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?

@Atash3000 Atash3000 requested a review from adamdoe April 29, 2025 14:55
Copy link
Collaborator

@adamdoe adamdoe left a 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

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