dc.js Boxplots displaying values - d3.js

Has anyone added the ability to display values in a boxplot for dc.js?
Interesting answer given to this question related to matplotlib.
Adding a scatter of points to a boxplot using matplotlib

As it's currently implemented, the box plot will display any outliers as circles, and outliers are defined as the points which do not fall within the whiskers.
If you're willing to change the source, it's pretty easy to disable the whiskers and show all the data points.
You just need to change line 42:
var _whiskers = _whiskersIqr(_whiskerIqrFactor);
https://github.com/dc-js/dc.js/blob/356fccea3a1dbd49a76fb1841f280ffad87d725f/src/box-plot.js#L42
You could just set it to null, or add an accessor for whiskers. (There really should be one, looks like an oversight.)
It looks like this with no whiskers:
You'd have to dig a bit deeper and change the underlying d3-plugin if you want to display whiskers along with the data points.

Related

Area chart with multicolour gradient

I'd like to build a chart similar to:
Elevation over distance
This chart shows 3 things: elevation (y) distance (x) and colour represents the gradient change. How can I replicate this using D3.js?
You can check sample in the samples and pick something suitable for you depending on your requirement. But I'm suggesting something like this or this . First one does not give you color changing capability with it. You may need to read the documentation and find out. You can use the second one after reducing the width of bar to be very small. You may need to convert this to cater your data input method. I'm strongly suggesting you to go through the samples. As a help I'm posting few more samples you can customize.
Area Gradient fill
Applying a colour gradient to an area fill in d3.js

understanding dc interaction with crossfilter objects

Though I can write dc.js applications, I still don't understand how dc uses crossfilter objects, ie the dimensions and groups in various charts. When we click on an graph element, for instance, a pie chart slice, I believe dc is applying filters on the dimension, but does it manipulate the crossfilter object as well? Anyone knows of any document/article explaining how dc interacts with crossfilter objects? I know of http://www.codeproject.com/Articles/693841/Making-Dashboards-with-Dc-js-Part-Using-Crossfil
which is really good for beginners, but it does not go deep dive on this specific subject.
For instance, I have this dc chart: http://bit.ly/1nStSh3
Basically the dataset has object names (4 of them, P, Q, S, T) and its size for various dates. The two piecharts show the size for dates and objects respectively. There is a line chart which shows the data growth over a period of time. Now, when I click on the second graph, ie object names, both line chart and the first pie chart auto adjusts, but when I click on the first pie chart, the line chart does not change.
Your particular question is covered by the crossfilter documentation and the dc.js FAQ: a dimension does not observe its own filters, but only the filters on other dimensions.
To get the charts to respond to each other, create a duplicate of the dimension (construct another one with the same arguments) and put the charts on separate dimensions. (There is also work underway to reflect the brushing/filter state between charts that share the same dimension.)
As to your larger question, no, there is no documentation on the interaction between dc.js and crossfilter that I know of. As the principle maintainer (but not the original author) of dc.js, I hope to write such documentation in the next year.
There actually isn't much magic to it: charts just update the dimension filters and then trigger redraws on the charts in their group. The d3 transitions within each chart are what make it look fancier than that.

DC.js Crossfilter on "nested" dimensions

I'm quite confused and might need help just formulating the question, so please give good comments...
I'm trying to crossfilter some data where each data point has its own sub-dataset that I want to chart and filter on as well. Each point represents a geographic region, and associated with each point is a time series which measures a certain metric over time.
Here's what I've got so far: http://michaeldougherty.info/dcjs/
The top bar chart shows a particular value for 10 regions, and the choropleth is linked with the same data. Now, below that are two composite line charts. Each line corresponds to a region -- there are 10 lines in each graph, and each graph is measuring a different metric over time. I would like the lines to be filtered as well, so if one bar is selected, only one line will show on the line chart.
Moreover, I want to be able to filter by time on the line charts (through brushing) in addition to some other filter, so I can make queries like "filter out all regions whose line value between 9 AM and 5 PM is less than 20,000", which would also update the bar and choropleth charts.
This is where I'm lost. I'm considering scrapping DC.js for this and using crossfilter and d3.js directly because it seems so complicated, but I would love it if I'm missing something and DC.js can actually handle this. I'd also love some ideas on where to start implementing this in straight crossfilter, because I haven't fully wrapped my head around that yet either.
How does one deal with datasets within datasets?
Screenshot of the link above included for convenience:

