jgraphx

overlapping edges in DirectedWeightedGraph in JGraphT using mxCircleLayout

一个人想着一个人 提交于 2021-02-11 16:41:01
问题 Running below code on an already constructed Graph (usind ArbEdge.class as Edges) Graph<String, ArbEdge> graph = new DefaultDirectedWeightedGraph<>(ArbEdge.class); public void pngGraph() { JGraphXAdapter<String, ArbEdge> graphAdapter = new JGraphXAdapter<String, ArbEdge>(this.getGraph()); mxIGraphLayout layout = new mxCircleLayout(graphAdapter); // mxParallelEdgeLayout layout = new mxParallelEdgeLayout(graphAdapter); layout.execute(graphAdapter.getDefaultParent()); BufferedImage image =

overlapping edges in DirectedWeightedGraph in JGraphT using mxCircleLayout

谁说胖子不能爱 提交于 2021-02-11 16:39:01
问题 Running below code on an already constructed Graph (usind ArbEdge.class as Edges) Graph<String, ArbEdge> graph = new DefaultDirectedWeightedGraph<>(ArbEdge.class); public void pngGraph() { JGraphXAdapter<String, ArbEdge> graphAdapter = new JGraphXAdapter<String, ArbEdge>(this.getGraph()); mxIGraphLayout layout = new mxCircleLayout(graphAdapter); // mxParallelEdgeLayout layout = new mxParallelEdgeLayout(graphAdapter); layout.execute(graphAdapter.getDefaultParent()); BufferedImage image =

overlapping edges in DirectedWeightedGraph in JGraphT using mxCircleLayout

家住魔仙堡 提交于 2021-02-11 16:38:30
问题 Running below code on an already constructed Graph (usind ArbEdge.class as Edges) Graph<String, ArbEdge> graph = new DefaultDirectedWeightedGraph<>(ArbEdge.class); public void pngGraph() { JGraphXAdapter<String, ArbEdge> graphAdapter = new JGraphXAdapter<String, ArbEdge>(this.getGraph()); mxIGraphLayout layout = new mxCircleLayout(graphAdapter); // mxParallelEdgeLayout layout = new mxParallelEdgeLayout(graphAdapter); layout.execute(graphAdapter.getDefaultParent()); BufferedImage image =

Overlapping edges with JGraphx

老子叫甜甜 提交于 2020-12-31 06:22:31
问题 I'm building a graph with JgraphX. The directed graph represent roads and intersections. For every route I define two edges, one for each direction. As result, the image of the graph has the two edges (representing the road) overlapped. How can I avoid this? Does the vertex have some things like anchor points for the edges? If so, how can I define them? This is the code I use to display graph package it.rex.view; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing

Undirected Graphs in JGraphX

坚强是说给别人听的谎言 提交于 2020-01-23 12:14:55
问题 I try to show graphs in JGraphx. Everything is fine as long as I use directed Graphs, but when I try to show an undirected one, its shown with direction. The code is from the demo of jgrapht. package org.jgrapht.demo; import com.mxgraph.layout.*; import com.mxgraph.swing.*; import java.awt.*; import java.nio.file.FileSystem; import javax.swing.*; import org.jgrapht.*; import org.jgrapht.ext.*; import org.jgrapht.graph.*; /** * A demo applet that shows how to use JGraphX to visualize JGraphT

How to make the edges of needed form in jgraphx's graph?

心不动则不痛 提交于 2020-01-02 14:37:47
问题 My graph contains rectangular vertices with single outgoing edge and the vertices of rhombus shape with two outgoing edges. I'm using mxCompactTreeLayout and mostly everything is ok except that edges of the vertices of the second type look wrong for me. I want them to look like in the picture Instead, edges connected to the bottom segments of the rhombus. What should I do to get edges look as desired. EDIT: Added source code. PtNodeVertex.java package org.jsc.core.visualization.jgraphx;

How to make the edges of needed form in jgraphx's graph?

纵然是瞬间 提交于 2020-01-02 14:37:09
问题 My graph contains rectangular vertices with single outgoing edge and the vertices of rhombus shape with two outgoing edges. I'm using mxCompactTreeLayout and mostly everything is ok except that edges of the vertices of the second type look wrong for me. I want them to look like in the picture Instead, edges connected to the bottom segments of the rhombus. What should I do to get edges look as desired. EDIT: Added source code. PtNodeVertex.java package org.jsc.core.visualization.jgraphx;

java JGraphx save as an image

房东的猫 提交于 2019-12-23 09:26:35
问题 Does anyone know how to export JGraphx as an image in any format? If not, then does anyone know any other java library that will let me create simple diagrams and then save it as an image? 回答1: This should do it for PNG format: BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, Color.WHITE, true, null); ImageIO.write(image, "PNG", new File("C:\\Temp\\graph.png")); Where graph is your mxGraph object. (Note mxCellRenderer is a reference to a class not a variable, so

mxHierarchicalLayout not working as expected

梦想的初衷 提交于 2019-12-22 10:49:01
问题 I'm using JGraphx to draw a graph inside a Swing Panel and all works fine. I try to insert two cells inside a target cell and is working, but layout is changing and all cells are not horizontal. So my example is: 1) build a graph with some cells: 2) press top botton and add two cells inside Hello: As you can see, problem is layout is not horizontal anymore, even if I call again mxHierarchicalLayout. Thanks for answers! package com.mxgraph.examples.swing; import java.awt.BorderLayout; import

Jgraphx out of memory - Java

你说的曾经没有我的故事 提交于 2019-12-13 00:45:02
问题 I am trying to create an mxgraph and a image from the created mxgraph in JAVA. Below is the code to create the image from mxgraph. BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, Color.WHITE, graphComponent.isAntiAlias(), null, graphComponent.getCanvas()); // Creates the URL-encoded XML data mxCodec codec = new mxCodec(); String xml = URLEncoder.encode(mxXmlUtils.getXml(codec.encode(graph.getModel())), "UTF-8"); mxPngEncodeParam param = mxPngEncodeParam