BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
a2d10937
Commit
a2d10937
authored
Sep 07, 2017
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored the pickColors method
parent
290217d5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
multiple_time_series.js
...sets/javascripts/monitoring/utils/multiple_time_series.js
+7
-4
No files found.
app/assets/javascripts/monitoring/utils/multiple_time_series.js
View file @
a2d10937
...
@@ -10,8 +10,11 @@ const defaultColorPalette = {
...
@@ -10,8 +10,11 @@ const defaultColorPalette = {
};
};
const
defaultColorOrder
=
[
'blue'
,
'orange'
,
'red'
,
'green'
,
'purple'
];
const
defaultColorOrder
=
[
'blue'
,
'orange'
,
'red'
,
'green'
,
'purple'
];
let
usedColors
=
[];
function
pickColor
(
name
)
{
export
default
function
createTimeSeries
(
queryData
,
graphWidth
,
graphHeight
,
graphHeightOffset
)
{
let
usedColors
=
[];
function
pickColor
(
name
)
{
let
pick
;
let
pick
;
if
(
name
&&
defaultColorPalette
[
name
])
{
if
(
name
&&
defaultColorPalette
[
name
])
{
pick
=
name
;
pick
=
name
;
...
@@ -26,9 +29,8 @@ function pickColor(name) {
...
@@ -26,9 +29,8 @@ function pickColor(name) {
}
}
usedColors
.
push
(
pick
);
usedColors
.
push
(
pick
);
return
defaultColorPalette
[
pick
];
return
defaultColorPalette
[
pick
];
}
}
export
default
function
createTimeSeries
(
queryData
,
graphWidth
,
graphHeight
,
graphHeightOffset
)
{
const
maxValues
=
queryData
.
result
.
map
((
timeSeries
,
index
)
=>
{
const
maxValues
=
queryData
.
result
.
map
((
timeSeries
,
index
)
=>
{
const
maxValue
=
d3
.
max
(
timeSeries
.
values
.
map
(
d
=>
d
.
value
));
const
maxValue
=
d3
.
max
(
timeSeries
.
values
.
map
(
d
=>
d
.
value
));
return
{
return
{
...
@@ -45,6 +47,7 @@ export default function createTimeSeries(queryData, graphWidth, graphHeight, gra
...
@@ -45,6 +47,7 @@ export default function createTimeSeries(queryData, graphWidth, graphHeight, gra
let
metricTag
=
''
;
let
metricTag
=
''
;
let
lineColor
=
'#1f78d1'
;
let
lineColor
=
'#1f78d1'
;
let
areaColor
=
'#8fbce8'
;
let
areaColor
=
'#8fbce8'
;
const
timeSeriesScaleX
=
d3
.
time
.
scale
()
const
timeSeriesScaleX
=
d3
.
time
.
scale
()
.
range
([
0
,
graphWidth
-
70
]);
.
range
([
0
,
graphWidth
-
70
]);
...
...
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