JUNG layout for left-to-right placement of nodes - jung

Is there an optimal layout in JUNG for left-to-right placement of nodes in the graph? I'm looking for something that would model a data lineage and need to represent this somewhat linearly (left to right).

If your graph is a tree, then you can use the TreeLayout and do some post-processing to rotate it to have the root on the left instead of the top (see the L2RTreeLayoutDemo for an example of how to do this).
If your graph is only sort of tree-shaped, then you may want to extract a tree from your graph first (see MinimumSpanningTreeDemo for one way to do this automatically) and then follow the procedure above.
If neither of those works for you (for example, this won't work if your graph has multiple "roots"), then you will probably need to create your own layout, perhaps based on TreeLayout.

Related

Cytoscape define edge length

I am creating a manual layout for a network in Cytoscape version 3.8.2. I would like to be able to define the edge lengths, so the network looks more uniform. Is there a way to define the property edge length?
Specifically, I want something like the below subsection of a network to be a perfect circle.
No, the edge length is not a property in Cytoscape. You would need to calculate it based on the source and target node positions. One way to achieve what you want would be select all of the outer nodes, then do a degree-sorted circular layout, and then drag your central node back into the center.
-- scooter

How to always show Sirius Label in foreground

For the context, I'm working with Capella, an Eclipse RCP application based on Sirius (hence, EMF, GMF and draw2d). This application is used for MBSE, that basically means diagram representations for industrial systems.
I'm developping an add-on (viewpoint) to display custom labels next to diagram elements. These diagram elements are, to put it simply, boxes inside boxes. My problem is that usually the label text is larger than the space between a box and its container, so the label gets hidden. What I need is these labels to always be in foreground. As I'm more used to web development, what I'm looking for would be the equivalent of the z-index CSS property.
Currently I have no idea of how to achieve this, I'm using a custom .odesign that allows me to control some rendering options, like labels text, the color of some elements or to add decoration, but I dont think its the way to go for my problem. Maybe I should use a custom EditPart or a custom StyleConfiguration (I already used these components for other projects) but I have no clue where to start for this issue.
Any leads will be greatly appreciated.
We recently did this kind of changes to keep some labels in Sirius Sequence diagrams always on top: the combined fragments are placed behind the lifelines (z order) but we wanted to keep the labels of the CombinedFragments visible event their bounds intersects Lifelines, Executions or States).
This has been handled in Bug 564239 for Sirius 6.3.2 (used in Capella 1.4.1).
You could find some hints the bugzilla (Gerrits and commits can be retrieved from the See also section).
In Sirius Sequence diagram , we use org.eclipse.sirius.diagram.sequence.ui.tool.internal.layout.SequenceZOrderingRefresher to control the z-order of CombinedFragments : all the figures that composes them comes from some expressions in the odesign, and synchronization with the Capella model for exemple.
But in your case you want to control only the label, so it must not be dealt on the edit par level, but on the figure one. The "overlay" layer and figure lead might be a good one.
Do not forget another thing: in GMF/GEF, the labels of an element is displayed/shown/rendered/visible if it fits to the visible area of the parent container: in the case of a node in a container with scrollbar, the visible are will impact the visibility of the sub nodes (extended to their border nodes, edges, labels, ...)
Regards
Maxime

How to Simulate TListView(vsIcon mode) with Virtual TreeView

