canvas - How to draw a curve consisting of multiple line segments in a non-jagged way -


i trying write program puts incoming usb data onto line graph. way have done drawing onto canvas bunch of straight lines connecting data points. problem resulting line not smooth, can see below:

jagged line

i tried using graphics context's lineto(x, y) method made worse. tried changing line cap , line join parameters didn't much.

is there better way play "connect dots" javafx graphics context? perhaps bezier curves? if there is, please let me know.

i ended going simplest solution problem, use boxblur effect:

boxblur blur = new boxblur(); blur.setwidth(2); blur.setheight(2); blur.setiterations(1);  gc.seteffect(blur);   ...  //don't forget remove effect before clearing gc.seteffect(null); gc.clearrect(0, 0, width, height); 

it's not exact solution, works fine purposes.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

Ansible warning on jinja2 braces on when -