-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #15501 - Change xaxis formatter to honor dateFormat:tz; fix tic…
…k count to accommodate new formatting rules (#15512)
- Loading branch information
1 parent
c4d5018
commit 6c92c10
Showing
6 changed files
with
192 additions
and
132 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/core_plugins/metrics/public/components/lib/create_xaxis_formatter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import moment from 'moment'; | ||
export function getFormat(interval, rules, dateFormat) { | ||
for (let i = rules.length - 1; i >= 0; i--) { | ||
const rule = rules[i]; | ||
if (!rule[0] || interval >= moment.duration(rule[0])) { | ||
return rule[1]; | ||
} | ||
} | ||
return dateFormat; | ||
} | ||
|
||
export function createXaxisFormatter(interval, rules, dateFormat) { | ||
return val => { | ||
return moment(val).format(getFormat(interval, rules, dateFormat)); | ||
}; | ||
} | ||
|
278 changes: 150 additions & 128 deletions
278
src/core_plugins/metrics/public/components/vis_types/timeseries/vis.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.