Gephi: How to create a dynamic graph and change the labels of nodes dynamically? - graph-visualization

What I'm trying to do is a visualization of a label propagation algorithm. I need to change the label of a node within certain time and accordingly to that label the node need to assume the color that label.
The trick Gephi part here is how to change the label dynamically from the gexf file so I can set the Gephi to show different colors to different labels or how do I just change the color directly on the file (but accordingly to the time stamp, not in a static way).
I know that question is very specific but I saw some Gephi user around SO before.
Thank you!

You need to add a column, e.g. "label" to the node import file, and give numbers according to how you want to "group the nodes into one color". And then you can select to color the nodes via your new column.

According to the GEXF Primer ou can't have dynamic labels. However you can set a dynamic attribute, and in Gephi you can edit the attribute used as the label (the default attribute is of course "Label").

Related

How build a sunburst diagram that responds to a slider

I'm trying to build a sunburst diagram with an interactive slider. More specifically, I would like the slider, which is based on date, to appear and disappear slices in the sunburst according to the date associated with those slices.
I have created both the slider and the sunburst, but cannot get them to work together.
http://plnkr.co/edit/YIHd7o3fQ9RLFuN5PWVa?p=preview
I believe the problem lies in the 'updateData' function, which compares the date selected by the slider to the date associated with each datapoint. More specifically, the syntax obtaining the date of the slices appears to be incorrect, as it console.log() a "null" value.
Things I've tried:
To check syntax, I replaced d.data.Cattime with d.data.id. The latter logs the dataset information to the console - suggesting the syntax is correct. Strangely, this doesn't work with d.data.parentId.
I thought the problem might be that items under the Cattime heading is not represented as a date. But this code, console.log(parseDate(data[1].Cattime)); suggests that this is recognized as a date.
Any suggestions appreciated.
You should compare two date objects in your return statement.
svg.selectAll(".node").style("fill", function(d) {
return new Date(((d.data.data.Cattime))) > new Date(h) ? "red" : "black";
}
Also, initially you are setting fill color of path as a style property, but in your update function you are setting it as an attribute.
Apparently, its value doesn't change when you set it as an attribute later on. So, either change update function to style or change your initialization to attribute.
working example

How can I add an icon in a label?

I have 2 questions need your help.
I would like to add a button on each plot to be a setting button. I use label with event listener and it works well ( as shown in attached file). However, my client asked me to change from normal text to graphic icon? How should I proceed?
As you can see from the attached image, the third plot is macd series. The value rage is from -3e-8 to 3e-8 (by my observation). I manually set the maximum and minimum, and it get incorrect scale as shown.
How should I set the maximum and minimum for yScale?
I don't know how to get maximum and minimum value from a series. Can you suggest me?
A1 – Unfortunately, the current version of AnyChart doesn't provide an opportunity to add custom-made buttons inside the chart. But you can use a trick and use stage based layout. It means that the container includes a stage. The stage includes the stock chart all other elements by layers. Using this approach you can place an image (icon) upon the plot and set a listener just as for the 'settings' label.
For details, please, check the sample in the comment below.
A2 - We are planning to fix this behavior in 8.4.2 update (approximately by the end of November 2018).
I will notify you when the fix becomes available.
As a temporary workaround, you can get min /max value from your MACD indicator. For details, please, check the sample in the comment below.
You can apply min/max to the yScale of plot #0 like this:
chart.plot(0).yScale().minimum(minValue);
chart.plot(0).yScale().maximum(maxValue);
We are glad to inform you that we have released 8.4.2 update which brings many fixes and improvements. This update also includes a fix on the issue you reported. Now calculation of min/max of Y-scale works properly with small values. Update your binaries to get the fix.

dc.js heatmap expanding data

I am trying to show machine states over time. Part of this is to reproduce/automate a report that used to be done by hand. It consists of coloring 2minute 'time slices' in Excel based on what the machine is doing.
(Sorry, not enough reputation to post a picture, but it is a classic heatmap where the state drives the color. Some non DC-JS fiddle: http://jsfiddle.net/ww6Lbnc5/4/)
I was able to generate most of what I want in the following jsfiddle:
http://jsfiddle.net/hwhfxz2t/14/
See fiddle for code.
The total state duration (for selected time frame) is shown in the pieChart, followed by the individual state lines and then the heatmap that people are used to. (the ZOOM and date selection buttons do not work in the fiddle but are there to select specific data ranges or zoom in if you like).
The line charts uses the original representation of the states, which consists of a time the state is entered and a duration.
In order to make the heat map work, I had to (I think) take the original data and convert it into individual minute chunks and mark them with a state. So for instance the original data specifying:
RUN state starting 14:30 for 300 seconds
becomes:
14:30=RUN, 14:31=RUN, 14:32=RUN, 14:33=RUN and 14:34=RUN
The code in lines 233-297 loops through the original data and generates a new one that does this. In cases where there is more than one state within a given minute, the last state survives.
This works okay but it seems that this code is exactly what is normally done in group().reduce(add,remove,init). But in this case I need to add multiple timeslots depending on the duration of a state.
Also, because it is now using a different crossfilter, maps do not update each other.
Here are my questions related to this:
Can I display a heatmap without supplying information for all individual
'cells'? (i.e. straddle cells based on a value, similar to rowspan in a table)
Can I add multiple values at once inside group().reduce()?
Is there an easy way to invert the yAxis so 0 is at the top?
When clicking a row in the heatmap, it selects a column and vice-versa?
I'm not sure if this should be in the crossfilter group. If so please ignore my rambling. If someone knows how to keep the charts linked by grouping better, please let me know.
--Nico
Concerning Question 3:
DC.js heatmaps currently do not support custom order functions on axis but there is a pull request that has been merged into the developing branch and should be accessible to the public soon.
You could manually edit the dc.js file to set the sorting in heatmaps to a custom function. In the latest (2.0.0-beta10) version it is the following line:
rowValues.sort(d3.ascending);
and accordingly
colValues.sort(d3.ascending);

Network node highlighting with Crossfilter

I have a graph with a network and a few histograms.
For the network, each node has a few properties with continuous value. The histograms are for node properties. Is there an easy way to highlight the node in the network, when users brush the histogram? Could I bind a dimension of the network data to the node class attribute "selectednode"?
I have checked dc.js, but it seems not support network graph.
Thanks
Crossfilter isn't really built for highlighting, as filtering will remove the data outside the filter from the view of other dimensions and groups. It sounds like you don't want unselected network nodes to disappear, but rather want nodes with property values falling within the selection to be highlighted. I'd build either your histogram or your network directly based on unfiltered data (not based on the Crossfilter) and then whenever the brush event happens, re-render the network nodes, checking the current brush extent against the property values.
How about two crossfilters built from the same records? The filtering one (cfFilt) would work as expected with dimensions for everything that can be filtered. The highlighting filter (cfHigh) would have one dimension (based on a record id or an identity function, d=>d) that is filtered by inclusion in cfFilt.groupAll(), plus dimensions that filter anything that can be highlighted. (cfFilt().groupAll().reduce() will need to return records, not counts. I can say how in comments if anyone needs to know.)
So cfHigh.groupAll() returns the records that pass through all the filtering and all the highlighting.
An interesting (and otherwise hard to achieve) consequence of this approach is that if you highlight something, then a filter makes that thing disappear, and then that filter is removed and the thing comes back, it will stay highlighted as long as nothing came along to change the highlighting filter in the meantime.

d3.js calendar view - colours + custom date

I have a few questions regarding his calendar view of mine
http://bl.ocks.org/mhska/5333055
data ranges from 1 to 4317 so the colours are not very "evenly" distributed. is there any way to improve it? (i mean basically everything below 100 is just one red colour)
is there a way to change the date format when you hover over the field from yyy-mm-dd to dd-mm-yyyy?
how could one change the colour of fields with no data? (generally this means weekends)
at the moment the fileds with no data and with most data (over 1000) are of the same colour.
thanks a bunch.
You can change the date format that is displayed by adapting the line
date = d3.time.format("%Y-%m-%d")
More information on the specifiers can be found in the documentation.
For changing the colour, you need to provide a different function for mapping values to colours. It looks like you're currently mapping your input values to only 40 output colours.
.range(d3.range([40]))
Increasing this number might be a good starting point. Note that you can provide an arbitrary function, in particular you could handle missing values separately in it.

Resources