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
8e5672ae
Commit
8e5672ae
authored
Jun 26, 2017
by
Alexander Zobnin
Committed by
Daniel Lee
Jun 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
heatmap: fix Y axis value rounding with linear scale
parent
53ea9cfb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
public/app/plugins/panel/heatmap/rendering.ts
+9
-3
No files found.
public/app/plugins/panel/heatmap/rendering.ts
View file @
8e5672ae
...
...
@@ -131,7 +131,9 @@ export default function link(scope, elem, attrs, ctrl) {
tick_interval
=
tickStep
(
y_min
,
y_max
,
ticks
);
ticks
=
Math
.
ceil
((
y_max
-
y_min
)
/
tick_interval
);
let
decimalsAuto
=
getPrecision
(
tick_interval
);
let
decimals
=
panel
.
yAxis
.
decimals
===
null
?
getPrecision
(
tick_interval
)
:
panel
.
yAxis
.
decimals
;
let
scaledDecimals
=
getScaledDecimals
(
decimals
,
tick_interval
);
// Set default Y min and max if no data
if
(
_
.
isEmpty
(
data
.
buckets
))
{
...
...
@@ -153,7 +155,7 @@ export default function link(scope, elem, attrs, ctrl) {
let
yAxis
=
d3
.
axisLeft
(
yScale
)
.
ticks
(
ticks
)
.
tickFormat
(
tickValueFormatter
(
decimals
))
.
tickFormat
(
tickValueFormatter
(
decimals
,
scaledDecimals
))
.
tickSizeInner
(
0
-
width
)
.
tickSizeOuter
(
0
)
.
tickPadding
(
Y_AXIS_TICK_PADDING
);
...
...
@@ -293,10 +295,14 @@ export default function link(scope, elem, attrs, ctrl) {
return
tickValues
;
}
function
tickValueFormatter
(
decimals
)
{
function
getScaledDecimals
(
decimals
,
tick_size
)
{
return
decimals
-
Math
.
floor
(
Math
.
log
(
tick_size
)
/
Math
.
LN10
);
}
function
tickValueFormatter
(
decimals
,
scaledDecimals
=
null
)
{
let
format
=
panel
.
yAxis
.
format
;
return
function
(
value
)
{
return
kbn
.
valueFormats
[
format
](
value
,
decimals
);
return
kbn
.
valueFormats
[
format
](
value
,
decimals
,
scaledDecimals
);
};
}
...
...
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