diff options
author | Adriel Santiago <asantiago@gitlab.com> | 2019-05-22 20:50:30 +0000 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-05-22 20:50:30 +0000 |
commit | 55fb75b92f1d5608353e23e5794e256448efcb3a (patch) | |
tree | 93192614e5392fa14a47a9e60862ad28f2ac38a1 /app | |
parent | 8f0ad1344bdd6fdf9f272d2cbcf3fa7d768725f3 (diff) | |
download | gitlab-ce-55fb75b92f1d5608353e23e5794e256448efcb3a.tar.gz |
Remove datapoint sorting from area chart
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/monitoring/components/charts/area.vue | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/assets/javascripts/monitoring/components/charts/area.vue b/app/assets/javascripts/monitoring/components/charts/area.vue index afe8d87a8d6..c43791f2426 100644 --- a/app/assets/javascripts/monitoring/components/charts/area.vue +++ b/app/assets/javascripts/monitoring/components/charts/area.vue @@ -125,17 +125,17 @@ export default { }, earliestDatapoint() { return this.chartData.reduce((acc, series) => { - if (!series.data.length) { + const { data } = series; + const { length } = data; + if (!length) { return acc; } - const [[timestamp]] = series.data.sort(([a], [b]) => { - if (a < b) { - return -1; - } - return a > b ? 1 : 0; - }); - return timestamp < acc || acc === null ? timestamp : acc; + const [first] = data[0]; + const [last] = data[length - 1]; + const seriesEarliest = first < last ? first : last; + + return seriesEarliest < acc || acc === null ? seriesEarliest : acc; }, null); }, isMultiSeries() { |