|
|
@ -1,6 +1,6 @@ |
|
|
|
// Generated by CoffeeScript 1.2.1-pre
|
|
|
|
// Generated by CoffeeScript 1.2.1-pre
|
|
|
|
(function() { |
|
|
|
(function() { |
|
|
|
var activate, active, add_class, deactivate, hover, reactive, rm_class, _, |
|
|
|
var activate, active, add_class, deactivate, hover, padding, reactive, rm_class, svg, tooltip, tooltip_font_size, tooltip_timeout, untooltip, _, __, |
|
|
|
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, |
|
|
|
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, |
|
|
|
__slice = [].slice; |
|
|
|
__slice = [].slice; |
|
|
|
|
|
|
|
|
|
|
@ -8,6 +8,16 @@ |
|
|
|
return document.querySelectorAll(x); |
|
|
|
return document.querySelectorAll(x); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__ = function(x) { |
|
|
|
|
|
|
|
return document.getElementById(x); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
padding = 5; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tooltip_timeout = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tooltip_font_size = parseInt("{{ font_sizes.tooltip }}"); |
|
|
|
|
|
|
|
|
|
|
|
add_class = function(e, class_name) { |
|
|
|
add_class = function(e, class_name) { |
|
|
|
var cn; |
|
|
|
var cn; |
|
|
|
if (!e) return; |
|
|
|
if (!e) return; |
|
|
@ -27,6 +37,10 @@ |
|
|
|
return e.setAttribute('class', cn.join(' ')); |
|
|
|
return e.setAttribute('class', cn.join(' ')); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
svg = function(tag) { |
|
|
|
|
|
|
|
return document.createElementNS('http://www.w3.org/2000/svg', tag); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
activate = function() { |
|
|
|
activate = function() { |
|
|
|
var element, elements, _i, _len, _results; |
|
|
|
var element, elements, _i, _len, _results; |
|
|
|
elements = 1 <= arguments.length ? __slice.call(arguments, 0) : []; |
|
|
|
elements = 1 <= arguments.length ? __slice.call(arguments, 0) : []; |
|
|
@ -76,7 +90,39 @@ |
|
|
|
return _results; |
|
|
|
return _results; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tooltip = function(elt) { |
|
|
|
|
|
|
|
var h, w, x, y, _rect, _text, _tooltip; |
|
|
|
|
|
|
|
clearTimeout(tooltip_timeout); |
|
|
|
|
|
|
|
_tooltip = __('tooltip'); |
|
|
|
|
|
|
|
_text = _tooltip.getElementsByTagName('text')[0]; |
|
|
|
|
|
|
|
_rect = _tooltip.getElementsByTagName('rect')[0]; |
|
|
|
|
|
|
|
_text.textContent = elt.nextElementSibling.textContent; |
|
|
|
|
|
|
|
w = _text.offsetWidth + 2 * padding; |
|
|
|
|
|
|
|
h = _text.offsetHeight + 2 * padding; |
|
|
|
|
|
|
|
_rect.setAttribute('width', w); |
|
|
|
|
|
|
|
_rect.setAttribute('height', h); |
|
|
|
|
|
|
|
_text.setAttribute('x', padding); |
|
|
|
|
|
|
|
_text.setAttribute('y', padding + tooltip_font_size); |
|
|
|
|
|
|
|
x = elt.getAttribute('cx') || elt.getAttribute('x'); |
|
|
|
|
|
|
|
y = elt.getAttribute('cy') || elt.getAttribute('y'); |
|
|
|
|
|
|
|
if (x - w > 0) x -= w; |
|
|
|
|
|
|
|
if (y - h > 0) y -= h; |
|
|
|
|
|
|
|
return _tooltip.setAttribute('transform', "translate(" + x + " " + y + ")"); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
untooltip = function() { |
|
|
|
|
|
|
|
return tooltip_timeout = setTimeout((function() { |
|
|
|
|
|
|
|
return __('tooltip').setAttribute('transform', 'translate(-100000, -100000)'); |
|
|
|
|
|
|
|
}), 1000); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.svg_load = function() { |
|
|
|
this.svg_load = function() { |
|
|
|
|
|
|
|
var text, _i, _len, _ref; |
|
|
|
|
|
|
|
_ref = _('.text-overlay .series'); |
|
|
|
|
|
|
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
|
|
|
|
|
|
|
text = _ref[_i]; |
|
|
|
|
|
|
|
text.setAttribute('display', 'none'); |
|
|
|
|
|
|
|
} |
|
|
|
hover(_('.reactive-text'), (function() { |
|
|
|
hover(_('.reactive-text'), (function() { |
|
|
|
return activate(this, active(this)); |
|
|
|
return activate(this, active(this)); |
|
|
|
}), (function() { |
|
|
|
}), (function() { |
|
|
@ -87,27 +133,34 @@ |
|
|
|
}), (function() { |
|
|
|
}), (function() { |
|
|
|
return deactivate(this, reactive(this)); |
|
|
|
return deactivate(this, reactive(this)); |
|
|
|
})); |
|
|
|
})); |
|
|
|
return hover(_('.activate-serie'), (function() { |
|
|
|
hover(_('.activate-serie'), (function() { |
|
|
|
var element, num, _i, _len, _ref, _results; |
|
|
|
var element, num, _j, _len2, _ref2, _results; |
|
|
|
num = this.id.replace('activate-serie-', ''); |
|
|
|
num = this.id.replace('activate-serie-', ''); |
|
|
|
_ref = _('.serie-' + num + ' .reactive'); |
|
|
|
_('.text-overlay .serie-' + num)[0].setAttribute('display', 'inline'); |
|
|
|
|
|
|
|
_ref2 = _('.serie-' + num + ' .reactive'); |
|
|
|
_results = []; |
|
|
|
_results = []; |
|
|
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
|
|
|
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { |
|
|
|
element = _ref[_i]; |
|
|
|
element = _ref2[_j]; |
|
|
|
_results.push(activate(element, reactive(element))); |
|
|
|
_results.push(activate(element, reactive(element))); |
|
|
|
} |
|
|
|
} |
|
|
|
return _results; |
|
|
|
return _results; |
|
|
|
}), (function() { |
|
|
|
}), (function() { |
|
|
|
var element, num, _i, _len, _ref, _results; |
|
|
|
var element, num, _j, _len2, _ref2, _results; |
|
|
|
num = this.id.replace('activate-serie-', ''); |
|
|
|
num = this.id.replace('activate-serie-', ''); |
|
|
|
_ref = _('.serie-' + num + ' .reactive'); |
|
|
|
_('.text-overlay .serie-' + num)[0].setAttribute('display', 'none'); |
|
|
|
|
|
|
|
_ref2 = _('.serie-' + num + ' .reactive'); |
|
|
|
_results = []; |
|
|
|
_results = []; |
|
|
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
|
|
|
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { |
|
|
|
element = _ref[_i]; |
|
|
|
element = _ref2[_j]; |
|
|
|
_results.push(deactivate(element, reactive(element))); |
|
|
|
_results.push(deactivate(element, reactive(element))); |
|
|
|
} |
|
|
|
} |
|
|
|
return _results; |
|
|
|
return _results; |
|
|
|
})); |
|
|
|
})); |
|
|
|
|
|
|
|
return hover(_('.tooltip-trigger'), (function() { |
|
|
|
|
|
|
|
return tooltip(this); |
|
|
|
|
|
|
|
}), (function() { |
|
|
|
|
|
|
|
return untooltip(); |
|
|
|
|
|
|
|
})); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
}).call(this); |
|
|
|
}).call(this); |
|
|
|