Skip to content

Commit

Permalink
fix(line): fix visual gradient when coords are between two stops.
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Oct 25, 2021
1 parent bc54e48 commit 2b63cd7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/chart/line/LineView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ function clipColorStops(colorStops: ColorStop[], maxSize: number): ColorStop[] {
if (prevInRangeColorStop) {
newColorStops.push(lerpStop(prevInRangeColorStop, stop, maxSize));
}
else if (prevOutOfRangeColorStop) { // If there are two stops and coord range is between these two stops
newColorStops.push(
lerpStop(prevOutOfRangeColorStop, stop, 0),
lerpStop(prevOutOfRangeColorStop, stop, maxSize)
);
}
// All following stop will be out of range. So just ignore them.
break;
}
Expand Down
41 changes: 41 additions & 0 deletions test/line-visual2.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2b63cd7

Please sign in to comment.