Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Findeton committed Apr 4, 2024
1 parent df21951 commit 73c819c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
11 changes: 9 additions & 2 deletions avAdmin/admin-directives/dashboard/turnout-graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
</label>
</div>
<div class="time-selector-container">
<label for="time-basis">Choose a time basis:</label>
<label for="time-basis">Choose a time resolution:</label>
<select name="time-basis" id="time-basis" ng-model="timeBasis.value">
<option value="auto">Auto</option>
<option value="hour">Hour</option>
<option value="day">Day</option>
<option value="week">Week</option>
<option value="month">Month</option>
</div>
<div moment-picker="selectedDates.minDate" max-view="hour"> {{ selectedDates.minDate }} </div>
<div class="start-date-container">
<span>Start date: </span>
<div moment-picker="selectedDates.minDate" max-view="hour"> {{ selectedDates.minDate }} </div>
</div>
<div class="end-date-container">
<span>End date: </span>
<div moment-picker="selectedDates.maxDate" max-view="hour"> {{ selectedDates.maxDate }} </div>
</div>
</div>
</div>
15 changes: 14 additions & 1 deletion avAdmin/admin-directives/dashboard/turnout-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,17 @@ angular.module('avAdmin')
}]
}
};

function updateDates() {
if (scope.selectedDates.minDate instanceof Date) {
scope.minDate = scope.selectedDates.minDate;
}
if (scope.selectedDates.maxDate instanceof Date) {
scope.maxDate = scope.selectedDates.maxDate;
}
calculateValues();
}

var onClick = function (points, evt) {
console.log(points, evt);
};
Expand All @@ -305,7 +316,8 @@ angular.module('avAdmin')
minDate: undefined,
maxDate: undefined,
selectedDates: {
minDate: new Date()
minDate: undefined,
maxDate: undefined
},
seriesBase: series,
dataBase: data,
Expand All @@ -325,6 +337,7 @@ angular.module('avAdmin')
scope.$watch('id', updateTurnoutData);
scope.$watch('selectedSeries', refreshGraph, true);
scope.$watch('timeBasis.value', calculateValues, true);
scope.$watch('selectedDates', updateDates, true)
}

return {
Expand Down

0 comments on commit 73c819c

Please sign in to comment.