js画图开发库--mxgraph--[graphlayout-图形布局.html]
布局变化,下方还有动画效果选项:
<!Doctype html> <html xmlns=http://www.w3.org/1999/xhtml> <head> <meta http-equiv=Content-Type content="text/html;charset=utf-8"> <title>图形布局</title> <!-- 如果本文件的包与src不是在同一个目录,就要将basepath设置到src目录下 --> <script type="text/javascript"> mxBasePath = '../src'; </script> <!-- 引入支持库文件 --> <script type="text/javascript" src="../src/js/mxClient.js"></script> <!-- 示例代码 --> <script type="text/javascript"> // 程序在此启动 function main(container) { // 检测浏览器兼容性 if (!mxClient.isBrowserSupported()) { mxUtils.error('Browser is not supported!', 200, false); } else { // 在容器中创建图形 var graph = new mxGraph(container); // 禁用选择和单元格处理 graph.setEnabled(false); // 更改点风格的样式 var style = graph.getStylesheet().getDefaultVertexStyle(); style[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_ELLIPSE; style[mxConstants.STYLE_PERIMETER] = mxPerimeter.EllipsePerimeter; style[mxConstants.STYLE_GRADIENTCOLOR] = 'white'; style[mxConstants.STYLE_FONTSIZE] = '10'; // 设置容器随内容自适应 //graph.setResizeContainer(true); // 设置图大小 graph.gridSize = 40; // 创建默认窗体 var parent = graph.getDefaultParent(); // 创建新的布局算法 var layout = new mxFastOrganicLayout(graph); // 移动距离 layout.forceConstant = 80; // 动画效果选项 var animate = document.getElementById('animate'); // 添加按钮来更新布局 document.body.insertBefore(mxUtils.button('圆形布局Circle Layout', function(evt) { graph.getModel().beginUpdate(); try { // 创建圆形布局算法 var circleLayout = new mxCircleLayout(graph); circleLayout.execute(parent); } catch (e) { throw e; } finally { if (animate.checked) { var morph = new mxMorphing(graph); morph.addListener(mxEvent.DONE, function() { graph.getModel().endUpdate(); }); morph.startAnimation(); } else { graph.getModel().endUpdate(); } } } ), document.body.firstChild); // 添加按钮来更新布局 document.body.insertBefore(mxUtils.button('随机布局Organic Layout', function(evt) { graph.getModel().beginUpdate(); try { layout.execute(parent); } catch (e) { throw e; } finally { if (animate.checked) { //默认值是 6, 1.5, 20 var morph = new mxMorphing(graph, 10, 1.7, 20); morph.addListener(mxEvent.DONE, function() { graph.getModel().endUpdate(); }); morph.startAnimation(); } else { graph.getModel().endUpdate(); } } } ), document.body.firstChild); // 开启更新事务 graph.getModel().beginUpdate(); var w = 30; var h = 30; try { var v1 = graph.insertVertex(parent, null, 'A', 0, 0, w, h); var v2 = graph.insertVertex(parent, null, 'B', 0, 0, w, h); var v3 = graph.insertVertex(parent, null, 'C', 0, 0, w, h); var v4 = graph.insertVertex(parent, null, 'D', 0, 0, w, h); var v5 = graph.insertVertex(parent, null, 'E', 0, 0, w, h); var v6 = graph.insertVertex(parent, null, 'F', 0, 0, w, h); var v7 = graph.insertVertex(parent, null, 'G', 0, 0, w, h); var v8 = graph.insertVertex(parent, null, 'H', 0, 0, w, h); var e1 = graph.insertEdge(parent, null, 'ab', v1, v2); var e2 = graph.insertEdge(parent, null, 'ac', v1, v3); var e3 = graph.insertEdge(parent, null, 'cd', v3, v4); var e4 = graph.insertEdge(parent, null, 'be', v2, v5); var e5 = graph.insertEdge(parent, null, 'cf', v3, v6); var e6 = graph.insertEdge(parent, null, 'ag', v1, v7); var e7 = graph.insertEdge(parent, null, 'gh', v7, v8); var e8 = graph.insertEdge(parent, null, 'gc', v7, v3); var e9 = graph.insertEdge(parent, null, 'gd', v7, v4); var e10 = graph.insertEdge(parent, null, 'eh', v5, v8); // 执行更改 layout.execute(parent); } finally { // 结束更新事务 graph.getModel().endUpdate(); } } }; </script> </head> <!-- 页面载入时启动程序 --> <body onload="main(document.getElementById('graphContainer'))"> <!-- 创建带网格壁纸和曲线的一个容器,请一定要定义的position和overflow的属性!根据在线API的54 页内容增加的大小侦听器 --> <div id="graphContainer" style="position:relative;overflow:visible;width:821px;height:641px;background:url('editors/images/grid.gif');"> </div> <br> <input type="checkbox" id="animate" checked="checked"/> Transitions </body> </html>
相关推荐
MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..
资源:mxGraph;包含ie,Firefox两个版本;版本号都是1.4.0.0;只带了一个Hello World的示例,其他的例子请自己去官网找吧
mxgraph开发包
javascript graph javascript graph javascript graph
NULL 博文链接:https://chwshuang.iteye.com/blog/1797168
mxGraph里头包含源码,以及常用的一些实例,相关介绍可以查阅博客:http://www.cnblogs.com/shawWey/p/7115124.html
这个插件支持在HTML页面中插入流程图,画得很漂亮 :-)
mxgraph.js中文文档是一个官方的api,翻译来源于sunflower(github: https://github.com/SunInfoFE),提供给更多的开发者参考和共享源码资源!
带Webpack的typed-mxgraph演示 来自Webpack Typescript入门 如何使用 在本地克隆项目 git clone https://github.com/typed-mxgraph/typed-mxgraph-demo.git 切换到项目目录 cd typed-mxgraph-demo 确保使用节点10...
.......\....\......\mx_man_graph_layout.png .......\....\......\mx_man_graph_vis.png .......\....\......\mx_man_hello_struct.png .......\....\......\mx_man_hello_world.png .......\....\......\mx_...
前段实现mxgraph插件绘制流程图,后台实现保存的xml导出成图片格式,遇到图标没有引用,文字label位置不正确,label换行不识别 标签,linux服务器部署中文字体等问题
mxGraph1.8.0.3破解版mxclient,分IE ,FF 和chrome三个部分,不同浏览器加载不同的js文件,手动尝试过,1.8.0.5官方的例子都可以正常运行。
web开发拓扑图插件 mxGraph - An open source JavaScript diagramming component, started in 2005, that works on all major browsers, including touch devices.
mxGraph 简单易用,只需要在HTML文件中加入JavaScript链接,就可立即使用最简洁最强大的基于浏览器自身的绘图工具。 HTML 5和全系列IE支持。 想像一下,整个应用都是基于Web。在浏览器中设计工作流,操纵有背景图...
mxgraph-svg2shape 一套将SVG文件转换为mxGraph资源的工具。 该存储库基于: SVG to XML mxGraph stencil definition translation tool. ... 添加 :将XML mxGraph模具定义转换为一组相应JavaScript /
mxGraph是一个JS绘图组件适用于需要在网页中设计/编辑Workflow/BPM流程图、图表、网络图和普通图形的Web应用程序。mxgraph下载包中包括用javescript写的前端程序,也包括多个和后端程序(java/C#等等)集成的例子。以下...
mxgraph-1_10_4_0 官方源码+文档+示例
mxgraph-demo-源码.rar
在线画图www.draw.io网站的源码,基于mxGraph开发
vue配合mxGraph 入门实例项目,