define optional parametr parentID for tooltip element
This commit is contained in:
parent
1ea04ec428
commit
d06d04ebed
14
src/core.js
14
src/core.js
@ -60,7 +60,6 @@ nv.render = function render(step) {
|
||||
};
|
||||
nv.render.queue = [];
|
||||
|
||||
|
||||
nv.addGraph = function(obj) {
|
||||
if (typeof arguments[0] === 'function')
|
||||
obj = {generate: arguments[0], callback: arguments[1]};
|
||||
@ -70,17 +69,13 @@ nv.addGraph = function(obj) {
|
||||
if (!nv.render.active) nv.render();
|
||||
};
|
||||
|
||||
|
||||
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) {
|
||||
return (new Date(year, month+1, 0)).getDate();
|
||||
}
|
||||
};
|
||||
|
||||
function d3_time_range(floor, step, number) {
|
||||
return function(t0, t1, dt) {
|
||||
@ -97,14 +92,12 @@ function d3_time_range(floor, step, number) {
|
||||
}
|
||||
return times;
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
d3.time.monthEnd = function(date) {
|
||||
return new Date(date.getFullYear(), date.getMonth(), 0);
|
||||
};
|
||||
|
||||
|
||||
d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) {
|
||||
date.setUTCDate(date.getUTCDate() + 1);
|
||||
date.setDate(daysInMonth(date.getMonth() + 1, date.getFullYear()));
|
||||
@ -112,4 +105,3 @@ d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) {
|
||||
return date.getMonth();
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -8,7 +8,9 @@
|
||||
|
||||
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");
|
||||
container.className = "nvtooltip";
|
||||
@ -16,7 +18,7 @@
|
||||
gravity = gravity || 's';
|
||||
dist = dist || 20;
|
||||
|
||||
var body = document.getElementsByTagName("body")[0];
|
||||
var body = parentId ? document.getElementById(parentId) : document.getElementsByTagName("body")[0];
|
||||
|
||||
container.innerHTML = content;
|
||||
container.style.left = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user