DiaColloDB-WWW
view release on metacpan or search on metacpan
share/htdocs/d3.layout.cloud.js view on Meta::CPAN
i = -1,
n = T.length;
// If no callback was specified, return the callback of the given type and name.
if (arguments.length < 2) {
while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;
return;
}
// If a type was specified, set the callback for the given type and name.
// Otherwise, if a null callback was specified, remove callbacks of the given name.
if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
while (++i < n) {
if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);
else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);
}
return this;
},
copy: function() {
var copy = {}, _ = this._;
share/htdocs/diacollo.js view on Meta::CPAN
//-*- Mode: Javascript; coding: utf-8; -*-
//
// File: diacollo.js
// Author: Bryan Jurish <moocow@cpan.org>
// Description: client-side diacollo callbacks & visualization routines
//
// WARNING
// The following code is hacky, messy, sloppy, ugly, and otherwise generally sub-optimal.
// Patches & improvements welcome.
// Continue at your own risk.
//
//-- user query params
var user_query = {};
var user_format = null; //-- save format request, e.g. for motion-charts
share/htdocs/diacollo.js view on Meta::CPAN
dlscale[i] = d3.scale.linear()
.domain(dltuples.map(function(e,ei) { return ei }))
.range(dltuples.map(function(e) { return e[i] }))
.clamp(true);
}
dcpDateInterp = function(di) {
return dlscale.map(function(s) { return Math.round(s(di)) }).join("-");
};
}
//-- setup callbacks
if (isBubble) {
brushInterp = dcpForceInterp;
brushSnap = dcpForceSnap;
}
if (isCloud) {
brushInterp = dcpCloudInterp;
brushSnap = dcpCloudSnap;
}
//-- initialize current subprofile index (dcur) from URL fragment
share/htdocs/diacollo.js view on Meta::CPAN
//-- mouse events: hover
svg
.on("mouseenter", function(b) { svg.classed("hovering",true); })
.on("mouseleave", function(b) { svg.classed("hovering",false); });
//$("#profileDataD3").show(); //-- debug
return brush;
}
//--------------------------------------------------------------
// d3: brush-slider: callbacks
function brushDebug(value,label) {
if (label==null) label="debug";
var msg = "[" + label + "] value=" + value;
debug_log(msg);
d3.select("#brushVal").text(msg);
}
function dcpOnBrushStart(force) {
//var value = dbrush.extent()[0];
if (force || d3.event.sourceEvent) { // not a programmatic event
share/htdocs/diacollo.js view on Meta::CPAN
}
d3SpeedBrushMove(value);
}
function d3OnSpeedBrushEnd() {
//d3SpeedBrushDebug("d3OnSpeedBrushEnd()");
speedNode.classed("brushing",false);
}
//----------------------------------------------------------------------
// d3: play/pause transport: callbacks
function dcpPlay(playing,force) {
if (playing==null) playing = dcpPlaying;
if (force==null) force=false;
//exportMenuHide(0);
//-- setup buttons
var btn = d3.selectAll(".btn");
btn.selectAll(".play").style("opacity",Number(!playing));
btn.selectAll(".pause,.stop").style("opacity",Number(playing));
share/htdocs/diacollo.js view on Meta::CPAN
}
//-- color brewer colors; see http://colorbrewer2.org/
//-- diff (divergent)
redgb4 = ["rgb(215,25,28)", "rgb(253,174,97)", "rgb(171,221,164)", "rgb(43,131,186)"]
redgb8 = ["rgb(213,62,79)", "rgb(244,109,67)", "rgb(253,174,97)", "rgb(254,224,139)", "rgb(230,245,152)", "rgb(171,221,164)", "rgb(102,194,165)", "rgb(50,136,189)"]
//-- sequential
red4 = ['rgb(254,240,217)','rgb(253,204,138)','rgb(252,141,89)','rgb(215,48,31)']
*/
//--------------------------------------------------------------
// d3: cloud: callbacks
function dcpCloudEnd(placedWords,bounds) {
var svg = d3.select(d3BodySelector);
svg
.append("g")
.attr("transform", "translate(" + dcloud.size()[0]/2 + "," + dcloud.size()[1]/2 + ")");
//-- warn about placement errors and maybe recompute
var nbad = items.length - placedWords.length;
if (nbad > 0) {
var cls = "warning";
( run in 0.860 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )