diff options
author | Jose Ivan Vargas <jvargas@gitlab.com> | 2018-04-04 15:00:52 -0500 |
---|---|---|
committer | Jose Ivan Vargas <jvargas@gitlab.com> | 2018-04-06 14:39:47 -0500 |
commit | af8716399d32b5597ba3823652476ba1a8d4cc22 (patch) | |
tree | dbbc0af0f5a5c60720c1c099280b92be0f693aaa /app/assets/javascripts/monitoring/components/graph.vue | |
parent | 6ed3580be624cf739c753013ef8b4c45262e9738 (diff) | |
download | gitlab-ce-af8716399d32b5597ba3823652476ba1a8d4cc22.tar.gz |
Componetize the legend component
Diffstat (limited to 'app/assets/javascripts/monitoring/components/graph.vue')
-rw-r--r-- | app/assets/javascripts/monitoring/components/graph.vue | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/assets/javascripts/monitoring/components/graph.vue b/app/assets/javascripts/monitoring/components/graph.vue index d9f2b9ba7cb..f93b1da4f58 100644 --- a/app/assets/javascripts/monitoring/components/graph.vue +++ b/app/assets/javascripts/monitoring/components/graph.vue @@ -1,6 +1,7 @@ <script> import { scaleLinear, scaleTime } from 'd3-scale'; import { axisLeft, axisBottom } from 'd3-axis'; +import _ from 'underscore'; import { max, extent } from 'd3-array'; import { select } from 'd3-selection'; import GraphAxis from './graph/axis.vue'; @@ -179,10 +180,12 @@ export default { this.graphHeightOffset, ); - const axisXScale = d3.scaleTime() - .range([0, this.graphWidth - 70]); - const axisYScale = d3.scaleLinear() - .range([this.graphHeight - this.graphHeightOffset, 0]); + if (_.findWhere(this.timeSeries, { renderCanary: true })) { + this.timeSeries = this.timeSeries.map(series => ({ ...series, renderCanary: true })); + } + + const axisXScale = d3.scaleTime().range([0, this.graphWidth - 70]); + const axisYScale = d3.scaleLinear().range([this.graphHeight - this.graphHeightOffset, 0]); const allValues = this.timeSeries.reduce((all, { values }) => all.concat(values), []); axisXScale.domain(d3.extent(allValues, d => d.time)); @@ -304,7 +307,6 @@ export default { v-if="showLegend" :legend-title="legendTitle" :time-series="timeSeries" - :current-data-index="currentDataIndex" /> </div> </template> |