HTML/Javascript:如何绘制动态图

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10132936/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 08:47:48  来源:igfitidea点击:

HTML/Javascript: how to draw a dynamic graph

javascriptjqueryhtmlgraph

提问by Ixx

I want to draw a dynamic graph with standard HTML/Javascript/JQuery (not HTML5).

我想用标准的 HTML/Javascript/JQuery(不是 HTML5)绘制动态图。

The nodes are divs with certain contents, and between them I need lines. At least horizontal and vertical. It's possible to add and remove nodes dynamically.

节点是具有某些内容的 div,在它们之间我需要线条。至少水平和垂直。可以动态添加和删除节点。

It would be nice if the divs are draggable too, but is not necessary.

如果 div 也可以拖动就好了,但不是必需的。

Can this be done with standard HTML, maybe with help of some JQuery library?

这可以用标准的 HTML 来完成,也许在一些 JQuery 库的帮助下?

I only find negative answers on this, like: http://www.coderanch.com/t/518805/open-source/do-generate-dynamic-graph-html

我只找到否定的答案,例如:http: //www.coderanch.com/t/518805/open-source/do-generate-dynamic-graph-html

Thanks in advance.

提前致谢。

P.D. Seems to be a typic use case for Flash. I can't use HTML5 because it has to run everywhere. And I don't see a reason to use something like SVG instead of Flash.

PD 似乎是 Flash 的典型用例。我不能使用 HTML5,因为它必须在任何地方运行。而且我认为没有理由使用 SVG 之类的东西而不是 Flash。

回答by Jo?o Pimentel

This would probably be easy to make with JointJS. It uses Raphael for handling the graphics, which is based on SVG but also support VML for IE. JointJS claims to support the following browsers: Firefox 3.0+, Safari 3.0+, Opera 9.5+, Google Chrome 4+ and Internet Explorer 6.0+.

使用JointJS可能很容易做到这一点。它使用 Raphael 来处理图形,它基于 SVG 但也支持 IE 的 VML。JointJS 声称支持以下浏览器:Firefox 3.0+、Safari 3.0+、Opera 9.5+、Google Chrome 4+ 和 Internet Explorer 6.0+。

回答by JROB

JQplot is great: http://www.jqplot.com/

JQplot 很棒:http://www.jqplot.com/

It has a very "Google analytics" feel to it right out of the box.

它开箱即用,给人一种非常“谷歌分析”的感觉。

It's built on jQuery which works great for what you've described.

它建立在 jQuery 之上,非常适合您所描述的内容。

回答by Umar Bukhari

You can use Google Charts, Google Graph API Examples.

您可以使用 Google Charts、Google Graph API 示例。