I am trying to implement some visualizations using Mondrian in Pharo 3.0.
My main problem is that I do not find a way to dynamically update the Mondrian view: I am able to remove nodes doing
view removeAllEdgesTo: node;
removeNode: node.
but I am not able to add nodes, change the layout and so on. I can change the nodes and edges, but the view does not seem to be refreshed.
Another thing I want to do is the following: I have the user dynamically choose a subset of nodes and a color, and I would like to be able to change the color of these nodes.
Is there a way to interact with Mondrian views outside the builtin interactions?
Related
I work in a framework, like OBO, where we use opaque IRIs and rely on labels to view terms. The class hierarchy shows IRIs, and so is unusable for us as is. Is there a way to configure a label (or labels) for viewing that visualization.
I am currently using GraphDB Free while prototyping some new work.
I created a custom view to arrange photos in a seamless grid, like Google Photos does (see below). My view is based on QAbstractItemView (Qt Widgets based). I would like to port this to QtQuick, in order to take advantage of hardware acceleration, animations, and touch.
QtQuick has some views inheriting from Flickable that it you can use with models, like ListView and GridView. Is there a way to create my own custom view? Things I thought about:
Create a proxy model that knows the width of the view, and lays out the images in rows. Then just use a Flickable with Repeaters to read from that model, and lay out the images. Downsides: Adding thousands of photos like this, without dynamically loading and recycling, is going to take too many resources.
Similar, but use a ListView on each "row" I put together above. Use the recycling capability of the ListView to not load too many rows. I would have to disable the selection function and roll my own on top. Could work, but seems very hacky.
Go to the source of the ListView, and implement something similar: https://code.woboq.org/qt5/qtdeclarative/src/quick/items/qquicklistview.cpp.html . QQuickListView inherits from (internal) QQuickItemView which does a lot of heavy lifting, and probably some things I don't need. This seems like the most correct way, but is a huge amount of work.
What's my best option here?
How can I make the "container" nodes in a Cytoscape Compound Graph smaller? The "cose" layout makes them gigantic for my graph, wasting an extreme amount of space. How can I "style" such container nodes to be a more reasonable size for the "child" nodes contained within it?
The size of compound parent nodes is a function of the position and dimensions of its child nodes. Thus, you can control parent node size via layout. You can try experimenting with the parameters of the existing layouts or you can even write your own.
In general, you have to experiment with the parameters of a layout to get the visual results you want. It can not be done automatically on the layout side.
I am currently working on my biggest project and I am having trouble figuring out how to structure my code. I'm looking for some guidance.
I have 2 objects a Tile and Container. Each Tile has a 2D coordinate and are all children of the Container. The Container has methods that return tile for location, switch tiles, add tiles, and remove tiles.
Now when you click on a tile it disappears, that was easy because it was self contained. The problem comes when I created different types of tiles that inherit from the base Tile. Each different type of tile does a different action when you click on it. Some destroy surrounding tiles some switch with other tiles and others add new tiles. For simplicity we will call these 3 subclasses Tile-destroy, Tile-swap, and Tile-add.
My problem is when I click on these tiles how can they act on other tiles in the Container. Should I just call functions in the parent class or is there a better way to do this? I am having trouble #including the Tile in the Container as well as the other way around. I feel like its not a proper pattern.
I have it set up so when a click takes place the Container handles it and checks the type of tile that is clicked and acts from there with a large else-if statement however this makes it very difficult to add new tile types. Ideally all the information for what happens when you click on a tile is contained within each tile subclass.
Any ideas?
I can suggest you the simpliest design:
Your Container will be a game controller
Each tile has Parent property which is refer to Container
When you click on tile it sends Command to Container (for example, DestroyTile(x, y) or AddTile(x, y)
Container handle this commands and destroys, adds or swap tiles.
If you want really good and more decoupled design you can also create handlers for all operation types DestroyTileHandler, AddTileHandler. In Container on different commands you will just pass them [commands] to appropriate handler. Also you need to pass context object (like Field with tiles) to handler. This allows you to add and modify new operations without even changing Container code.
See related patterns: Command, Observer
Feel free to ask questions and good luck!
I'm using Cytoscape JS to create a network. This is a large network and I need to hide some nodes to be more readable, but I can't redraw my network not including the hiding nodes.
How can I redraw using auto-layout after hiding some nodes?
It's not clear to me exactly what you mean. An example would probably help. There are different semantics for hidden versus removed elements, and it sounds like perhaps you want the elements removed.
I ended up solving similar problem by just having two instances of Cytoscape.js on a page. First is headless one (invisible, with no HTML-representation) that stores all data I have. Second one is visible and has a subset of objects I want to be visible and layouted at the moment.
Copying elements between instances is extremely easy, like:
cy.add(datacy.$('#elem1'));