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
ef9dd014
Commit
ef9dd014
authored
Jul 31, 2017
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
heatmap: add color scale options, issue #8539
parent
5406481e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
public/app/plugins/panel/heatmap/partials/display_editor.html
+12
-0
public/app/plugins/panel/heatmap/rendering.ts
+7
-5
No files found.
public/app/plugins/panel/heatmap/partials/display_editor.html
View file @
ef9dd014
...
...
@@ -44,6 +44,18 @@
</div>
<div
class=
"section gf-form-group"
>
<h5
class=
"section-heading"
>
Color scale
</h5>
<div
class=
"gf-form"
>
<label
class=
"gf-form-label width-8"
>
Min
</label>
<input
type=
"number"
ng-model=
"ctrl.panel.color.min"
class=
"gf-form-input width-5"
placeholder=
"auto"
data-placement=
"right"
bs-tooltip=
"''"
ng-change=
"ctrl.refresh()"
ng-model-onblur
>
</div>
<div
class=
"gf-form"
>
<label
class=
"gf-form-label width-8"
>
Max
</label>
<input
type=
"number"
ng-model=
"ctrl.panel.color.max"
class=
"gf-form-input width-5"
placeholder=
"auto"
data-placement=
"right"
bs-tooltip=
"''"
ng-change=
"ctrl.refresh()"
ng-model-onblur
>
</div>
</div>
<div
class=
"section gf-form-group"
>
<h5
class=
"section-heading"
>
Buckets
</h5>
<div
class=
"gf-form"
>
<label
class=
"gf-form-label width-8"
>
Space
</label>
...
...
public/app/plugins/panel/heatmap/rendering.ts
View file @
ef9dd014
...
...
@@ -385,9 +385,11 @@ export default function link(scope, elem, attrs, ctrl) {
}
let
cardsData
=
convertToCards
(
data
.
buckets
);
let
maxValue
=
d3
.
max
(
cardsData
,
card
=>
card
.
count
);
let
maxValueAuto
=
d3
.
max
(
cardsData
,
card
=>
card
.
count
);
let
maxValue
=
panel
.
color
.
max
||
maxValueAuto
;
let
minValue
=
panel
.
color
.
min
||
0
;
colorScale
=
getColorScale
(
maxValue
);
colorScale
=
getColorScale
(
maxValue
,
minValue
);
setOpacityScale
(
maxValue
);
setCardSize
();
...
...
@@ -434,14 +436,14 @@ export default function link(scope, elem, attrs, ctrl) {
.
style
(
"stroke-width"
,
0
);
}
function
getColorScale
(
maxValue
)
{
function
getColorScale
(
maxValue
,
minValue
=
0
)
{
let
colorScheme
=
_
.
find
(
ctrl
.
colorSchemes
,
{
value
:
panel
.
color
.
colorScheme
});
let
colorInterpolator
=
d3
[
colorScheme
.
value
];
let
colorScaleInverted
=
colorScheme
.
invert
===
'always'
||
(
colorScheme
.
invert
===
'dark'
&&
!
contextSrv
.
user
.
lightTheme
);
let
start
=
colorScaleInverted
?
maxValue
:
0
;
let
end
=
colorScaleInverted
?
0
:
maxValue
;
let
start
=
colorScaleInverted
?
maxValue
:
minValue
;
let
end
=
colorScaleInverted
?
minValue
:
maxValue
;
return
d3
.
scaleSequential
(
colorInterpolator
).
domain
([
start
,
end
]);
}
...
...
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