mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-14 07:41:11 +01:00
Added "week" option for xLabels
Added "week" as a valid option for xLabels for graphs showing weekly data.
This commit is contained in:
parent
347533c8dd
commit
47a1b86f76
1 changed files with 6 additions and 1 deletions
|
@ -344,6 +344,11 @@ Morris.LABEL_SPECS =
|
||||||
start: (d) -> new Date(d.getFullYear(), d.getMonth(), 1)
|
start: (d) -> new Date(d.getFullYear(), d.getMonth(), 1)
|
||||||
fmt: (d) -> "#{d.getFullYear()}-#{Morris.pad2(d.getMonth() + 1)}"
|
fmt: (d) -> "#{d.getFullYear()}-#{Morris.pad2(d.getMonth() + 1)}"
|
||||||
incr: (d) -> d.setMonth(d.getMonth() + 1)
|
incr: (d) -> d.setMonth(d.getMonth() + 1)
|
||||||
|
"week":
|
||||||
|
span: 604800000 # 7 * 24 * 60 * 60 * 1000
|
||||||
|
start: (d) -> new Date(d.getFullYear(), d.getMonth(), d.getDate())
|
||||||
|
fmt: (d) -> "#{d.getFullYear()}-#{Morris.pad2(d.getMonth() + 1)}-#{Morris.pad2(d.getDate())}"
|
||||||
|
incr: (d) -> d.setDate(d.getDate() + 7)
|
||||||
"day":
|
"day":
|
||||||
span: 86400000 # 24 * 60 * 60 * 1000
|
span: 86400000 # 24 * 60 * 60 * 1000
|
||||||
start: (d) -> new Date(d.getFullYear(), d.getMonth(), d.getDate())
|
start: (d) -> new Date(d.getFullYear(), d.getMonth(), d.getDate())
|
||||||
|
@ -362,7 +367,7 @@ Morris.LABEL_SPECS =
|
||||||
"second": secondsSpecHelper(1)
|
"second": secondsSpecHelper(1)
|
||||||
|
|
||||||
Morris.AUTO_LABEL_ORDER = [
|
Morris.AUTO_LABEL_ORDER = [
|
||||||
"decade", "year", "month", "day", "hour",
|
"decade", "year", "month", "week", "day", "hour",
|
||||||
"30min", "15min", "10min", "5min", "minute",
|
"30min", "15min", "10min", "5min", "minute",
|
||||||
"30sec", "15sec", "10sec", "5sec", "second"
|
"30sec", "15sec", "10sec", "5sec", "second"
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue