plotters-rs / plotters

A rust drawing library for high quality data plotting for both WASM and native, statically and realtimely 🦀 📈🚀
https://plotters-rs.github.io/home/
MIT License
3.89k stars 281 forks source link

Fix dashed line algorithm #540

Closed KmolYuan closed 10 months ago

KmolYuan commented 10 months ago

483

I'm sorry, I found some problems using the dashed line algorithm. When the distance between points is greater than the size or spacing of the dashed line, the algorithm will produce an incorrect continuous straight line.

This new algorithm was tested using two curve coordinate sequences (as shown in the following), "point distance less than size" and "point distance greater than size," the above results were corrected.

In addition, if the size equals 0 pixel, it will not be drawn.

Left: point distance less than size or spacing Right: point distance greater than size or spacing