为坐标平面上的行绘制Javascript绘图库

时间:2022-09-15 10:53:16

What would be the easiest to use javascript (line) plotting libraries for data that looks like this?:

对于像这样的数据,使用javascript(行)绘图库最简单的方法是什么?

[ {"Name" : [1.5, 2.3]}, {"Name" : [5.6, 6.7]}, ... ]

Each "Name" => [x,y] pair. "Name"'s would be the labels. I have output that generates thousands of these points and I need to get them draw lines between them to illustrate a path. I've looked into jqPlot, I'm not sure how if it would read the labeling and x,y coordinates correctly. Can someone demonstrate a simple implementation? Or recommend another solution?

每个“Name”=> [x,y]对。“名字”就是标签。我有成千上万个点的输出我需要让它们在它们之间画线来说明路径。我研究了jqPlot,我不确定它是否能正确读取标记和x y坐标。有人能演示一个简单的实现吗?或者推荐另一个解决方案吗?

Thanks!

谢谢!

1 个解决方案

#1


1  

I think jqPlot would be fine.

我认为jqPlot会很好。

Try looking here:

试着看这里:

http://www.jqplot.com/docs/files/usage-txt.html

http://www.jqplot.com/docs/files/usage-txt.html

From that link see under

从那个链接看下面

Create a plot

创建一个阴谋

Then, create the actual plot by calling the $.jqplot plugin with the id of your target and some data:

然后,通过调用$来创建实际的图。jqplot插件,带有目标的id和一些数据:

$.jqplot('chartdiv',  [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]]);

All you would have to do is to go loop through your JSON and make an array that looks like the one above.

你所要做的就是循环遍历JSON并创建一个类似于上面的数组。

#1


1  

I think jqPlot would be fine.

我认为jqPlot会很好。

Try looking here:

试着看这里:

http://www.jqplot.com/docs/files/usage-txt.html

http://www.jqplot.com/docs/files/usage-txt.html

From that link see under

从那个链接看下面

Create a plot

创建一个阴谋

Then, create the actual plot by calling the $.jqplot plugin with the id of your target and some data:

然后,通过调用$来创建实际的图。jqplot插件,带有目标的id和一些数据:

$.jqplot('chartdiv',  [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]]);

All you would have to do is to go loop through your JSON and make an array that looks like the one above.

你所要做的就是循环遍历JSON并创建一个类似于上面的数组。