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
3e4153a9
Unverified
Commit
3e4153a9
authored
Mar 12, 2019
by
Torkel Ödegaard
Committed by
GitHub
Mar 12, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15934 from alexanderzobnin/heatmap-hide-zero-buckets
heatmap: able to hide buckets with zero value
parents
6d87e821
9ee2a08d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
6 deletions
+29
-6
public/app/plugins/panel/heatmap/heatmap_ctrl.ts
+3
-2
public/app/plugins/panel/heatmap/heatmap_data_converter.ts
+22
-4
public/app/plugins/panel/heatmap/partials/display_editor.html
+4
-0
No files found.
public/app/plugins/panel/heatmap/heatmap_ctrl.ts
View file @
3e4153a9
...
@@ -55,6 +55,7 @@ const panelDefaults = {
...
@@ -55,6 +55,7 @@ const panelDefaults = {
showHistogram
:
false
,
showHistogram
:
false
,
},
},
highlightCards
:
true
,
highlightCards
:
true
,
hideZeroBuckets
:
false
,
};
};
const
colorModes
=
[
'opacity'
,
'spectrum'
];
const
colorModes
=
[
'opacity'
,
'spectrum'
];
...
@@ -204,7 +205,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
...
@@ -204,7 +205,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
yBucketSize
=
1
;
yBucketSize
=
1
;
}
}
const
{
cards
,
cardStats
}
=
convertToCards
(
bucketsData
);
const
{
cards
,
cardStats
}
=
convertToCards
(
bucketsData
,
this
.
panel
.
hideZeroBuckets
);
this
.
data
=
{
this
.
data
=
{
buckets
:
bucketsData
,
buckets
:
bucketsData
,
...
@@ -246,7 +247,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
...
@@ -246,7 +247,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
// Always let yBucketSize=1 in 'tsbuckets' mode
// Always let yBucketSize=1 in 'tsbuckets' mode
yBucketSize
=
1
;
yBucketSize
=
1
;
const
{
cards
,
cardStats
}
=
convertToCards
(
bucketsData
);
const
{
cards
,
cardStats
}
=
convertToCards
(
bucketsData
,
this
.
panel
.
hideZeroBuckets
);
this
.
data
=
{
this
.
data
=
{
buckets
:
bucketsData
,
buckets
:
bucketsData
,
...
...
public/app/plugins/panel/heatmap/heatmap_data_converter.ts
View file @
3e4153a9
...
@@ -93,25 +93,43 @@ function parseHistogramLabel(label: string): number {
...
@@ -93,25 +93,43 @@ function parseHistogramLabel(label: string): number {
return
value
;
return
value
;
}
}
interface
HeatmapCard
{
x
:
number
;
y
:
number
;
yBounds
:
{
top
:
number
|
null
;
bottom
:
number
|
null
;
};
values
:
number
[];
count
:
number
;
}
interface
HeatmapCardStats
{
min
:
number
;
max
:
number
;
}
/**
/**
* Convert buckets into linear array of "cards" - objects, represented heatmap elements.
* Convert buckets into linear array of "cards" - objects, represented heatmap elements.
* @param {Object} buckets
* @param {Object} buckets
* @return {
Array} Array of "card" objec
ts
* @return {
Object} Array of "card" objects and sta
ts
*/
*/
function
convertToCards
(
buckets
)
{
function
convertToCards
(
buckets
:
any
,
hideZero
=
false
):
{
cards
:
HeatmapCard
[];
cardStats
:
HeatmapCardStats
}
{
let
min
=
0
,
let
min
=
0
,
max
=
0
;
max
=
0
;
const
cards
=
[];
const
cards
:
HeatmapCard
[]
=
[];
_
.
forEach
(
buckets
,
xBucket
=>
{
_
.
forEach
(
buckets
,
xBucket
=>
{
_
.
forEach
(
xBucket
.
buckets
,
yBucket
=>
{
_
.
forEach
(
xBucket
.
buckets
,
yBucket
=>
{
const
card
=
{
const
card
:
HeatmapCard
=
{
x
:
xBucket
.
x
,
x
:
xBucket
.
x
,
y
:
yBucket
.
y
,
y
:
yBucket
.
y
,
yBounds
:
yBucket
.
bounds
,
yBounds
:
yBucket
.
bounds
,
values
:
yBucket
.
values
,
values
:
yBucket
.
values
,
count
:
yBucket
.
count
,
count
:
yBucket
.
count
,
};
};
if
(
!
hideZero
||
card
.
count
!==
0
)
{
cards
.
push
(
card
);
cards
.
push
(
card
);
}
if
(
cards
.
length
===
1
)
{
if
(
cards
.
length
===
1
)
{
min
=
yBucket
.
count
;
min
=
yBucket
.
count
;
...
...
public/app/plugins/panel/heatmap/partials/display_editor.html
View file @
3e4153a9
...
@@ -63,6 +63,10 @@
...
@@ -63,6 +63,10 @@
<div
class=
"section gf-form-group"
>
<div
class=
"section gf-form-group"
>
<h5
class=
"section-heading"
>
Buckets
</h5>
<h5
class=
"section-heading"
>
Buckets
</h5>
<gf-form-switch
class=
"gf-form"
label-class=
"width-8"
label=
"Hide zero"
checked=
"ctrl.panel.hideZeroBuckets"
on-change=
"ctrl.render()"
>
</gf-form-switch>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
>
<label
class=
"gf-form-label width-8"
>
Space
</label>
<label
class=
"gf-form-label width-8"
>
Space
</label>
<input
type=
"number"
class=
"gf-form-input width-5"
placeholder=
"auto"
data-placement=
"right"
bs-tooltip=
"''"
ng-model=
"ctrl.panel.cards.cardPadding"
ng-change=
"ctrl.refresh()"
ng-model-onblur
>
<input
type=
"number"
class=
"gf-form-input width-5"
placeholder=
"auto"
data-placement=
"right"
bs-tooltip=
"''"
ng-model=
"ctrl.panel.cards.cardPadding"
ng-change=
"ctrl.refresh()"
ng-model-onblur
>
...
...
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