Point visualization in coordinate system | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Point visualization in coordinate system

Can someone show me a code that could show given points in a coordinate system? I am not into HTML and would appreciate if someone could help me :) points = [[x,y],[x,y],[x,y]...]

16th Jun 2017, 4:28 PM
Martin Möhle
Martin Möhle - avatar
2 Answers
+ 5
Best way is probably to use <canvas> element wich handle bitmaps area with powerful API in Javascript to interract with... However, you can also deal that with <svg> element, wich could be less or more obvious depending of your actual skill for each one and for Html/JS more generally, or even doing it with simple Html elements (but this could be a few tricky even if more simpliest if you never use <canvas> nor <svg> specific elements)... https://code.sololearn.com/W0lhz5e1ltaU/#js This is a simple last option implementation base, which can be improved by many ways: - verifying validity of user input before trying to display output - give user options for dot size, color... - give user possibility of set scale of output (Actually one unit is done as one pixel, whatever the viewport size... could be absolute with other units and/or relattive to viewport size. Could be implemented also auto-scaling depending on max space taken by all points) - give user possibility to move origin of coordinate system, as well as direction of axis - and so on ^^
16th Jun 2017, 9:21 PM
visph
visph - avatar
+ 8
Thanks a lot visph! :)
16th Jun 2017, 9:48 PM
Martin Möhle
Martin Möhle - avatar