syntagmatic / parallel-coordinates

A d3-based parallel coordinates plot in canvas. This library is no longer actively developed.
http://syntagmatic.github.com/parallel-coordinates/
Other
510 stars 211 forks source link

Total for some data enhancement #15

Closed LeJav closed 11 years ago

LeJav commented 11 years ago

I have also added another improvement in my test case: add total for highlighted/filtered values for some axis. The code is something like: // define axis for which we want total var col_total = { "Total Cores":true, "Rmax":true, "Power": true } ; ... axis.append("svg:text") .attr("class", "title") .attr("text-anchor", "middle") .attr("y", -15) .text(String) ; axis.append("svg:text") .attr("class", "title total") .attr("text-anchor", "middle") .attr("y", -5) .each(function(p) { if (!col_total[p]) { d3.select(this).style("visibility", "hidden") ; } else { d3.select(this).text (d3.sum (commande.map(function (d,i) {return +commande[i][p]})).toFixed(0)) ; }}); ... totaux_labels = svg.selectAll(".total") ; ... for instance, in brush: foreground.classed("active", function(d) { ... } update_totaux ("active") ; ...

function update_totaux (classe) { // compute total for foreground elements with class "classe" set var totaux = {} ; d3.keys(col_total).forEach (function (p) {totaux[p]= +0; }) ; foreground.each (function (p) { if (d3.select(this).classed(classe)) { d3.keys(col_total).forEach (function (d) {totaux[d]+= +p[d]; }) ; }} ) ; totaux_labels.text (function (p) {if (totaux[p]) {return totaux[p].toFixed(0) ;} else return "";}) ; }

You can see my test case at: http://nitisco.fr/top500/ I am not happy with that, because of bad performance. This is why I limited to 30 values only... With parcoord.js, performances will be much better. I will loose mouseover effect but this is not interesting with a lot of values. And with your slickgrid example, we can highlight a value from the table, which is interesting.

syntagmatic commented 11 years ago

This is a neat feature, but I don't think it makes sense to include in the core library for now.

That's one of the most full-featured demos I've seen. It looks like you've improved the performance substantially for the totals. I've added it to a new "In The Wild" section in the project page.