Feat: force date order in graph

This commit is contained in:
Bertrand Benjamin 2019-01-30 17:21:09 +01:00
parent 68653aaabe
commit a6a37539bd
4 changed files with 25 additions and 2 deletions

View File

@ -106,3 +106,12 @@ tags:
words:
- ALVEOLES
- LYON FRITE ALORS !
voiture:
color: '#0077c8'
icon: car
name: Voiture
variant: ''
words:
- VOITURE
- ARBENT A84 OYONNAX
- ST CLAUDE ALAIN PNEU

View File

@ -20,6 +20,19 @@ export default {
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
xAxes: [{
type: 'time',
time: {
parser: 'MMMM YYYY',
},
scaleLabel: {
display: true,
format: 'MMMM YYYY',
labelString: 'Date'
}
}]
},
legend: {
position: 'left'
}

View File

@ -123,7 +123,9 @@ export default {
},
months: (state, getters) => {
// Set of month
return [...new Set(getters.rows.map(x => moment(x.Date).format('MMMM YYYY')))]
return [...new Set(getters.rows.map(x => moment(x.Date).format('MMMM YYYY')))].sort((left, right) => {
return moment(left, 'MMMM YYYY').diff(moment(right, 'MMMM YYYY'))
})
}
},
mutations: {

View File

@ -121,7 +121,6 @@ export default {
'categorie_filter_rows': 'datas/categorie_filter_rows',
'datas_present': 'datas/present',
'month': 'datas/month',
'months': 'datas/months',
'tags': 'config/tags',
'categories': 'config/categories'
}),