Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
520ab72b
Commit
520ab72b
authored
Aug 24, 2017
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added vertical spacing when there's multiple legends
parent
d9a3c5f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
21 deletions
+40
-21
app/assets/javascripts/monitoring/components/graph.vue
app/assets/javascripts/monitoring/components/graph.vue
+12
-5
app/assets/javascripts/monitoring/components/graph/legend.vue
...assets/javascripts/monitoring/components/graph/legend.vue
+14
-8
app/assets/javascripts/monitoring/utils/measurements.js
app/assets/javascripts/monitoring/utils/measurements.js
+6
-6
app/assets/stylesheets/pages/environments.scss
app/assets/stylesheets/pages/environments.scss
+8
-2
No files found.
app/assets/javascripts/monitoring/components/graph.vue
View file @
520ab72b
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
data
()
{
data
()
{
return
{
return
{
baseGraphHeight
:
450
,
baseGraphWidth
:
600
,
graphHeight
:
450
,
graphHeight
:
450
,
graphWidth
:
600
,
graphWidth
:
600
,
graphHeightOffset
:
120
,
graphHeightOffset
:
120
,
...
@@ -54,7 +56,6 @@
...
@@ -54,7 +56,6 @@
currentDataIndex
:
0
,
currentDataIndex
:
0
,
currentXCoordinate
:
0
,
currentXCoordinate
:
0
,
currentFlagPosition
:
0
,
currentFlagPosition
:
0
,
metricUsage
:
''
,
showFlag
:
false
,
showFlag
:
false
,
showDeployInfo
:
true
,
showDeployInfo
:
true
,
timeSeries
:
[],
timeSeries
:
[],
...
@@ -76,12 +77,12 @@
...
@@ -76,12 +77,12 @@
computed
:
{
computed
:
{
outterViewBox
()
{
outterViewBox
()
{
return
`0 0
${
this
.
graphWidth
}
${
this
.
g
raphHeight
}
`
;
return
`0 0
${
this
.
baseGraphWidth
}
${
this
.
baseG
raphHeight
}
`
;
},
},
innerViewBox
()
{
innerViewBox
()
{
if
((
this
.
g
raphWidth
-
150
)
>
0
)
{
if
((
this
.
baseG
raphWidth
-
150
)
>
0
)
{
return
`0 0
${
this
.
graphWidth
-
150
}
${
this
.
g
raphHeight
}
`
;
return
`0 0
${
this
.
baseGraphWidth
-
150
}
${
this
.
baseG
raphHeight
}
`
;
}
}
return
'
0 0 0 0
'
;
return
'
0 0 0 0
'
;
},
},
...
@@ -92,7 +93,7 @@
...
@@ -92,7 +93,7 @@
paddingBottomRootSvg
()
{
paddingBottomRootSvg
()
{
return
{
return
{
paddingBottom
:
`
${(
Math
.
ceil
(
this
.
graphHeight
*
100
)
/
this
.
g
raphWidth
)
||
0
}
%`
,
paddingBottom
:
`
${(
Math
.
ceil
(
this
.
baseGraphHeight
*
100
)
/
this
.
baseG
raphWidth
)
||
0
}
%`
,
};
};
},
},
},
},
...
@@ -113,6 +114,8 @@
...
@@ -113,6 +114,8 @@
this
.
graphWidth
=
this
.
$refs
.
baseSvg
.
clientWidth
-
this
.
graphWidth
=
this
.
$refs
.
baseSvg
.
clientWidth
-
this
.
margin
.
left
-
this
.
margin
.
right
;
this
.
margin
.
left
-
this
.
margin
.
right
;
this
.
graphHeight
=
this
.
graphHeight
-
this
.
margin
.
top
-
this
.
margin
.
bottom
;
this
.
graphHeight
=
this
.
graphHeight
-
this
.
margin
.
top
-
this
.
margin
.
bottom
;
this
.
baseGraphHeight
=
this
.
graphHeight
;
this
.
baseGraphWidth
=
this
.
graphWidth
;
this
.
renderAxesPaths
();
this
.
renderAxesPaths
();
this
.
formatDeployments
();
this
.
formatDeployments
();
},
},
...
@@ -178,6 +181,10 @@
...
@@ -178,6 +181,10 @@
};
};
});
});
if
(
this
.
timeSeries
.
length
>
4
)
{
this
.
baseGraphHeight
=
this
.
baseGraphHeight
+=
(
this
.
timeSeries
.
length
-
4
)
*
20
;
}
const
axisXScale
=
d3
.
time
.
scale
()
const
axisXScale
=
d3
.
time
.
scale
()
.
range
([
0
,
this
.
graphWidth
]);
.
range
([
0
,
this
.
graphWidth
]);
const
axisYScale
=
d3
.
scale
.
linear
()
const
axisYScale
=
d3
.
scale
.
linear
()
...
...
app/assets/javascripts/monitoring/components/graph/legend.vue
View file @
520ab72b
...
@@ -48,6 +48,8 @@
...
@@ -48,6 +48,8 @@
return
{
return
{
yLabelWidth
:
0
,
yLabelWidth
:
0
,
yLabelHeight
:
0
,
yLabelHeight
:
0
,
seriesXPosition
:
0
,
metricUsageXPosition
:
0
,
};
};
},
},
computed
:
{
computed
:
{
...
@@ -77,7 +79,7 @@
...
@@ -77,7 +79,7 @@
},
},
methods
:
{
methods
:
{
translateLegendGroup
(
index
)
{
translateLegendGroup
(
index
)
{
return
`translate(
${
120
*
index
}
, 0
)`
;
return
`translate(
0,
${
12
*
(
index
)}
)`
;
},
},
formatMetricUsage
(
series
)
{
formatMetricUsage
(
series
)
{
...
@@ -87,6 +89,8 @@
...
@@ -87,6 +89,8 @@
mounted
()
{
mounted
()
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
const
bbox
=
this
.
$refs
.
ylabel
.
getBBox
();
const
bbox
=
this
.
$refs
.
ylabel
.
getBBox
();
this
.
seriesXPosition
=
this
.
$refs
.
legendTitleSvg
[
0
].
getBBox
().
width
;
this
.
metricUsageXPosition
=
this
.
$refs
.
seriesTitleSvg
[
0
].
getBBox
().
width
;
this
.
yLabelWidth
=
bbox
.
width
+
10
;
// Added some padding
this
.
yLabelWidth
=
bbox
.
width
+
10
;
// Added some padding
this
.
yLabelHeight
=
bbox
.
height
+
5
;
this
.
yLabelHeight
=
bbox
.
height
+
5
;
});
});
...
@@ -153,21 +157,23 @@
...
@@ -153,21 +157,23 @@
:y=
"graphHeight - measurements.legendOffset"
>
:y=
"graphHeight - measurements.legendOffset"
>
</rect>
</rect>
<text
<text
class=
"text-metric-title"
class=
"legend-metric-title"
x=
"45"
ref=
"legendTitleSvg"
x=
"38"
:y=
"graphHeight - 30"
>
:y=
"graphHeight - 30"
>
{{
legendTitle
}}
{{
legendTitle
}}
</text>
</text>
<text
<text
class=
"text-metric-title"
class=
"legend-metric-title"
x=
"45"
ref=
"seriesTitleSvg"
:y=
"graphHeight - 20"
>
:x=
"seriesXPosition + 40"
:y=
"graphHeight - 30"
>
Series
{{
index
+
1
}}
Series
{{
index
+
1
}}
</text>
</text>
<text
<text
class=
"text-metric-usage"
class=
"text-metric-usage"
x=
"
45"
:x=
"metricUsageXPosition + seriesXPosition +
45"
:y=
"graphHeight -
1
0"
>
:y=
"graphHeight -
3
0"
>
{{
formatMetricUsage
(
series
)
}}
{{
formatMetricUsage
(
series
)
}}
</text>
</text>
</g>
</g>
...
...
app/assets/javascripts/monitoring/utils/measurements.js
View file @
520ab72b
...
@@ -7,15 +7,15 @@ export default {
...
@@ -7,15 +7,15 @@ export default {
left
:
40
,
left
:
40
,
},
},
legends
:
{
legends
:
{
width
:
1
5
,
width
:
1
0
,
height
:
25
,
height
:
3
,
},
},
backgroundLegend
:
{
backgroundLegend
:
{
width
:
30
,
width
:
30
,
height
:
50
,
height
:
50
,
},
},
axisLabelLineOffset
:
-
20
,
axisLabelLineOffset
:
-
20
,
legendOffset
:
3
5
,
legendOffset
:
3
3
,
},
},
large
:
{
// This covers both md and lg screen sizes
large
:
{
// This covers both md and lg screen sizes
margin
:
{
margin
:
{
...
@@ -25,15 +25,15 @@ export default {
...
@@ -25,15 +25,15 @@ export default {
left
:
80
,
left
:
80
,
},
},
legends
:
{
legends
:
{
width
:
20
,
width
:
15
,
height
:
3
0
,
height
:
3
,
},
},
backgroundLegend
:
{
backgroundLegend
:
{
width
:
30
,
width
:
30
,
height
:
150
,
height
:
150
,
},
},
axisLabelLineOffset
:
20
,
axisLabelLineOffset
:
20
,
legendOffset
:
3
8
,
legendOffset
:
3
6
,
},
},
xTicks
:
8
,
xTicks
:
8
,
yTicks
:
3
,
yTicks
:
3
,
...
...
app/assets/stylesheets/pages/environments.scss
View file @
520ab72b
...
@@ -249,8 +249,14 @@
...
@@ -249,8 +249,14 @@
font-weight
:
$gl-font-weight-bold
;
font-weight
:
$gl-font-weight-bold
;
}
}
.label-axis-text
,
.label-axis-text
{
.text-metric-usage
{
fill
:
$black
;
font-weight
:
$gl-font-weight-normal
;
font-size
:
10px
;
}
.text-metric-usage
,
.legend-metric-title
{
fill
:
$black
;
fill
:
$black
;
font-weight
:
$gl-font-weight-normal
;
font-weight
:
$gl-font-weight-normal
;
font-size
:
12px
;
font-size
:
12px
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment