mirror of
https://github.com/status-im/burnchart.git
synced 2025-02-10 01:23:23 +00:00
fix date ticks; closes #114
This commit is contained in:
parent
5691e0150b
commit
8ec6c5abae
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "burnchart",
|
"name": "burnchart",
|
||||||
"version": "3.0.5",
|
"version": "3.0.6",
|
||||||
"description": "GitHub Burndown Chart as a Service",
|
"description": "GitHub Burndown Chart as a Service",
|
||||||
"author": "Radek Stepan <dev@radekstepan.com> (http://radekstepan.com)",
|
"author": "Radek Stepan <dev@radekstepan.com> (http://radekstepan.com)",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
|
File diff suppressed because one or more lines are too long
4
public/js/bundle.min.js
vendored
4
public/js/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,25 +4,34 @@ import _ from 'lodash';
|
|||||||
export default {
|
export default {
|
||||||
|
|
||||||
time(height, x, span) {
|
time(height, x, span) {
|
||||||
// Tick time format based on number of days we display.
|
|
||||||
let specifier = (span < 4) ? '' : (span < 14) ? '%a' : (span < 32) ? '%m/%d' : '%b';
|
|
||||||
let format = d3.time.format.utc(specifier);
|
|
||||||
|
|
||||||
return d3.svg.axis().scale(x)
|
return d3.svg.axis().scale(x)
|
||||||
.orient("bottom")
|
.orient("bottom")
|
||||||
// Show vertical lines...
|
// Show vertical lines...
|
||||||
.tickSize(-height)
|
.tickSize(-height)
|
||||||
|
// limit the number of ticks
|
||||||
|
.ticks(7)
|
||||||
// tick time format...
|
// tick time format...
|
||||||
.tickFormat(format)
|
.tickFormat(d3.time.format((() => {
|
||||||
// and give us a spacer.
|
switch (true) {
|
||||||
.tickPadding(10);
|
case span < 4:
|
||||||
|
return '';
|
||||||
|
// Two weeks.
|
||||||
|
case span < 14:
|
||||||
|
return '%a';
|
||||||
|
// 3 months.
|
||||||
|
case span < 3 * 30:
|
||||||
|
return '%m/%d';
|
||||||
|
default:
|
||||||
|
return '%b';
|
||||||
|
}
|
||||||
|
})()));
|
||||||
},
|
},
|
||||||
|
|
||||||
year(height, xAxis, span) {
|
year(height, xAxis, span) {
|
||||||
return xAxis
|
return xAxis
|
||||||
.orient("top")
|
.orient("top")
|
||||||
.tickSize(height)
|
.tickSize(height)
|
||||||
.tickFormat(d3.time.format.utc('%Y'))
|
.tickFormat((d) => d.getFullYear())
|
||||||
.ticks(span / 365);
|
.ticks(span / 365);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user