开发者

How to draw a graph in javascript while preserving the original relative positions?

开发者 https://www.devze.com 2023-04-02 07:06 出处:网络
I would like to automate the generation of weathermap-like graphs. The idea is to store the GPS coordinates of the datacenters and the links between them.

I would like to automate the generation of weathermap-like graphs. The idea is to store the GPS coordinates of the datacenters and the links between them.

The issue is that some datacenters are very close (a few kilometers) to each other while other are quite far (hundreds of kilometers). This would produce a graph with mainly blank space and a huge need to scroll :/

I am looking for a full js 开发者_如何学编程solution to "compress" the distances while preserving the relative positions.

any idea ?


if you want to compress but preserve the relative distance why not just decrease everything by a specific percent. They maintain the same distance ratio just scaled down.

distance from orgin
100 miles
10 miles

scaled by a factor of 10

10 miles
1 mile

Same distance ratio just compressed...

or how about visually distance from the +

 10 spaces    5  
*          +     *

compressed

*     + *

Simple math to the rescue!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号