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
c7e8b98d
Commit
c7e8b98d
authored
Aug 02, 2017
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
heatmap: minor refactor, don't repeat cards stats calculation
parent
f7ea08db
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
17 deletions
+15
-17
public/app/plugins/panel/heatmap/heatmap_ctrl.ts
+2
-8
public/app/plugins/panel/heatmap/heatmap_data_converter.ts
+11
-1
public/app/plugins/panel/heatmap/specs/renderer_specs.ts
+2
-8
No files found.
public/app/plugins/panel/heatmap/heatmap_ctrl.ts
View file @
c7e8b98d
...
...
@@ -191,20 +191,14 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
yBucketSize
=
1
;
}
let
cardsData
=
convertToCards
(
bucketsData
);
let
maxCardsValue
=
_
.
max
(
_
.
map
(
cardsData
,
'count'
));
let
minCardsValue
=
_
.
min
(
_
.
map
(
cardsData
,
'count'
));
let
cardStats
=
{
max
:
maxCardsValue
,
min
:
minCardsValue
};
let
{
cards
,
cardStats
}
=
convertToCards
(
bucketsData
);
this
.
data
=
{
buckets
:
bucketsData
,
heatmapStats
:
heatmapStats
,
xBucketSize
:
xBucketSize
,
yBucketSize
:
yBucketSize
,
cards
:
cards
Data
,
cards
:
cards
,
cardStats
:
cardStats
};
}
...
...
public/app/plugins/panel/heatmap/heatmap_data_converter.ts
View file @
c7e8b98d
...
...
@@ -51,6 +51,7 @@ function elasticHistogramToHeatmap(seriesList) {
* @return {Array} Array of "card" objects
*/
function
convertToCards
(
buckets
)
{
let
min
=
0
,
max
=
0
;
let
cards
=
[];
_
.
forEach
(
buckets
,
xBucket
=>
{
_
.
forEach
(
xBucket
.
buckets
,
yBucket
=>
{
...
...
@@ -62,10 +63,19 @@ function convertToCards(buckets) {
count
:
yBucket
.
count
,
};
cards
.
push
(
card
);
if
(
cards
.
length
===
1
)
{
min
=
yBucket
.
count
;
max
=
yBucket
.
count
;
}
min
=
yBucket
.
count
<
min
?
yBucket
.
count
:
min
;
max
=
yBucket
.
count
>
max
?
yBucket
.
count
:
max
;
});
});
return
cards
;
let
cardStats
=
{
min
,
max
};
return
{
cards
,
cardStats
};
}
/**
...
...
public/app/plugins/panel/heatmap/specs/renderer_specs.ts
View file @
c7e8b98d
...
...
@@ -114,14 +114,8 @@ describe('grafanaHeatmap', function () {
let
bucketsData
=
convertToHeatMap
(
ctx
.
series
,
ctx
.
data
.
yBucketSize
,
ctx
.
data
.
xBucketSize
,
logBase
);
ctx
.
data
.
buckets
=
bucketsData
;
let
cardsData
=
convertToCards
(
bucketsData
);
let
maxCardsValue
=
_
.
max
(
_
.
map
(
cardsData
,
'count'
));
let
minCardsValue
=
_
.
min
(
_
.
map
(
cardsData
,
'count'
));
let
cardStats
=
{
max
:
maxCardsValue
,
min
:
minCardsValue
};
ctx
.
data
.
cards
=
cardsData
;
let
{
cards
,
cardStats
}
=
convertToCards
(
bucketsData
);
ctx
.
data
.
cards
=
cards
;
ctx
.
data
.
cardStats
=
cardStats
;
let
elemHtml
=
`
...
...
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