improve cartographic visualization

I need some advice about how to improve the visualization of cartographic information.
User can select different species and the webmapping app shows its geographical distribution (polygonal degree cells), each specie with a range of color (e.g darker orange color where we find more info, lighter orange where less info).
The problem is when more than one specie overlaps. What I am currently doing is just to calculate the additive color mix of two colors using http://www.xarg.org/project/jquery-color-plugin-xcolor/
As you can see in the image below, the resulting color where two species overlap (mixed blue and yellow) is not intuitive at all.
Someone has any idea or knows similar tools where to get inspiration? for creating the polygons I use d3.js, so if more complex SVG features have to be created I can give a try.
Some ideas I had are...
1) The more data on a polygon, the thicker the border (or each part of the border with its corresponding color)
2) add a label at the center of polygon saying how many species overlap.
3) Divide polygon in different parts, each one with corresponding species color.
thanks in advance,
Pere
My suggestion is something along the lines of option #3 that you listed, with a twist. Rather painting the entire cell with species colors, place a dot in each cell, one for each species. You can vary the color of each dot in the same way that you currently are: darker for more, ligher for less. This doesn't require you to blend colors, and it will expose more of your map to provide more context to the data. I'd try this approach with the border of the cell and without, and see which one works best.
Your visualization might also benefit from some interactivity. A tooltip providing more detailed information and perhaps a further breakdown of information could be displayed when the user hovers his mouse over each cell.
All of this is very subjective. However one thing's for sure: when you're dealing with multi-dimensional data as you are, the less you project dimensions down onto the same visual/perceptual axis, the better. I've seen some examples of "4-dimensional heatmaps" succeed in doing this (here's an example of visualizing latency on a heatmap, identifying different sources with different colors), but I don't think any attempt's made to combine colors.
My initial thoughts about what you are trying to create (a customized variant of a heat map for a slightly crowded data set, I believe:
One strategy is to employ a formula suggested for
n + 1
with regards to breaks in bin spacing. This causes me some concern regarding how many outliers your set has.
Equally-spaced breaks are ideal for compact data sets without
outliers. In many real data sets, especially proteomics data sets,
outliers can make this representation less effective.
One suggestion I have would be to consider the idea of adding some filters to your categories if you have not yet. This would allow slimming down the rendered data for faster reading by the user.
another solution would be to use something like (Comprehensive) R
or maybe even DanteR
Tutorial in displaying mass spectrometry-based proteomic data using heat maps
(Particularly worth noting I felt, was 'Color mapping'.)

How do I reduce the X axis on a Google Chart?

I'm doing a bar chart with google, and my results look like this (link).
If you see that the graph is not beautiful enough. What is the parameter that can reduce the value on the x axis.
Thank you in advance.
try this one
I just added chds=0,10 to scale it properly. That basically sets the data range to 0 min, 10 max.
I would take a look at this link from google regarding Data Scaling. I am not sure of your data set format so the actual answer to your problem will depend on that.
i.e. - I added "&chds=0,10" after your "chd=" statment and got a better looking chart. Example.
Check out the help file here.
Decide whether your data must be scaled to fit your chart. Different formats support different ranges of values. You might want to scale your data so that it spans the full range of values allowed by your format, to make differences more obvious. You can do this either by scaling your data to fit within the data format that you use, or you can use text formatting with custom scaling.

Resources