flot
Advanced tools
Comparing version 4.1.1 to 4.2.0
{ | ||
"name": "flot", | ||
"version": "4.1.1", | ||
"version": "4.2.0", | ||
"main": "dist/es5/jquery.flot.js", | ||
@@ -24,12 +24,15 @@ "scripts": { | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.4.0", | ||
"@babel/core": "^7.8.3", | ||
"@babel/plugin-external-helpers": "^7.2.0", | ||
"@babel/preset-env": "^7.2.3", | ||
"concat": "^1.0.3", | ||
"eslint-config-standard": "^7.0.1", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-standard": "^2.1.1", | ||
"files-exist": "^1.1.0", | ||
"gulp": "^4.0.0", | ||
"gulp": "^4.0.2", | ||
"gulp-babel": "^8.0.0", | ||
"gulp-concat": "^2.6.1", | ||
"gulp-sourcemaps": "^2.4.0", | ||
"gulp-uglify": "^3.0.0", | ||
"gulp-sourcemaps": "^2.6.5", | ||
"gulp-uglify": "^3.0.2", | ||
"jasmine-core": "~2.7.0", | ||
@@ -42,3 +45,3 @@ "karma": "^1.3.0", | ||
"karma-eslint": "^2.2.0", | ||
"karma-firefox-launcher": "^1.0.0", | ||
"karma-firefox-launcher": "^1.3.0", | ||
"karma-jasmine": "^1.0.2", | ||
@@ -50,6 +53,5 @@ "karma-jasmine-html-reporter": "^0.2.2", | ||
"ljs": "^0.3.2", | ||
"tmp": "0.0.33", | ||
"webcharts-development-settings": "^1.0.9" | ||
"tmp": "0.0.33" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -389,3 +389,2 @@ /** ## jquery.flot.canvaswrapper | ||
// Determine whether this text already exists at this position. | ||
@@ -451,3 +450,3 @@ // If so, mark it for inclusion in the next render pass. | ||
updateTransforms(position.element, transforms); | ||
}; | ||
}; | ||
@@ -454,0 +453,0 @@ var addTspanElements = function(text, element, x) { |
@@ -45,3 +45,3 @@ /** | ||
if(steps){ | ||
if (steps) { | ||
if (mx !== null && my !== null) { | ||
@@ -206,3 +206,3 @@ // if middle point exists, transfer p2 -> p1 and p1 -> mp | ||
if(steps){ | ||
if (steps) { | ||
if (mx !== null && my !== null) { | ||
@@ -487,4 +487,3 @@ // if middle point exists, transfer p2 -> p1 and p1 -> mp | ||
} | ||
} | ||
else { | ||
} else { | ||
drawLeft = drawRight = drawTop = true; | ||
@@ -491,0 +490,0 @@ drawBottom = false; |
@@ -35,3 +35,3 @@ /* Flot plugin for computing bottoms for filled line and bar charts. | ||
series: { | ||
fillBetween: null // or number | ||
fillBetween: null // or number | ||
} | ||
@@ -64,7 +64,7 @@ }; | ||
} | ||
format = datapoints.format; | ||
var format = datapoints.format; | ||
var plotHasId = function(id) { | ||
var plotData = plot.getData(); | ||
for (i = 0; i < plotData.length; i++) { | ||
for (var i = 0; i < plotData.length; i++) { | ||
if (plotData[i].id === id) { | ||
@@ -81,13 +81,13 @@ return true; | ||
format.push({ | ||
x: true, | ||
number: true, | ||
format.push({ | ||
x: true, | ||
number: true, | ||
computeRange: s.xaxis.options.autoScale !== 'none', | ||
required: true | ||
required: true | ||
}); | ||
format.push({ | ||
y: true, | ||
number: true, | ||
format.push({ | ||
y: true, | ||
number: true, | ||
computeRange: s.yaxis.options.autoScale !== 'none', | ||
required: true | ||
required: true | ||
}); | ||
@@ -94,0 +94,0 @@ |
@@ -82,3 +82,2 @@ /* global jQuery */ | ||
function generatePlothoverEvent(e) { | ||
@@ -102,6 +101,6 @@ var o = plot.getOptions(), | ||
var series = plot.getData(); | ||
if (event !== undefined | ||
&& series.length > 0 | ||
&& series[0].xaxis.c2p !== undefined | ||
&& series[0].yaxis.c2p !== undefined) { | ||
if (event !== undefined && | ||
series.length > 0 && | ||
series[0].xaxis.c2p !== undefined && | ||
series[0].yaxis.c2p !== undefined) { | ||
var eventToTrigger = "plot" + eventType; | ||
@@ -160,4 +159,4 @@ var seriesFlag = eventType + "able"; | ||
for (var i = 1; i < items.length; ++i) { | ||
if (item.distance === undefined || | ||
for (let i = 1; i < items.length; ++i) { | ||
if (item.distance === undefined || | ||
items[i].distance < item.distance) { | ||
@@ -178,3 +177,3 @@ item = items[i]; | ||
// clear auto-highlights | ||
for (var i = 0; i < highlights.length; ++i) { | ||
for (let i = 0; i < highlights.length; ++i) { | ||
var h = highlights[i]; | ||
@@ -181,0 +180,0 @@ if ((h.auto === eventname && |
@@ -55,3 +55,3 @@ /* Flot plugin for drawing legends. | ||
for (i = 0; i < entries.length; ++i) { | ||
var columnIndex = i % options.legend.noColumns; | ||
let columnIndex = i % options.legend.noColumns; | ||
entry = entries[i]; | ||
@@ -82,3 +82,3 @@ shape.label = entry.label; | ||
for (i = 0; i < entries.length; ++i) { | ||
var columnIndex = i % options.legend.noColumns; | ||
let columnIndex = i % options.legend.noColumns; | ||
entry = entries[i]; | ||
@@ -85,0 +85,0 @@ iconHtml = ''; |
@@ -252,5 +252,5 @@ /* Pretty handling of log axes. | ||
}), | ||
min = axis.direction === 'x' | ||
? Math.min(0.1, range && range[0] ? range[0].xmin : 0.1) | ||
: Math.min(0.1, range && range[0] ? range[0].ymin : 0.1); | ||
min = axis.direction === 'x' | ||
? Math.min(0.1, range && range[0] ? range[0].xmin : 0.1) | ||
: Math.min(0.1, range && range[0] ? range[0].ymin : 0.1); | ||
@@ -257,0 +257,0 @@ axis.min = min; |
@@ -41,3 +41,5 @@ /* Flot plugin for adding the ability to pan and zoom the plot. | ||
axisPan: true, //pan axis when mouse over it is allowed | ||
plotPan: true //pan axis is allowed for plot pan | ||
plotPan: true, //pan axis is allowed for plot pan | ||
panRange: [undefined, undefined], // no limit on pan range, or [min, max] in axis units | ||
zoomRange: [undefined, undefined], // no limit on zoom range, or [closest zoom, furthest zoom] in axis units | ||
} | ||
@@ -50,2 +52,4 @@ | ||
plotPan: true //pan axis is allowed for plot pan | ||
panRange: [undefined, undefined], // no limit on pan range, or [min, max] in axis units | ||
zoomRange: [undefined, undefined], // no limit on zoom range, or [closest zoom, furthest zoom] in axis units | ||
} | ||
@@ -129,3 +133,5 @@ ``` | ||
axisPan: true, //pan axis when mouse over it is allowed | ||
plotPan: true //pan axis is allowed for plot pan | ||
plotPan: true, //pan axis is allowed for plot pan | ||
panRange: [undefined, undefined], // no limit on pan range, or [min, max] in axis units | ||
zoomRange: [undefined, undefined] // no limit on zoom range, or [closest zoom, furthest zoom] in axis units | ||
}, | ||
@@ -136,3 +142,5 @@ yaxis: { | ||
axisPan: true, | ||
plotPan: true | ||
plotPan: true, | ||
panRange: [undefined, undefined], // no limit on pan range, or [min, max] in axis units | ||
zoomRange: [undefined, undefined] // no limit on zoom range, or [closest zoom, furthest zoom] in axis units | ||
} | ||
@@ -289,6 +297,6 @@ }; | ||
} | ||
function onDrag(e) { | ||
if (!isPanAction) { | ||
return; | ||
if (!isPanAction) { | ||
return; | ||
} | ||
@@ -340,4 +348,4 @@ | ||
function onDragEnd(e) { | ||
if (!isPanAction) { | ||
return; | ||
if (!isPanAction) { | ||
return; | ||
} | ||
@@ -499,2 +507,14 @@ | ||
// test for zoom limits zoomRange: [min,max] | ||
if (opts.zoomRange) { | ||
// zoomed in too far | ||
if (max - min < opts.zoomRange[0]) { | ||
continue; | ||
} | ||
// zoomed out to far | ||
if (max - min > opts.zoomRange[1]) { | ||
continue; | ||
} | ||
} | ||
var offsetBelow = $.plot.saturated.saturate(navigationOffset.below - (axis.min - min)); | ||
@@ -531,2 +551,10 @@ var offsetAbove = $.plot.saturated.saturate(navigationOffset.above - (axis.max - max)); | ||
// calc min delta (revealing left edge of plot) | ||
var minD = axis.p2c(opts.panRange[0]) - axis.p2c(axis.min); | ||
// calc max delta (revealing right edge of plot) | ||
var maxD = axis.p2c(opts.panRange[1]) - axis.p2c(axis.max); | ||
// limit delta to min or max if enabled | ||
if (opts.panRange[0] !== undefined && d >= maxD) d = maxD; | ||
if (opts.panRange[1] !== undefined && d <= minD) d = minD; | ||
if (d !== 0) { | ||
@@ -686,2 +714,10 @@ var navigationOffsetBelow = saturated.saturate(axis.c2p(axis.p2c(axis.min) + d) - axis.c2p(axis.p2c(axis.min))), | ||
// calc min delta (revealing left edge of plot) | ||
var minD = p + axis.p2c(opts.panRange[0]) - axis.p2c(axisMin); | ||
// calc max delta (revealing right edge of plot) | ||
var maxD = p + axis.p2c(opts.panRange[1]) - axis.p2c(axisMax); | ||
// limit delta to min or max if enabled | ||
if (opts.panRange[0] !== undefined && d >= maxD) d = maxD; | ||
if (opts.panRange[1] !== undefined && d <= minD) d = minD; | ||
if (d !== 0) { | ||
@@ -688,0 +724,0 @@ var navigationOffsetBelow = saturated.saturate(axis.c2p(axis.p2c(axisMin) - (p - d)) - axis.c2p(axis.p2c(axisMin))), |
@@ -23,3 +23,3 @@ /* eslint-disable */ | ||
*/ | ||
(function($,e,t){"$:nomunge";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s="setTimeout",u="resize",m=u+"-special-event",o="pendingDelay",l="activeDelay",f="throttleWindow";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(":visible")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,this); | ||
(function($,e,t){"$:nomunge";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s="setTimeout",u="resize",m=u+"-special-event",o="pendingDelay",l="activeDelay",f="throttleWindow";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(":visible")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,window); | ||
@@ -26,0 +26,0 @@ /* eslint-enable */ |
@@ -13,2 +13,3 @@ /* Flot plugin for selecting regions of a plot. | ||
visualization: "fill" or "focus", | ||
displaySelectionDecorations: true or false, | ||
minSize: number of pixels | ||
@@ -30,2 +31,6 @@ } | ||
There are optional selection decorations (handles) that are rendered with the | ||
"focus" visualization option. The selection decoration is rendered by default | ||
but can be turned off by setting displaySelectionDecorations to false. | ||
"minSize" is the minimum size a selection can be in pixels. This value can | ||
@@ -455,2 +460,3 @@ be customized to determine the smallest size a selection can be and still | ||
var visualization = o.selection.visualization; | ||
var displaySelectionDecorations = o.selection.displaySelectionDecorations; | ||
@@ -492,3 +498,6 @@ var scalingFactor = 1; | ||
ctx.clearRect(x, y, w, h); | ||
drawSelectionDecorations(ctx, x, y, w, h, oX, oY, selectionDirection(plot)); | ||
if (displaySelectionDecorations) { | ||
drawSelectionDecorations(ctx, x, y, w, h, oX, oY, selectionDirection(plot)); | ||
} | ||
} | ||
@@ -513,2 +522,3 @@ | ||
visualization: "focus", // "focus" or "fill" | ||
displaySelectionDecorations: true, // true or false (currently only relevant for the focus visualization) | ||
color: "#888888", | ||
@@ -515,0 +525,0 @@ shape: "round", // one of "round", "miter", or "bevel" |
@@ -81,3 +81,3 @@ /* Flot plugin for stacking data sets rather than overlaying them. | ||
var needsBottom = s.bars.show || (s.lines.show && s.lines.fill); | ||
var hasBottom = datapoints.pointsize > 2 && (horizontal ? datapoints.format[2].x : datapoints.format[2].y); | ||
var hasBottom = datapoints.pointsize > 2 && (s.bars.horizontal ? datapoints.format[2].x : datapoints.format[2].y); | ||
// Series data is missing bottom points - need to format | ||
@@ -84,0 +84,0 @@ if (needsBottom && !hasBottom) { |
@@ -29,4 +29,4 @@ /* Pretty handling of time axes. | ||
// Method to provide microsecond support to Date like classes. | ||
var CreateMicroSecondDate = function(dateType, microEpoch) { | ||
var newDate = new dateType(microEpoch); | ||
var CreateMicroSecondDate = function(DateType, microEpoch) { | ||
var newDate = new DateType(microEpoch); | ||
@@ -38,3 +38,3 @@ var oldSetTime = newDate.setTime.bind(newDate); | ||
// Round epoch to 3 decimal accuracy | ||
microEpoch = Math.round(microEpoch*1000)/1000; | ||
microEpoch = Math.round(microEpoch * 1000) / 1000; | ||
@@ -61,3 +61,3 @@ // Microseconds are stored as integers | ||
var epochWithoutMicroseconds = oldGetTime(); | ||
var newEpoch = epochWithoutMicroseconds + microseconds/1000; | ||
var newEpoch = epochWithoutMicroseconds + microseconds / 1000; | ||
this.update(newEpoch); | ||
@@ -85,20 +85,20 @@ }; | ||
var leftPad = function(n, pad) { | ||
n = "" + n; | ||
pad = "" + (pad == null ? "0" : pad); | ||
return n.length == 1 ? pad + n : n; | ||
}; | ||
n = "" + n; | ||
pad = "" + (pad == null ? "0" : pad); | ||
return n.length === 1 ? pad + n : n; | ||
}; | ||
var formatSubSeconds = function(milliseconds, microseconds, numberDecimalPlaces) { | ||
var formatSubSeconds = function(milliseconds, microseconds, numberDecimalPlaces) { | ||
var totalMicroseconds = milliseconds * 1000 + microseconds; | ||
var formattedString; | ||
if (numberDecimalPlaces < 6 && numberDecimalPlaces > 0) { | ||
var magnitude = parseFloat('1e' + (numberDecimalPlaces - 6)); | ||
totalMicroseconds = Math.round(Math.round(totalMicroseconds * magnitude) / magnitude); | ||
formattedString = ('00000' + totalMicroseconds).slice(-6,-(6 - numberDecimalPlaces)); | ||
} else { | ||
if (numberDecimalPlaces < 6 && numberDecimalPlaces > 0) { | ||
var magnitude = parseFloat('1e' + (numberDecimalPlaces - 6)); | ||
totalMicroseconds = Math.round(Math.round(totalMicroseconds * magnitude) / magnitude); | ||
formattedString = ('00000' + totalMicroseconds).slice(-6, -(6 - numberDecimalPlaces)); | ||
} else { | ||
totalMicroseconds = Math.round(totalMicroseconds) | ||
formattedString = ('00000' + totalMicroseconds).slice(-6); | ||
} | ||
return formattedString; | ||
}; | ||
formattedString = ('00000' + totalMicroseconds).slice(-6); | ||
} | ||
return formattedString; | ||
}; | ||
@@ -108,3 +108,3 @@ var r = []; | ||
var hours = d.getHours(); | ||
var isAM = hours < 12; | ||
var isAM = hours < 12; | ||
@@ -120,13 +120,13 @@ if (!monthNames) { | ||
var hours12; | ||
if (hours > 12) { | ||
hours12 = hours - 12; | ||
} else if (hours == 0) { | ||
hours12 = 12; | ||
} else { | ||
hours12 = hours; | ||
} | ||
if (hours > 12) { | ||
hours12 = hours - 12; | ||
} else if (hours === 0) { | ||
hours12 = 12; | ||
} else { | ||
hours12 = hours; | ||
} | ||
var decimals = -1; | ||
for (var i = 0; i < fmt.length; ++i) { | ||
var c = fmt.charAt(i); | ||
var c = fmt.charAt(i); | ||
@@ -136,36 +136,36 @@ if (!isNaN(Number(c)) && Number(c) > 0) { | ||
} else if (escape) { | ||
switch (c) { | ||
case 'a': c = "" + dayNames[d.getDay()]; break; | ||
case 'b': c = "" + monthNames[d.getMonth()]; break; | ||
case 'd': c = leftPad(d.getDate()); break; | ||
case 'e': c = leftPad(d.getDate(), " "); break; | ||
case 'h': // For back-compat with 0.7; remove in 1.0 | ||
case 'H': c = leftPad(hours); break; | ||
case 'I': c = leftPad(hours12); break; | ||
case 'l': c = leftPad(hours12, " "); break; | ||
case 'm': c = leftPad(d.getMonth() + 1); break; | ||
case 'M': c = leftPad(d.getMinutes()); break; | ||
// quarters not in Open Group's strftime specification | ||
case 'q': | ||
c = "" + (Math.floor(d.getMonth() / 3) + 1); break; | ||
case 'S': c = leftPad(d.getSeconds()); break; | ||
case 's': c = "" + formatSubSeconds(d.getMilliseconds(), d.getMicroseconds(), decimals); break; | ||
case 'y': c = leftPad(d.getFullYear() % 100); break; | ||
case 'Y': c = "" + d.getFullYear(); break; | ||
case 'p': c = (isAM) ? ("" + "am") : ("" + "pm"); break; | ||
case 'P': c = (isAM) ? ("" + "AM") : ("" + "PM"); break; | ||
case 'w': c = "" + d.getDay(); break; | ||
} | ||
r.push(c); | ||
escape = false; | ||
} else { | ||
if (c == "%") { | ||
escape = true; | ||
} else { | ||
r.push(c); | ||
} | ||
} | ||
} | ||
switch (c) { | ||
case 'a': c = "" + dayNames[d.getDay()]; break; | ||
case 'b': c = "" + monthNames[d.getMonth()]; break; | ||
case 'd': c = leftPad(d.getDate()); break; | ||
case 'e': c = leftPad(d.getDate(), " "); break; | ||
case 'h': // For back-compat with 0.7; remove in 1.0 | ||
case 'H': c = leftPad(hours); break; | ||
case 'I': c = leftPad(hours12); break; | ||
case 'l': c = leftPad(hours12, " "); break; | ||
case 'm': c = leftPad(d.getMonth() + 1); break; | ||
case 'M': c = leftPad(d.getMinutes()); break; | ||
// quarters not in Open Group's strftime specification | ||
case 'q': | ||
c = "" + (Math.floor(d.getMonth() / 3) + 1); break; | ||
case 'S': c = leftPad(d.getSeconds()); break; | ||
case 's': c = "" + formatSubSeconds(d.getMilliseconds(), d.getMicroseconds(), decimals); break; | ||
case 'y': c = leftPad(d.getFullYear() % 100); break; | ||
case 'Y': c = "" + d.getFullYear(); break; | ||
case 'p': c = (isAM) ? ("" + "am") : ("" + "pm"); break; | ||
case 'P': c = (isAM) ? ("" + "AM") : ("" + "PM"); break; | ||
case 'w': c = "" + d.getDay(); break; | ||
} | ||
r.push(c); | ||
escape = false; | ||
} else { | ||
if (c === "%") { | ||
escape = true; | ||
} else { | ||
r.push(c); | ||
} | ||
} | ||
} | ||
return r.join(""); | ||
return r.join(""); | ||
} | ||
@@ -306,3 +306,2 @@ | ||
function dateTickGenerator(axis) { | ||
@@ -410,3 +409,3 @@ var opts = axis.options, | ||
} else { | ||
d.setMicroseconds(d.getMilliseconds()*1000); | ||
d.setMicroseconds(d.getMilliseconds() * 1000); | ||
} | ||
@@ -494,2 +493,5 @@ } | ||
// if a tick formatter is already provided do not overwrite it | ||
if ('tickFormatter' in opts && typeof opts.tickFormatter === 'function') return; | ||
axis.tickFormatter = function (v, axis) { | ||
@@ -499,12 +501,12 @@ var d = dateGenerator(v, axis.options); | ||
// first check global format | ||
if (opts.timeformat != null) { | ||
return formatDate(d, opts.timeformat, opts.monthNames, opts.dayNames); | ||
} | ||
if (opts.timeformat != null) { | ||
return formatDate(d, opts.timeformat, opts.monthNames, opts.dayNames); | ||
} | ||
// possibly use quarters if quarters are mentioned in | ||
// any of these places | ||
var useQuarters = (axis.options.tickSize && | ||
axis.options.tickSize[1] == "quarter") || | ||
(axis.options.minTickSize && | ||
axis.options.minTickSize[1] == "quarter"); | ||
// possibly use quarters if quarters are mentioned in | ||
// any of these places | ||
var useQuarters = (axis.options.tickSize && | ||
axis.options.tickSize[1] === "quarter") || | ||
(axis.options.minTickSize && | ||
axis.options.minTickSize[1] === "quarter"); | ||
@@ -520,8 +522,8 @@ var timeUnitSize; | ||
var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]]; | ||
var span = axis.max - axis.min; | ||
var suffix = (opts.twelveHourClock) ? " %p" : ""; | ||
var hourCode = (opts.twelveHourClock) ? "%I" : "%H"; | ||
var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]]; | ||
var span = axis.max - axis.min; | ||
var suffix = (opts.twelveHourClock) ? " %p" : ""; | ||
var hourCode = (opts.twelveHourClock) ? "%I" : "%H"; | ||
var factor; | ||
var fmt; | ||
var fmt; | ||
@@ -537,3 +539,3 @@ if (opts.timeBase === 'seconds') { | ||
if (t < timeUnitSize.second) { | ||
var decimals = -Math.floor(Math.log10(t/factor)) | ||
var decimals = -Math.floor(Math.log10(t / factor)) | ||
@@ -545,34 +547,34 @@ // the two-and-halves require an additional decimal | ||
fmt = "%S.%" + decimals + "s"; | ||
fmt = "%S.%" + decimals + "s"; | ||
} else | ||
if (t < timeUnitSize.minute) { | ||
fmt = hourCode + ":%M:%S" + suffix; | ||
} else if (t < timeUnitSize.day) { | ||
if (span < 2 * timeUnitSize.day) { | ||
fmt = hourCode + ":%M" + suffix; | ||
} else { | ||
fmt = "%b %d " + hourCode + ":%M" + suffix; | ||
} | ||
} else if (t < timeUnitSize.month) { | ||
fmt = "%b %d"; | ||
} else if ((useQuarters && t < timeUnitSize.quarter) || | ||
(!useQuarters && t < timeUnitSize.year)) { | ||
if (span < timeUnitSize.year) { | ||
fmt = "%b"; | ||
} else { | ||
fmt = "%b %Y"; | ||
} | ||
} else if (useQuarters && t < timeUnitSize.year) { | ||
if (span < timeUnitSize.year) { | ||
fmt = "Q%q"; | ||
} else { | ||
fmt = "Q%q %Y"; | ||
} | ||
} else { | ||
fmt = "%Y"; | ||
} | ||
fmt = hourCode + ":%M:%S" + suffix; | ||
} else if (t < timeUnitSize.day) { | ||
if (span < 2 * timeUnitSize.day) { | ||
fmt = hourCode + ":%M" + suffix; | ||
} else { | ||
fmt = "%b %d " + hourCode + ":%M" + suffix; | ||
} | ||
} else if (t < timeUnitSize.month) { | ||
fmt = "%b %d"; | ||
} else if ((useQuarters && t < timeUnitSize.quarter) || | ||
(!useQuarters && t < timeUnitSize.year)) { | ||
if (span < timeUnitSize.year) { | ||
fmt = "%b"; | ||
} else { | ||
fmt = "%b %Y"; | ||
} | ||
} else if (useQuarters && t < timeUnitSize.year) { | ||
if (span < timeUnitSize.year) { | ||
fmt = "Q%q"; | ||
} else { | ||
fmt = "Q%q %Y"; | ||
} | ||
} else { | ||
fmt = "%Y"; | ||
} | ||
var rt = formatDate(d, fmt, opts.monthNames, opts.dayNames); | ||
var rt = formatDate(d, fmt, opts.monthNames, opts.dayNames); | ||
return rt; | ||
return rt; | ||
}; | ||
@@ -579,0 +581,0 @@ } |
@@ -38,3 +38,3 @@ /* global jQuery */ | ||
navigationConstraint: 'unconstrained', | ||
initialState: null, | ||
initialState: null | ||
}, | ||
@@ -41,0 +41,0 @@ useManualPan = options.pan.interactive && options.pan.touchMode === 'manual', |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
993984
19580
29