Network node highlighting with Crossfilter - d3.js

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.

Related

Displaying rectangle based on presence or lack of values in arbitrary column in SSRS

I have a report with multiple sets of data, but only one dataset. I've accomplished this by setting up multiple different columns in my table that SSRS uses. I set up a rectangle that contains a text box header and a tablix; the tablix is filtered on an identification column in the table so it only shows its own data. What I'd like to do is to only show each rectangle if there is applicable data.
I know that I can solve this problem by adding another row in my tablix and moving the text box title into it, and then showing or hiding the tablix based on whether or not it has data. That's probably the smart move. But before I did that, I wondered if there was a way to assign visibility to the rectangle based on the presence or lack of values in an arbitrary column in SSRS. First doesn't work, because everything other than the first rectangle has NULL in the relevant columns on the first row. Count doesn't work because the rectangle isn't actually hooked to data. What I'm looking for is something like a WHERE clause (=Count() where type = "ab" or something). Like I said, I can go with the tablix route. But the broader scope of this is the ability to control the presence on the report of various items based on the results that have been returned.

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);

Cross-filter and dc acting weirdly

I have five bar charts plotted using dc and cross-filter.
The input to cross-filter changes with a drop-down i.e. whenever the
user selects a metric in the drop-down, the cross-filter input
changes
Also, the metrics selected in the drop-down have different values to be plotted which I am handling using if conditions(check the value of avgIndex in if,else-if and else block)
The graphs come out fine when metrics listed in if and else-if blocks are selected.However, when the remaining metrics (else block) are selected, the charts go haywire
At first(when the metric of else block are selected) the graphs come out correctly, the moment I click on any of the bars(to put the filters on), the charts show irrelevant negative values(though the values of my metrics can't ever go negative, as per the data I have)
Also, for same filters applied, I get different values across different charts at different instance of time, which is really weird.For the same filters applied, how can the data plotted be different at different instance of time?

Change icon of markercluster depending on marker type inside the cluster

I have a map with markers of at this time two different types: photos and blog posts. I would like to use a clustering system, preferably MarkerClusterer.
Is there a way to change the marker icon dynamically, or in other words, depending on what kinds of marker (photos or posts) are inside the cluster? For example, if the cluster only consists of photos, I would like to display some sort of camera icon, if there are only posts inside the cluster, I might want to display a letter. And if all types of markers are inside the cluster, I would like to use some sort of combined icon.
Can I somehow insert this check where I assign the URL of the icon in MarkerStyleOptions?
A bonus would be to also display the amount of markers of each type in the icon, i.e. two numbers.
Does anyone see a way to do this without having to change the source code?
I guess the simplest option is to keep each marker type in a seperate clusters ...
You must create a different array of marker for each group that you created. And try to create a MarkerCluster for each one.

Highlight Data Points in Birt Reports

creating simple charts with BIRT is easy, but now I would like to bring some more life to them...
imagine a simple line chart. Let's define as a requirement, that the maximum value should be highlighted. A further requirement would be that if the user clicks on this data point, something happens.
How can I solve this?
I can imagine that I could created a second value series which consists only of the highlighted data points.
But it would be nicer if there was a JavaScript API (or even a server side java api) with which I could loop through the data points and add a highlight on the fly. Is this possible?
I think I've found a good starting point:
http://www.birt-exchange.org/org/devshare/designing-birt-reports/276-birt-chart-scripting-dynamic-markers-and-datapoint-colors/
Now I have to find a way to add on click events to certain data points...

Resources