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
9a197571
Unverified
Commit
9a197571
authored
Aug 05, 2019
by
Torkel Ödegaard
Committed by
GitHub
Aug 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graph: Improved graph tick decimals logic arround significant digits (#18370)
parent
35954d7b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletions
+19
-1
devenv/dev-dashboards/panel-graph/graph_y_axis.json
+0
-0
public/vendor/flot/jquery.flot.js
+19
-1
No files found.
devenv/dev-dashboards/panel-graph/graph_y_axis.json
0 → 100644
View file @
9a197571
This diff is collapsed.
Click to expand it.
public/vendor/flot/jquery.flot.js
View file @
9a197571
...
@@ -1715,6 +1715,23 @@ Licensed under the MIT license.
...
@@ -1715,6 +1715,23 @@ Licensed under the MIT license.
axis
.
max
=
max
;
axis
.
max
=
max
;
}
}
// grafana change
function
getSignificantDigitCount
(
n
)
{
//remove decimal and make positive
n
=
Math
.
abs
(
String
(
n
).
replace
(
"."
,
""
));
if
(
n
==
0
)
{
return
0
;
}
// kill the 0s at the end of n
while
(
n
!=
0
&&
n
%
10
==
0
)
{
n
/=
10
;
}
// get number of digits
return
Math
.
floor
(
Math
.
log
(
n
)
/
Math
.
LN10
)
+
1
;
}
function
setupTickGeneration
(
axis
)
{
function
setupTickGeneration
(
axis
)
{
var
opts
=
axis
.
options
;
var
opts
=
axis
.
options
;
...
@@ -1763,9 +1780,10 @@ Licensed under the MIT license.
...
@@ -1763,9 +1780,10 @@ Licensed under the MIT license.
axis
.
delta
=
delta
;
axis
.
delta
=
delta
;
axis
.
tickDecimals
=
Math
.
max
(
0
,
maxDec
!=
null
?
maxDec
:
dec
);
axis
.
tickDecimals
=
Math
.
max
(
0
,
maxDec
!=
null
?
maxDec
:
dec
);
axis
.
tickSize
=
opts
.
tickSize
||
size
;
axis
.
tickSize
=
opts
.
tickSize
||
size
;
// grafana addition
// grafana addition
if
(
opts
.
tickDecimals
===
null
||
opts
.
tickDecimals
===
undefined
)
{
if
(
opts
.
tickDecimals
===
null
||
opts
.
tickDecimals
===
undefined
)
{
axis
.
scaledDecimals
=
axis
.
tickDecimals
-
Math
.
floor
(
Math
.
log
(
axis
.
tickSize
)
/
Math
.
LN10
);
axis
.
scaledDecimals
=
axis
.
tickDecimals
-
Math
.
ceil
((
1
/
getSignificantDigitCount
(
axis
.
tickSize
))
*
3
);
}
}
// Time mode was moved to a plug-in in 0.8, and since so many people use it
// Time mode was moved to a plug-in in 0.8, and since so many people use it
...
...
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