mxgraph

How to get the id of an maxGraph cell's content

蓝咒 提交于 2019-12-14 03:56:00
问题 I've created a graph and am setting cells onto it via drag and drop. However when a drop or click happens I cannot find the clicked cell's html for use. For instance I'm trying to get the ID of the dragged element within the mxEvent.CLICK . graph.addListener(mxEvent.CLICK, function(sender, evt){ var cell = evt.properties.cell; // cell.id is the cell id, not an id of html that's inside of it. if(cell) { var outer = cell.value.outerHTML; // I can see the HTML here encoded } }) UPDATES: So I add

initialize mxgraph with default xml model

血红的双手。 提交于 2019-12-14 03:25:23
问题 How can I start with an existing XML model in mxgraph . I have a default XML graph and i want to import it on mxgraph load (start) 回答1: Using the GraphEditor - Template You can set a default mxGraphModel by appling it with setGraphXML . The following example shows you how to apply a default mxGraphModel. In the data -object, declare your default model as xml. Then you can parse the model with parseXml to xml and then apply it to the graph. Implementation of setGraphXML in the GraphEditor var

MXGraph adding edges

白昼怎懂夜的黑 提交于 2019-12-13 18:19:36
问题 In MXGraph, edges can be added using graph.addEdge() but this requires passing 2 vertices as arguments. I want to create an edge which can be randomly placed on the graph, without the need to the vertices, just like in draw.io or graph editor. After googling, mxCell can be used for the same but I am not able to understand the usage. Please Help. 回答1: Whenever you use mxCells, you need to set TerminalPoints for each of the sides if you are using it as an Edge. After Adding and setting it as an

How to retain drawn boxes and path on page refresh mxgraph

对着背影说爱祢 提交于 2019-12-13 11:24:11
问题 i want to retain drawn boxes and path once page is refreshed. i'm using mxgraph https://jgraph.github.io/mxgraph/docs/manual.html Question: once the drawing is done, if i do page refresh it should retain the same drawing by storing drawing data into localStorage. NOTE: i want to get json object of drawn canvas , and re-construct it back from that object on page refresh. Below video shows how to draw: https://drive.google.com/file/d/1McTMz3e8I_quOcLGt2CtaQhqif3R31qs/view https://jgraph.github

How to update the graph model efficiently after certain operation in mxgraph?

天涯浪子 提交于 2019-12-11 15:28:13
问题 After consecutive drag and drop in mxgraph, the parentInfo is lost for cell. Children and Parents for cell are not getting updated after consecutive drag and drop. Drag and Drop is handled using connect, the logic behind is simple. Removing the existing parent connection and establishing new edge connection with target node. mxConnectionHandler.prototype.connect = function( source, target, evt, dropTarget ) { var sourceParentCell = getParentCell(source); if (sourceParentCell !== target) {

Need to integrate mxGraph with Angular 6

99封情书 提交于 2019-12-11 08:01:30
问题 I need to implement a gantt chart and think mxGraph Gantt could be the ideal solution. The only problem is with the integration of it in the application. Has anyone tried integrating and implementing it. If so , then please provide some directions/instructions on how to use it. https://github.com/jgraph/mxgraph/ 回答1: Here is Complete Solution: Few details about different mxGraph Repos: Repo-1: https://github.com/jgraph/mxgraph This is an official release repo of mxGraph. With npm issues. Repo

adding connection handler on click hover icon not working mxGraph

倾然丶 夕夏残阳落幕 提交于 2019-12-11 05:26:22
问题 I am trying to create an application in which on click a cell 3 icons are displaying. When clicking one of that icon I need to create a connection handler from the selected cell and need to point to some target. On click the arrow connection button the connection handler should start and should end on mouse click. I have tried to create but the problem is the line is not displaying. Connection line is showing, but after click the arrow line is not showing. // Defines a new class for all icons

Infinite loop when overriding graphHandlerMouseUp on MxGraph using Angular

早过忘川 提交于 2019-12-11 04:06:00
问题 I have a difficult question to explain and I'm way out of my comfort zone as far as expertise in Javascript, TrueType, Angular and MxGraph are concerned... Hope to be able to explain. I have an Angular component displaying and MxGraph. I was able to integrate MxGraph with Angular following this link (How to integrate mxGraph with Angular 4?). Even if I use Angular 7, the solution still works... The graph is displayed correctly on the page and everything works fine, including my override of

mxGraph - Export to Image

心不动则不痛 提交于 2019-12-11 02:47:36
问题 I am trying to export mxGraph to PNG image. In the graph HTMLLabels is set to true and custom html formatted (Using Div tags) content used for vertex labels. In the exported image, raw html tags are getting displayed instead of formatted one. This is for javascript as client and C# as backend. Code Sample:Actual Image Expected Image // Setting HTML Label to true mxGraph.prototype.isHtmlLabel = function(cell) { return true; } graph.convertValueToString = function(cell) { if (mxUtils.isNode

SVG shapes instead of stencils

别来无恙 提交于 2019-12-06 16:35:09
问题 I'm new in mxGraph world and trying to find out how to use SVG symbols with mxGraph in JS. I have a number of SVG files that I would like to use with mxGraph instead of converting each of these to stencils. Is there a way to do that? I have tried using SVG symbol as image in shapes but then I have the problem with connections not going all the way into the symbol. Any suggestions? Thanx in advance. 回答1: If you just want to use it as an image mxImage can help you. If you want a special shape