leeoniya / leeoniya/uPlot

Possible bug with scale gradient between two values and zoom level

Open
#751 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

demos needs-more-info question
Dominant language
JavaScript
Stars
10.5k
Forks
463
PR merge metrics
No merged PRs in 30d

Description

Hello,

I'm using the scaleGradient function provided by the demo example with the following configuration:

Configuration
paths: stepped ? stepped({align: 1}) : undefined,
drawStyle: 0,
stroke: (u: uPlot) => scaleGradient(u, 'x', 0, true)

scaleGradient is modified by a function to create automatic stops after each y-value change (I'm only drawing discrete values like 0,1,2,3,...).

Color Stops
[...]
[1562031960, "red"]
[1562031960, "blue"]
[1562032830, "red"]
[...]
Problem description

I've enabled value points to visualize the gap between them in the following screenshots. What's driving me crazy is the gradient on different zoom levels. Sometimes the area before timestamp "1562031960" (03:46:00) is colored blue and sometimes it's red. Is there any way to prevent this from happening? I only want y-values e.g. 4 to be colored blue.

What it should look like

Screenshot from 2022-09-12 05-00-40

What it does on different zoom levels

Screenshot from 2022-09-12 05-04-59

Size for users in frontend

Screenshot from 2022-09-12 05-08-05

Thank you for reading!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the demo's scaleGradient function and the shown stroke configuration; reproduce the red/blue stop behavior while zooming across timestamp 1562031960. Compare the rendered result with the expected rule that y-values such as 4 remain blue, and verify the behavior across zoom levels.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.