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
f5c5c4b8
Commit
f5c5c4b8
authored
Nov 04, 2017
by
Alexander Zobnin
Committed by
Torkel Ödegaard
Nov 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph: don't change original series name in histogram mode, #8886 (#9782)
parent
b8f9edae
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
13 deletions
+22
-13
public/app/plugins/panel/graph/data_processor.ts
+9
-1
public/app/plugins/panel/graph/graph.ts
+0
-4
public/app/plugins/panel/graph/histogram.ts
+9
-6
public/app/plugins/panel/graph/specs/histogram.jest.ts
+4
-2
No files found.
public/app/plugins/panel/graph/data_processor.ts
View file @
f5c5c4b8
...
...
@@ -25,12 +25,20 @@ export class DataProcessor {
switch
(
this
.
panel
.
xaxis
.
mode
)
{
case
'series'
:
case
'histogram'
:
case
'time'
:
{
return
options
.
dataList
.
map
((
item
,
index
)
=>
{
return
this
.
timeSeriesHandler
(
item
,
index
,
options
);
});
}
case
'histogram'
:
{
let
histogramDataList
=
[{
target
:
'count'
,
datapoints
:
_
.
concat
([],
_
.
flatten
(
_
.
map
(
options
.
dataList
,
'datapoints'
)))
}];
return
histogramDataList
.
map
((
item
,
index
)
=>
{
return
this
.
timeSeriesHandler
(
item
,
index
,
options
);
});
}
case
'field'
:
{
return
this
.
customHandler
(
firstItem
);
}
...
...
public/app/plugins/panel/graph/graph.ts
View file @
f5c5c4b8
...
...
@@ -313,11 +313,7 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) {
let
ticks
=
panel
.
xaxis
.
buckets
||
panelWidth
/
50
;
bucketSize
=
tickStep
(
histMin
,
histMax
,
ticks
);
let
histogram
=
convertValuesToHistogram
(
values
,
bucketSize
);
data
[
0
].
data
=
histogram
;
data
[
0
].
alias
=
data
[
0
].
label
=
data
[
0
].
id
=
"count"
;
data
=
[
data
[
0
]];
options
.
series
.
bars
.
barWidth
=
bucketSize
*
0.8
;
}
else
{
bucketSize
=
0
;
...
...
public/app/plugins/panel/graph/histogram.ts
View file @
f5c5c4b8
import
_
from
'lodash'
;
import
TimeSeries
from
'app/core/time_series2'
;
/**
* Convert series into array of series values.
* @param data Array of series
*/
export
function
getSeriesValues
(
data
:
any
):
number
[]
{
export
function
getSeriesValues
(
dataList
:
TimeSeries
[]):
number
[]
{
const
VALUE_INDEX
=
0
;
let
values
=
[];
// Count histogam stats
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
let
series
=
data
[
i
];
for
(
let
j
=
0
;
j
<
series
.
data
.
length
;
j
++
)
{
if
(
series
.
data
[
j
][
1
]
!==
null
)
{
values
.
push
(
series
.
data
[
j
][
1
]);
for
(
let
i
=
0
;
i
<
dataList
.
length
;
i
++
)
{
let
series
=
dataList
[
i
];
let
datapoints
=
series
.
datapoints
;
for
(
let
j
=
0
;
j
<
datapoints
.
length
;
j
++
)
{
if
(
datapoints
[
j
][
VALUE_INDEX
]
!==
null
)
{
values
.
push
(
datapoints
[
j
][
VALUE_INDEX
]);
}
}
}
...
...
public/app/plugins/panel/graph/specs/histogram.jest.ts
View file @
f5c5c4b8
...
...
@@ -37,7 +37,9 @@ describe('Graph Histogam Converter', function () {
beforeEach
(()
=>
{
data
=
[
{
data
:
[[
0
,
1
],
[
0
,
2
],
[
0
,
10
],
[
0
,
11
],
[
0
,
17
],
[
0
,
20
],
[
0
,
29
]]
datapoints
:
[
[
1
,
0
],
[
2
,
0
],
[
10
,
0
],
[
11
,
0
],
[
17
,
0
],
[
20
,
0
],
[
29
,
0
]
]
}
];
});
...
...
@@ -50,7 +52,7 @@ describe('Graph Histogam Converter', function () {
});
it
(
'Should skip null values'
,
()
=>
{
data
[
0
].
data
.
push
([
0
,
null
]);
data
[
0
].
data
points
.
push
([
null
,
0
]);
let
expected
=
[
1
,
2
,
10
,
11
,
17
,
20
,
29
];
...
...
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