jhplot
Class HGraph
- java.lang.Object
-
- jhplot.gui.GHPanel
-
- jhplot.gui.GHFrame
-
- jhplot.HGraph
-
- All Implemented Interfaces:
- java.awt.event.ComponentListener, java.io.Serializable, java.util.EventListener
public class HGraph extends GHFrame
Create a frame with interactive graphs. In addition, using the methods buildGraph(), one can make graphs without visualization.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description boolean
set
-
Constructor Summary
Constructors Constructor and Description HGraph()
Construct a Graph without any canvas.HGraph(java.lang.String title)
Construct a HGraph canvas with a plot with the default parameters 600 by 400, and 10% space for the global titleHGraph(java.lang.String title, int xs, int ys)
Construct a HPlot canvas with a single plot/graphHGraph(java.lang.String title, int xs, int ys, boolean set)
Construct a HGraph canvas with a single plot/graphHGraph(java.lang.String title, int xs, int ys, int n1, int n2)
Construct a HGraph canvas with plots/graphsHGraph(java.lang.String title, int xsize, int ysize, int n1, int n2, boolean set)
Create HGraph canvas with several graphs.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
addEdge(java.lang.String vertex1, java.lang.String vertex2)
Add a connector between 2 vertexesvoid
addVertex(java.lang.String vertex)
Add a new vertexorg.jgrapht.graph.DefaultDirectedGraph<java.lang.Object,org.jgrapht.graph.DefaultEdge>
buildDirectedGraph()
Build a directed graph without visualization.org.jgrapht.graph.DirectedMultigraph<java.lang.Object,org.jgrapht.graph.DefaultEdge>
buildDirectedMultigraph()
Build a directed multi-graph without visualization.org.jgrapht.graph.DirectedPseudograph<java.lang.Object,org.jgrapht.graph.DefaultEdge>
buildDirectedPseudograph()
Build a directed Pseudograph graph without visualization.org.jgrapht.graph.DirectedWeightedMultigraph<java.lang.Object,org.jgrapht.graph.DefaultWeightedEdge>
buildDirectedWeightedMultigraph()
Build a weighted directed graph without visualization.org.jgrapht.graph.Multigraph<java.lang.Object,org.jgrapht.graph.DefaultEdge>
buildMultigraph()
Build a directed multi-graph without visualization.org.jgrapht.graph.Pseudograph<java.lang.Object,org.jgrapht.graph.DefaultEdge>
buildPseudograph()
Build a Pseudograph graph without visualization.org.jgrapht.graph.SimpleGraph<java.lang.Object,org.jgrapht.graph.DefaultEdge>
buildSimpleGraph()
Build a simple graph without visualization.org.jgrapht.graph.SimpleWeightedGraph<java.lang.Object,org.jgrapht.graph.DefaultWeightedEdge>
buildSimpleWeightedGraph()
Build a simple weighted graph without visualization.org.jgrapht.graph.Pseudograph<java.lang.Object,org.jgrapht.graph.DefaultWeightedEdge>
buildWeightedPseudograph()
Build a Pseudograph graph without visualization.void
clear()
Clear the current graph including graph settings.void
clear(int i1, int i2)
Clear the graph characterized by an index in X and Y.void
clearAll()
Clear all graphs from data and settings.void
close()
Close the canvas (and dispose all components) Note: a memory leak is found - no time to investgate it.void
destroy()
Destroy the canvas framevoid
doc()
Show online documentation.org.jgraph.JGraph
getGraph()
Returns the current graphorg.jgrapht.ListenableGraph
getListenableGraph()
Returns the current Listenable Graphvoid
quit()
void
setPos(java.lang.String vertex, int n1, int n2)
Set vertex positioncom.mxgraph.swing.mxGraphComponent
showGraph(org.jgrapht.Graph g)
Shows a graph previously built using "build*" methods.void
update()
Update frame.void
visible()
Set the canvas frame visiblevoid
visible(boolean vs)
Set the canvas frame visible or not-
Methods inherited from class jhplot.gui.GHFrame
addGraph, cd, componentHidden, componentMoved, componentShown, getCdX, getCdY, getFrame, getHTMLUrl, getNtotX, getNtotY, setPlotsNum, updateFrame
-
Methods inherited from class jhplot.gui.GHPanel
addComp, componentResized, convertSVG, convertSVG, disableDoubleBuffering, enableDoubleBuffering, export, getCanvasPanel, getMarginBackground, getMarginPanelBottom, getMarginPanelCenter, getMarginPanelLeft, getMarginPanelRight, getMarginPanelTop, getMarginSizeBottom, getMarginSizeLeft, getMarginSizeRight, getMarginSizeTop, getSizeX, getSizeY, getTextBottom, getTextBottomColor, getTextBottomColorBack, getTextBottomFont, getTextLeft, getTextLeftColor, getTextLeftColorBack, getTextLeftFont, getTextPosBottomX, getTextPosBottomY, getTextPosLeftX, getTextPosLeftY, getTextPosRightX, getTextPosRightY, getTextPosTopX, getTextPosTopY, getTextRight, getTextRightColor, getTextRightColorBack, getTextRightFont, getTextRotationBottom, getTextRotationLeft, getTextRotationRight, getTextRotationTop, getTextTop, getTextTopColor, getTextTopColorBack, getTextTopFont, isBorderShown, printGraph, resetMargins, setGTitle, setGTitle, setGTitle, setGTitle, setGTitle, setMarginBackground, setMarginSizeBottom, setMarginSizeLeft, setMarginSizeRight, setMarginSizeTop, setSizePanel, setTextBottom, setTextBottom, setTextBottom, setTextBottom, setTextBottomColorBack, setTextLeft, setTextLeft, setTextLeft, setTextLeft, setTextLeftColorBack, setTextPosBottomX, setTextPosBottomY, setTextPosLeftX, setTextPosLeftY, setTextPosRightX, setTextPosRightY, setTextPosTopX, setTextPosTopY, setTextRight, setTextRight, setTextRight, setTextRight, setTextRightColorBack, setTextRotationBottom, setTextRotationLeft, setTextRotationRight, setTextRotationTop, setTextTop, setTextTop, setTextTop, setTextTopColorBack, showBorders
-
-
-
-
Constructor Detail
-
HGraph
public HGraph(java.lang.String title, int xsize, int ysize, int n1, int n2, boolean set)
Create HGraph canvas with several graphs.- Parameters:
title
- Titlexsize
- size in x directionysize
- size in y directionn1
- number of plots/graphs in xn2
- number of plots/graphs in yset
- set or not the graph
-
HGraph
public HGraph(java.lang.String title, int xs, int ys)
Construct a HPlot canvas with a single plot/graph- Parameters:
title
- Title for the canvasxs
- size in xys
- size in y
-
HGraph
public HGraph(java.lang.String title, int xs, int ys, boolean set)
Construct a HGraph canvas with a single plot/graph- Parameters:
title
- Title for the canvasxs
- size in xys
- size in yset
- set or not the graph (boolean)
-
HGraph
public HGraph(java.lang.String title, int xs, int ys, int n1, int n2)
Construct a HGraph canvas with plots/graphs- Parameters:
title
- Title for the canvasxs
- size in xys
- size in yn1
- number of plots/graphs in xn2
- number of plots/graphs in y
-
HGraph
public HGraph(java.lang.String title)
Construct a HGraph canvas with a plot with the default parameters 600 by 400, and 10% space for the global title- Parameters:
title
- Title
-
HGraph
public HGraph()
Construct a Graph without any canvas. This constructor can be used to build graphs without visualization.
-
-
Method Detail
-
buildPseudograph
public org.jgrapht.graph.Pseudograph<java.lang.Object,org.jgrapht.graph.DefaultEdge> buildPseudograph()
Build a Pseudograph graph without visualization. It assumes DefaultEdges. No visualization is assumed.- Returns:
- graph with default edges.
-
buildWeightedPseudograph
public org.jgrapht.graph.Pseudograph<java.lang.Object,org.jgrapht.graph.DefaultWeightedEdge> buildWeightedPseudograph()
Build a Pseudograph graph without visualization. It assumes DefaultEdges. No visualization is assumed.- Returns:
- graph with default edges.
-
buildDirectedPseudograph
public org.jgrapht.graph.DirectedPseudograph<java.lang.Object,org.jgrapht.graph.DefaultEdge> buildDirectedPseudograph()
Build a directed Pseudograph graph without visualization. It assumes DefaultEdges. No visualization is assumed.- Returns:
- graph with default edges.
-
buildSimpleGraph
public org.jgrapht.graph.SimpleGraph<java.lang.Object,org.jgrapht.graph.DefaultEdge> buildSimpleGraph()
Build a simple graph without visualization. It assumes DefaultEdges. No visualization is assumed.- Returns:
- graph with default edges.
-
buildSimpleWeightedGraph
public org.jgrapht.graph.SimpleWeightedGraph<java.lang.Object,org.jgrapht.graph.DefaultWeightedEdge> buildSimpleWeightedGraph()
Build a simple weighted graph without visualization. It assumes DefaultWeightedEdge. No visualization is assumed.- Returns:
- graph with default edges.
-
buildDirectedGraph
public org.jgrapht.graph.DefaultDirectedGraph<java.lang.Object,org.jgrapht.graph.DefaultEdge> buildDirectedGraph()
Build a directed graph without visualization. It assumes DefaultEdges. No visualization is assumed.- Returns:
- graph with default edges.
-
buildMultigraph
public org.jgrapht.graph.Multigraph<java.lang.Object,org.jgrapht.graph.DefaultEdge> buildMultigraph()
Build a directed multi-graph without visualization. It assumes DefaultEdges. No visualization is assumed.- Returns:
- graph with default edges.
-
buildDirectedMultigraph
public org.jgrapht.graph.DirectedMultigraph<java.lang.Object,org.jgrapht.graph.DefaultEdge> buildDirectedMultigraph()
Build a directed multi-graph without visualization. It assumes DefaultEdges. No visualization is assumed.- Returns:
- graph with default edges.
-
buildDirectedWeightedMultigraph
public org.jgrapht.graph.DirectedWeightedMultigraph<java.lang.Object,org.jgrapht.graph.DefaultWeightedEdge> buildDirectedWeightedMultigraph()
Build a weighted directed graph without visualization. It assumes DefaultWeightedEdge. No visualization is assumed.- Returns:
- graph with default edges.
-
showGraph
public com.mxgraph.swing.mxGraphComponent showGraph(org.jgrapht.Graph g)
Shows a graph previously built using "build*" methods. It assumes CircleLayout.- Parameters:
g
- input graph.- Returns:
- component with visualized graph.
-
visible
public void visible(boolean vs)
Set the canvas frame visible or not- Parameters:
vs
- (boolean) true: visible, false: not visible
-
update
public void update()
Update frame.
-
visible
public void visible()
Set the canvas frame visible
-
destroy
public void destroy()
Destroy the canvas frame
-
setPos
public void setPos(java.lang.String vertex, int n1, int n2)
Set vertex position- Parameters:
vertex
- Vertex namen1
- Position in Xn2
- Position in Y
-
clear
public void clear()
Clear the current graph including graph settings. Note: the current graph is set by the cd() method
-
clear
public void clear(int i1, int i2)
Clear the graph characterized by an index in X and Y. This method cleans the data and all graph settings.- Parameters:
i1
- location of the graph in Xi2
- location of the graph in Y
-
clearAll
public void clearAll()
Clear all graphs from data and settings.
-
close
public void close()
Close the canvas (and dispose all components) Note: a memory leak is found - no time to investgate it. set to null all the stuff
-
addVertex
public void addVertex(java.lang.String vertex)
Add a new vertex- Parameters:
vertex
- added vertex
-
addEdge
public void addEdge(java.lang.String vertex1, java.lang.String vertex2)
Add a connector between 2 vertexes- Parameters:
vertex1
- first vertexvertex2
- second vertex
-
getGraph
public org.jgraph.JGraph getGraph()
Returns the current graph- Returns:
- Current graph
-
getListenableGraph
public org.jgrapht.ListenableGraph getListenableGraph()
Returns the current Listenable Graph- Returns:
- Current graph
-
quit
public void quit()
-
doc
public void doc()
Show online documentation.
-
-
DMelt 3.0 © DataMelt by jWork.ORG