helgasoft commented on issue #20369:
URL: https://github.com/apache/echarts/issues/20369#issuecomment-2835969702
There is no mystery on how to draw smooth lines - they just need more points.
Here is basic code to generate linear interpolation points.
```
function intermediatePoints(start, end, numPoints) {
const points = [];
for (let i = 1; i <= numPoints; i++) {
const t = i / (numPoints + 1);
const x = start.x + (end.x - start.x) * t;
const y = start.y + (end.y - start.y) * t;
points.push({ x, y });
}
return points;
}
const start = { x: 1, y: 1 }; // original data points
const end = { x: 5, y: 5 };
const numPoints = 3; // should depend on line's length for better result
const result = intermediatePoints(start, end, numPoints);
console.log(result);
// Expected output:
// [{x: 2, y: 2}, {x: 3, y: 3}, {x: 4, y: 4}]
```
Once ready, the points could be added one by one with _setOption_ to create
a smooth animation effect.
--
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]