Skip to content

Comments

feat: added logic to fill invalid value with null, so the chart don't have broken lines#7412

Merged
SagarRajput-7 merged 4 commits intomainfrom
SIG-5662
Mar 24, 2025
Merged

feat: added logic to fill invalid value with null, so the chart don't have broken lines#7412
SagarRajput-7 merged 4 commits intomainfrom
SIG-5662

Conversation

@SagarRajput-7
Copy link
Contributor

@SagarRajput-7 SagarRajput-7 commented Mar 23, 2025

Summary

Time series charts in SigNoz display disconnected/broken lines when encountering invalid data points such as +Inf, +Infinity, NaN, or other non-numeric values. This creates a poor visualization experience and makes it difficult for users to interpret the data.

Solution

This PR adds functionality to properly handle invalid plot values by replacing them with null values, which ensures chart lines remain connected. The implementation:

  1. Adds two new utility functions in dataUtils.ts:

    • isInvalidPlotValue(): Checks for invalid values (null, undefined, NaN, Infinity, etc.)
    • normalizePlotValue(): Converts invalid values to null and string numbers to actual numbers
  2. Updates fillMissingXAxisTimestamps() in getUplotChartData.ts to use the new normalization function

Benefits

  • Improved chart visualisation with continuous lines instead of broken segments
  • Better user experience when viewing time series data with occasional invalid values
  • More consistent data representation across all chart types

Related Issues / PR's

Screenshots

Screenshot 2025-03-23 at 3 27 37 PM

Affected Areas and Manually Tested Areas

  • Manually tested with datasets containing various invalid values including +Infinity, NaN, and undefined
  • Verified chart rendering maintains line continuity across these invalid points
  • Tested across different chart types and time ranges

Important

Adds logic to replace invalid plot values with null to prevent broken chart lines, using new utility functions in dataUtils.ts.

  • Behavior:
    • Introduces isInvalidPlotValue() and normalizePlotValue() in dataUtils.ts to handle invalid plot values by replacing them with null.
    • Updates fillMissingXAxisTimestamps() in getUplotChartData.ts to use normalizePlotValue() for value normalization.
  • Functions:
    • isInvalidPlotValue(): Checks for null, undefined, NaN, Infinity, and string representations of these values.
    • normalizePlotValue(): Converts invalid values to null and string numbers to actual numbers.

This description was created by Ellipsis for 293f99f. It will automatically update as commits are pushed.

@SagarRajput-7 SagarRajput-7 requested a review from YounixM as a code owner March 23, 2025 10:08
@github-actions github-actions bot added docs required enhancement New feature or request labels Mar 23, 2025
@SagarRajput-7 SagarRajput-7 merged commit 694c185 into main Mar 24, 2025
12 of 14 checks passed
@SagarRajput-7 SagarRajput-7 deleted the SIG-5662 branch March 24, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs not required enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants