define optional parametr parentID for tooltip element

master-patched
Tsyren Ochirov 12 years ago
parent 1ea04ec428
commit d06d04ebed

@ -60,7 +60,6 @@ nv.render = function render(step) {
}; };
nv.render.queue = []; nv.render.queue = [];
nv.addGraph = function(obj) { nv.addGraph = function(obj) {
if (typeof arguments[0] === 'function') if (typeof arguments[0] === 'function')
obj = {generate: arguments[0], callback: arguments[1]}; obj = {generate: arguments[0], callback: arguments[1]};
@ -70,17 +69,13 @@ nv.addGraph = function(obj) {
if (!nv.render.active) nv.render(); if (!nv.render.active) nv.render();
}; };
nv.identity = function(d) { return d }; nv.identity = function(d) { return d };
nv.strip = function(s) { return s.replace(/(\s|&)/g,''); };
nv.strip = function(s) {
return s.replace(/(\s|&)/g,'');
}
function daysInMonth(month,year) { function daysInMonth(month,year) {
return (new Date(year, month+1, 0)).getDate(); return (new Date(year, month+1, 0)).getDate();
} };
function d3_time_range(floor, step, number) { function d3_time_range(floor, step, number) {
return function(t0, t1, dt) { return function(t0, t1, dt) {
@ -97,19 +92,16 @@ function d3_time_range(floor, step, number) {
} }
return times; return times;
}; };
} };
d3.time.monthEnd = function(date) { d3.time.monthEnd = function(date) {
return new Date(date.getFullYear(), date.getMonth(), 0); return new Date(date.getFullYear(), date.getMonth(), 0);
}; };
d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) { d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) {
date.setUTCDate(date.getUTCDate() + 1); date.setUTCDate(date.getUTCDate() + 1);
date.setDate(daysInMonth(date.getMonth() + 1, date.getFullYear())); date.setDate(daysInMonth(date.getMonth() + 1, date.getFullYear()));
}, function(date) { }, function(date) {
return date.getMonth(); return date.getMonth();
} }
); );

@ -8,7 +8,9 @@
var nvtooltip = window.nv.tooltip = {}; var nvtooltip = window.nv.tooltip = {};
nvtooltip.show = function(pos, content, gravity, dist) { nvtooltip.show = function() {
var args = arguments;
var pos = args[0], content = args[1], gravity = args[2], dist = args[3], parentId = args[4];
var container = document.createElement("div"); var container = document.createElement("div");
container.className = "nvtooltip"; container.className = "nvtooltip";
@ -16,7 +18,7 @@
gravity = gravity || 's'; gravity = gravity || 's';
dist = dist || 20; dist = dist || 20;
var body = document.getElementsByTagName("body")[0]; var body = parentId ? document.getElementById(parentId) : document.getElementsByTagName("body")[0];
container.innerHTML = content; container.innerHTML = content;
container.style.left = 1; container.style.left = 1;

Loading…
Cancel
Save