- Latest version of D3.
This commit is contained in:
Matt Gilman 2014-12-10 11:26:27 -05:00
parent 4c959f7298
commit 8a0e2cee4a
3 changed files with 42 additions and 5462 deletions

View File

@ -1,26 +1,26 @@
Copyright (c) 2013, Michael Bostock Copyright (c) 2010-2014, Michael Bostock
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* The name Michael Bostock may not be used to endorse or promote products * The name Michael Bostock may not be used to endorse or promote products
derived from this software without specific prior written permission. derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File diff suppressed because one or more lines are too long

View File

@ -59,13 +59,6 @@ nf.StatusHistory = (function () {
} }
}; };
/**
* version 3.4+ of D3 provides a mechanism for specifying
* a number of custom formatters. this achieves similar function
* until we're able to upgrade.
*/
var timeFormats = null;
/** /**
* The time offset of the server. * The time offset of the server.
*/ */
@ -373,26 +366,21 @@ nf.StatusHistory = (function () {
visible: instances[instance.id] === true visible: instances[instance.id] === true
}); });
}); });
// -------------------------- // --------------------------
// custom time axis formatter // custom time axis formatter
// -------------------------- // --------------------------
// create the formatting function var customTimeFormat = d3.time.format.multi([
var customTimeFormat = function (d) { [':%S.%L', function (d) { return d.getMilliseconds(); }],
var formatter; [':%S', function (d) { return d.getSeconds(); }],
['%H:%M', function (d) { return d.getMinutes(); }],
// identify the most appropriate formatter for this date ['%H:%M', function (d) { return d.getHours(); }],
$.each(timeFormats, function (_, timeFormat) { ['%a %d', function (d) { return d.getDay() && d.getDate() !== 1; }],
if (timeFormat[1](d)) { ['%b %d', function (d) { return d.getDate() !== 1; }],
formatter = timeFormat; ['%B', function (d) { return d.getMonth(); }],
return false; ['%Y', function () { return true; }]
} ]);
});
// return the formatter date
return formatter[0](d);
};
// ---------- // ----------
// main chart // main chart
@ -1136,34 +1124,6 @@ nf.StatusHistory = (function () {
init: function (timeOffset) { init: function (timeOffset) {
serverTimeOffset = timeOffset; serverTimeOffset = timeOffset;
// initialize the time formats
timeFormats = [
[d3.time.format(':%S.%L'), function (d) {
return d.getMilliseconds();
}],
[d3.time.format(':%S'), function (d) {
return d.getSeconds();
}],
[d3.time.format('%H:%M'), function (d) {
return d.getMinutes();
}],
[d3.time.format('%H:%M'), function (d) {
return d.getHours();
}],
[d3.time.format('%a %d'), function (d) {
return d.getDay() && d.getDate() !== 1;
}],
[d3.time.format('%b %d'), function (d) {
return d.getDate() !== 1;
}],
[d3.time.format('%B'), function (d) {
return d.getMonth();
}],
[d3.time.format('%Y'), function () {
return true;
}]
];
nf.Common.addHoverEffect('#status-history-refresh-button', 'button-refresh', 'button-refresh-hover').click(function () { nf.Common.addHoverEffect('#status-history-refresh-button', 'button-refresh', 'button-refresh-hover').click(function () {
var statusHistory = $('#status-history-dialog').data('status-history'); var statusHistory = $('#status-history-dialog').data('status-history');
if (statusHistory !== null) { if (statusHistory !== null) {