Justin-ZS commented on PR #21613:
URL: https://github.com/apache/echarts/pull/21613#issuecomment-4601436300
Thanks for updating this. The `PiecewiseModel.getVisualMeta` direction looks
much better now.
I think the new tied-coord reversal fallback in `LineView` still has an
issue though:
```ts
colorStops[0].coord === colorStops[stopLen - 1].coord && axis.inverse
```
`axis.inverse` is not the same as "data value increases in the same
direction as global pixel coord". For a normal y axis, `axis.inverse` is
`false`, but global y pixel coordinates are still reversed: lower values are
lower on screen (larger y), higher values are higher on screen (smaller y). So
for duplicate boundary stops like `{lte: 10}`, the normal y-axis case still
needs to reverse; otherwise the line renders the high-value side with the
low-value color.
A more robust check is to derive the direction from the axis coord extent
after `toGlobalCoord`, for example:
```ts
const coordExtent = axis.getExtent();
const isCoordReversed = axis.toGlobalCoord(coordExtent[0]) >
axis.toGlobalCoord(coordExtent[1]);
if (stopLen && isCoordReversed) {
colorStops.reverse();
outerColors.reverse();
}
```
This gives the expected direction for all four basic cases:
- xAxis normal: no reverse
- xAxis inverse: reverse
- yAxis normal: reverse
- yAxis inverse: no reverse
The current `axis.inverse` tiebreaker gets the y-axis cases backwards. The
added tests validate `visualMeta`, but they don't assert the actual `LineView`
gradient direction, so this can slip through while the unit suite is still
green.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]