I am using Delphi XE3. Now I try to simulate TListView(vsIcon mode) with Virtual TreeView. Is that possible? Basically this is:
(1) A tree with only root nodes. That is easy to implement. Just use the following codeline is OK:
VirtualTreeView1.RootNodeCount := 5;
(2) Hide the tree lines. That is also easy to do, just set toShowRoot option to False can hide all the tree lines for the root nodes.
(3) Each root nodes is displayed with only icon instead of text. That can be implemented with OnGetImageIndex vent together with an image list assigned to the tree view.
(4) There is only one column. That is also easy. By default there is only one column.
(5) The nodes should be tiled from left to right, horizontally, instead of vertically.
The (5) point is the one that I cannot figure out how to implement. I try to do the following researches:
I try to check the TreeOptions and other properties, but cannot find one that support that feature.
I try to search online, and find the following articles:
How to display an icon or image in a column of TVirtualStringTree? (This use multi-column)
Icon position in Virtual Treeview (This does not discuss tiling of nodes horizontally.
Delphi - ListView or similar with owner draw button ( THis also tile the nodes vertically)
I then try to search keyword horizontally in the help document of Virtual TreeView, but what I get are all about how to scroll horizontally, not tile node horizontally.
I think I have tried my best to find a solution but failed. That is the reason why I ask on stackoverflow.
I don't think this is possible, at least Virtual TreeView was never designed to do this. It is a tree control that supports columns.

What TeeChart Tool can I use to Interactively select points from a FastLine Graph

While using Delphi Seattle 10 and Steema TeeChart Pro VCL FMX 2016.18, I am looking to Highlight a Selection of a Line Graph (multiple series) in the way that Zooming allows / makes a square around a highlighted selection of a Line Graph to indicate which part of it to zoom into (as long as the onmousedown action is in progress).
The purpose of this would be to allow the selection to remain highlighted while the mouse is no longer being clicked, to potentially "Delete" the highlighted Data points. All I need this for is to obtain the (X0 Y0 X1 Y1) values to possibly obtain the CalcPosPoint(X) and remove all the points inside. The data is currently obtained through a Record Struct (Memory Mapped) file, and it will there for be used to set/check for a property "deleted" to indicate on the next redraw of the graph which rows to completely ignore and which to continue printing.
I hope to be able to do this (select from 1 chart), and have it simultaneously draw on multiple graphs. I have tried to look for an example of this feature through the use of TSelectorTool (FMXTee). One of the pages I found referring to such a tool is Interactive data point selection as well as Multiple selections with Selector Tool
And my second question has to do with TeeCharts directly. Where would I find fmx240.bpl as TeeChart_Pro_Firemonkey_Demo.exe requires this file in order to run? I did manage to copy vcl240.bpl from "Embarcadero\Studio\18.0\bin" and put it into "Embarcadero\Studio\17.0\bin"
[Edited]
I have managed to capture / create a sample code (MVCE) from which I can now select a portion and create a square around a particular sample of graph lines.
The control graph right now is the bottom graph (Chart5). If anyone is interested in seeing the code, I have put up a pastebin sample.
PasteBin Sample Code
And a TeeCharts.tar.gz is accessible to anyone who wishes to see a sample of the code, as well as the data sample.
filetolink.com Source Files
I no longer feel the need for mathematical equation to differentiate the top graphs from the bottom (because the bottom axes are automatic where as the top are defined). I intend to only use the space which is adherent to the visible space, and do not intend to extend in either direction (left or right). That means at this point the size of the graph does not matter, because once I over populate the charts above, the position in the bottom graph would become irrelevant, and therefor I do not intend to use the bottom chart.
The next step is to save the positions of the boxes so that they can reappear when the graph is shift from left (past data) to the right (live data). And then uses the buttons above to make the appropriate action to the graphs.
I would like to know what way would be the most sufficient way to record the positions of the rectangles, so when the chart is shifted (via the ScrollBar1), the rectangles are moving with the direction of the scrollbar. But I'm sure I can achieve that.
I think I have found a solution. The red squares are only prevalent for the visual aspect, they can be drawn on, I don't need to do anything special with each chart, as I already know what the X0..Y1 parameters are, they are known from the initial chart. The problem h/e has to do with the initial chart. As long as the screens are all full, I can zoom in correctly w/ alignment with on all the charts (ZoomRect/Rectf(X0..Y1))
But what kind of equation would it take to adjust the charts that are not in the same zoom / max / min when the Chart5.Axes.Bottom.Automatic = True?
From there I just simply have to disable the immediate zoom feature, and allow buttons to become functional, to decide what the next course of action would be.

How to depict a radar chart in iOS?

I'm currently developing my iOS app and want to depict a graph whose shape is a circle like pie chart, but its radius is dependent on each specific values. Sorry I don't know what the name of such chart is, but I'm sure every sane baseball fans or any sports fans I think should have ever seen such chart. For example, if a team's batting average is the best in the league which consists of 5 teams, its radius is length 5 (or any other length proportional to the other values), and if the same team's earned runs average is fourth in the league, its length is 2, etc, etc... and then those points or "tips" are connected to each other within the chart, and finally the area of the connected figure is filled with any colors.
Sorry for the awful explanation (it's quite difficult for non-English native to explain it more clearly), but my question is, is it feasible to depict such graphs in iOS application? If it can be done in iOS app, how/what library do I use to plot such graphs?
I've read Core Graphics documentation as well as CorePlot example page but I wasn't able to find any such charts in those pages. I don't like the idea of using D3 embedded in UIWebView as suggested in this post since it's slow due to network latency. I don't know any other libraries to be as flexible and versatile as the two libraries above.
I use iOS 7.1 and Xcode 5.1.
[Update]
It's not a bubble chart. Let me explain it a little bit more concretely. The chart is a hexagon if every component of a record or sample is the best among the other competing records or samples and the number of the component to be described is six. In other words, the length of the component from the origin is whatever the longest possible values. But if one component, say, stolen bases, is NOT the best in the samples - say, it's the second best -, then the length of the component from the origin is not the longest; it's the second longest among the samples. And once every components (6 in this case) is plotted on the graph, those plotted points are connected to each other, and it finally is filled with whatever colors to make it the "area" of the record. And then this might be repeated in other records or samples as well. But unlike the bubble chart, one graph is made of one record and six features (or columns or variables) in this case - not all records and one feature (actually, three, but only one is used to make a bubble) which it is in the case of the bubble chart. Hope you get it...
[Update 2]
I finally got such charts on the Internet! The chart is something like this:
.
You're describing a bubble chart. You can make one with Core Plot using a scatter plot. Implement one of the following datasource methods to provide custom plot symbols. Use your data to determine the size of each symbol. They can be different shapes and have varying fills and border line styles, too.
-(NSArray *)symbolsForScatterPlot:(CPTScatterPlot *)plot recordIndexRange:(NSRange)indexRange;
-(CPTPlotSymbol *)symbolForScatterPlot:(CPTScatterPlot *)plot recordIndex:(NSUInteger)idx;

Resources