Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
b79017e4
Commit
b79017e4
authored
Jan 26, 2018
by
Alexander Zobnin
Committed by
Torkel Ödegaard
Jan 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph: fix series sorting issue (#10617)
parent
ac2b36c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
24 deletions
+7
-24
public/app/plugins/panel/graph/graph.ts
+7
-24
No files found.
public/app/plugins/panel/graph/graph.ts
View file @
b79017e4
...
...
@@ -355,33 +355,16 @@ function graphDirective(timeSrv, popoverSrv, contextSrv) {
function
sortSeries
(
series
,
panel
)
{
var
sortBy
=
panel
.
legend
.
sort
;
var
sortOrder
=
panel
.
legend
.
sortDesc
;
var
haveSortBy
=
sortBy
!==
null
||
sortBy
!==
undefined
;
var
haveSortOrder
=
sortOrder
!==
null
||
sortOrder
!==
undefined
;
var
haveSortBy
=
sortBy
!==
null
&&
sortBy
!==
undefined
;
var
haveSortOrder
=
sortOrder
!==
null
&&
sortOrder
!==
undefined
;
var
shouldSortBy
=
panel
.
stack
&&
haveSortBy
&&
haveSortOrder
;
var
sortDesc
=
panel
.
legend
.
sortDesc
===
true
?
-
1
:
1
;
series
.
sort
((
x
,
y
)
=>
{
if
(
x
.
zindex
>
y
.
zindex
)
{
return
1
;
}
if
(
x
.
zindex
<
y
.
zindex
)
{
return
-
1
;
}
if
(
shouldSortBy
)
{
if
(
x
.
stats
[
sortBy
]
>
y
.
stats
[
sortBy
])
{
return
1
*
sortDesc
;
}
if
(
x
.
stats
[
sortBy
]
<
y
.
stats
[
sortBy
])
{
return
-
1
*
sortDesc
;
}
}
return
0
;
});
return
series
;
if
(
shouldSortBy
)
{
return
_
.
sortBy
(
series
,
s
=>
s
.
stats
[
sortBy
]
*
sortDesc
);
}
else
{
return
_
.
sortBy
(
series
,
s
=>
s
.
zindex
);
}
}
function
translateFillOption
(
fill
)
{
...
...
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