|
| 1 | +diff --git a/node_modules/plotly.js/src/plots/plots.js b/node_modules/plotly.js/src/plots/plots.js |
| 2 | +index 508dec6..6b95ec5 100644 |
| 3 | +--- a/node_modules/plotly.js/src/plots/plots.js |
| 4 | ++++ b/node_modules/plotly.js/src/plots/plots.js |
| 5 | +@@ -708,6 +708,29 @@ function getFormatObj(gd, formatKeys) { |
| 6 | + return formatObj; |
| 7 | + } |
| 8 | + |
| 9 | ++function relativeTimeFormatter(milliseconds) { |
| 10 | ++ let outputString = '' |
| 11 | ++ let seconds = (milliseconds / 1000); |
| 12 | ++ let minutes = Math.floor(seconds / 60) |
| 13 | ++ seconds %= 60 |
| 14 | ++ let hours = Math.floor(minutes / 60) |
| 15 | ++ minutes %= 60 |
| 16 | ++ let days = Math.floor(hours / 24) |
| 17 | ++ hours %= 24 |
| 18 | ++ outputString = ''+seconds.toFixed(3).padStart(6, '0') |
| 19 | ++ if (minutes >= 1 || hours >= 1 || days >= 1) { |
| 20 | ++ outputString = `${minutes}`.padStart(2, '0') + ':' + outputString |
| 21 | ++ } |
| 22 | ++ if (hours >= 1 || days >= 1) { |
| 23 | ++ outputString = hours + ':' + outputString |
| 24 | ++ } |
| 25 | ++ if (days >= 1) { |
| 26 | ++ outputString = days + ' days ' + outputString |
| 27 | ++ } |
| 28 | ++ return outputString |
| 29 | ++} |
| 30 | ++ |
| 31 | ++ |
| 32 | + /** |
| 33 | + * getFormatter: combine the final separators with the locale formatting object |
| 34 | + * we pulled earlier to generate number and time formatters |
| 35 | +@@ -724,10 +747,12 @@ function getFormatter(formatObj, separators) { |
| 36 | + formatObj.decimal = separators.charAt(0); |
| 37 | + formatObj.thousands = separators.charAt(1); |
| 38 | + |
| 39 | +- return { |
| 40 | +- numberFormat: d3.locale(formatObj).numberFormat, |
| 41 | +- timeFormat: timeFormatLocale(formatObj).utcFormat |
| 42 | +- }; |
| 43 | ++ let formatters = d3.locale(formatObj) |
| 44 | ++ formatters.numberFormat = function(specifier) { |
| 45 | ++ return relativeTimeFormatter |
| 46 | ++ } |
| 47 | ++ return formatters |
| 48 | ++ //return function(a){return ''+a} |
| 49 | + } |
| 50 | + |
| 51 | + function fillMetaTextHelpers(newFullData, newFullLayout) { |
0 commit comments