<!Doctype html> <html xmlns=http://www.w3.org/1999/xhtml> <head> <meta http-equiv=Content-Type content="text/html;charset=utf-8"> <title>Editing example for mxGraph</title> <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('浏览器不支持!', 200, false); } else { // 在对象中创建图形 var graph = new mxGraph(container); graph.setHtmlLabels(true); // 在图形对象中添加按键监听 var keyHandler = new mxKeyHandler(graph); // 鼠标事件触发,返回选中对象字段名称 var getFieldnameForEvent = function(cell, evt) { if (evt != null) { // 获得事件在元素内的坐标 var point = mxUtils.convertPoint(graph.container, evt.clientX, evt.clientY); var state = graph.getView().getState(cell); if (state != null) { point.x -= state.x; point.y -= state.y; // 判断事件坐标位置 //if (point.y > state.height / 3) if (point.y > state.height / 3) { if(point.y > ((state.height / 3)*2)){ return 'three'; } return 'second'; } } } return 'first'; }; // 返回含有上下内容的表格 graph.getLabel = function(cell) { var table = document.createElement('table'); table.style.height = '100%'; table.style.width = '100%'; var body = document.createElement('tbody'); var tr1 = document.createElement('tr'); var td1 = document.createElement('td'); td1.style.fontSize = '12px'; mxUtils.write(td1, cell.value.first); var tr2 = document.createElement('tr'); var td2 = document.createElement('td'); td2.style.fontSize = '12px'; mxUtils.write(td2, cell.value.second); var tr3 = document.createElement('tr'); var td3 = document.createElement('td'); td3.style.fontSize = '12px'; mxUtils.write(td3, cell.value.three); tr1.appendChild(td1); tr2.appendChild(td2); tr3.appendChild(td3); body.appendChild(tr1); body.appendChild(tr2); body.appendChild(tr3); table.appendChild(body); return table; }; // 返回要编辑的内容 graph.getEditingValue = function(cell, evt) { evt.fieldname = getFieldnameForEvent(cell, evt); return cell.value[evt.fieldname] || ''; }; // 标签内容改变时触发元素内值更新 graph.labelChanged = function(cell, newValue, trigger) { var name = (trigger != null) ? trigger.fieldname : null; if (name != null) { // Clones the user object for correct undo and puts // the new value in the correct field. var value = mxUtils.clone(cell.value); value[name] = newValue; newValue = value; mxGraph.prototype.labelChanged.apply(this, arguments); } }; // 给示例对象赋值 var value = new Object(); value.first = '上部内容'; value.second = '中部内容'; value.three = '下部内容'; // 获得默认元对象 var parent = graph.getDefaultParent(); // 在图形中添加元对象 //开启事务 graph.getModel().beginUpdate(); try { var v1 = graph.insertVertex(parent, null, value, 100, 60, 120, 80, 'overflow=fill;'); } finally { // 结束事务 graph.getModel().endUpdate(); } } }; </script> </head> <!-- 页面载入时启动程序 --> <body onload="main(document.getElementById('graphContainer'))"> <p> 双击上(下)一半的单元格的编辑不同领域的对象。 </p> <!-- 创建一个带网格背景的容器 --> <div id="graphContainer" style="overflow:hidden;position:relative;width:321px;height:241px;background:url('../examples/editors/images/grid.gif')"> </div> </body> </html>
特别要注意的是div id='graphContainer'这个容器背景url地址的写法要引用正确。
相关推荐
MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..
资源:mxGraph;包含ie,Firefox两个版本;版本号都是1.4.0.0;只带了一个Hello World的示例,其他的例子请自己去官网找吧
mxgraph开发包
mxGraph开发入门指南.pdf
NULL 博文链接:https://chwshuang.iteye.com/blog/1797168
这个插件支持在HTML页面中插入流程图,画得很漂亮 :-)
mxGraph1.8.0.3破解版mxclient,分IE ,FF 和chrome三个部分,不同浏览器加载不同的js文件,手动尝试过,1.8.0.5官方的例子都可以正常运行。
带Webpack的typed-mxgraph演示 来自Webpack Typescript入门 如何使用 在本地克隆项目 git clone https://github.com/typed-mxgraph/typed-mxgraph-demo.git 切换到项目目录 cd typed-mxgraph-demo 确保使用节点10...
mxGraph里头包含源码,以及常用的一些实例,相关介绍可以查阅博客:http://www.cnblogs.com/shawWey/p/7115124.html
mxgraph-demo-源码.rar
mxGraph1.9.1.1 mxclient.js破解文件下载 1.找到mxclient.js文件中的这句代码 注释 if ((eval('/156/145/167/40/104/141/164/145/50/51/56/147/145/164/124/151/155/145/50/51') / 1000) - 1270532723 >...
web开发拓扑图插件 mxGraph - An open source JavaScript diagramming component, started in 2005, that works on all major browsers, including touch devices.
vue配合mxGraph 入门实例项目,
在线画图www.draw.io网站的源码,基于mxGraph开发
mxgraph-svg2shape 一套将SVG文件转换为mxGraph资源的工具。 该存储库基于: SVG to XML mxGraph stencil definition translation tool. ... 添加 :将XML mxGraph模具定义转换为一组相应JavaScript /
mxgraph.js中文文档是一个官方的api,翻译来源于sunflower(github: https://github.com/SunInfoFE),提供给更多的开发者参考和共享源码资源!
mxgraph-1_10_4_0 官方源码+文档+示例
开源的mxgraph代码
mxgraph 3.1.2.1 eval