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: words:
- ALVEOLES - ALVEOLES
- LYON FRITE ALORS ! - 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: { options: {
responsive: true, responsive: true,
maintainAspectRatio: false, maintainAspectRatio: false,
scales: {
xAxes: [{
type: 'time',
time: {
parser: 'MMMM YYYY',
},
scaleLabel: {
display: true,
format: 'MMMM YYYY',
labelString: 'Date'
}
}]
},
legend: { legend: {
position: 'left' position: 'left'
} }

View File

@ -123,7 +123,9 @@ export default {
}, },
months: (state, getters) => { months: (state, getters) => {
// Set of month // 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: { mutations: {

View File

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