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
bf0d87aa
Commit
bf0d87aa
authored
Dec 10, 2019
by
Hendrik van Huyssteen
Committed by
Torkel Ödegaard
Dec 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graph: Add fill gradient option to series override line fill (#20941)
parent
5e34e061
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
1 deletions
+28
-1
public/app/core/specs/time_series.test.ts
+13
-0
public/app/core/time_series2.ts
+13
-0
public/app/plugins/panel/graph/module.ts
+1
-1
public/app/plugins/panel/graph/series_overrides_ctrl.ts
+1
-0
No files found.
public/app/core/specs/time_series.test.ts
View file @
bf0d87aa
...
...
@@ -276,6 +276,19 @@ describe('TimeSeries', () => {
});
});
describe
(
'fillGradient'
,
()
=>
{
beforeEach
(()
=>
{
series
.
alias
=
'test'
;
series
.
applySeriesOverrides
([{
alias
:
'test'
,
fill
:
10
,
fillGradient
:
10
}]);
});
it
(
'should set fillcolor to gradient'
,
()
=>
{
expect
(
series
.
lines
.
fillColor
).
toMatchObject
({
colors
:
[{
opacity
:
0.0
},
{
opacity
:
1
}],
});
});
});
describe
(
'series option overrides, bars, true & lines false'
,
()
=>
{
beforeEach
(()
=>
{
series
.
alias
=
'test'
;
...
...
public/app/core/time_series2.ts
View file @
bf0d87aa
...
...
@@ -19,6 +19,16 @@ function translateFillOption(fill: number) {
return
fill
===
0
?
0.001
:
fill
/
10
;
}
function
getFillGradient
(
amount
:
number
)
{
if
(
!
amount
)
{
return
null
;
}
return
{
colors
:
[{
opacity
:
0.0
},
{
opacity
:
amount
/
10
}],
};
}
/**
* Calculate decimals for legend and update values for each series.
* @param data series data
...
...
@@ -157,6 +167,9 @@ export default class TimeSeries {
if
(
override
.
fill
!==
void
0
)
{
this
.
lines
.
fill
=
translateFillOption
(
override
.
fill
);
}
if
(
override
.
fillGradient
!==
void
0
)
{
this
.
lines
.
fillColor
=
getFillGradient
(
override
.
fillGradient
);
}
if
(
override
.
stack
!==
void
0
)
{
this
.
stack
=
override
.
stack
;
}
...
...
public/app/plugins/panel/graph/module.ts
View file @
bf0d87aa
...
...
@@ -79,7 +79,7 @@ class GraphCtrl extends MetricsPanelCtrl {
lines
:
true
,
// fill factor
fill
:
1
,
// fill
factor
// fill
gradient
fillGradient
:
0
,
// line width in pixels
linewidth
:
1
,
...
...
public/app/plugins/panel/graph/series_overrides_ctrl.ts
View file @
bf0d87aa
...
...
@@ -101,6 +101,7 @@ export function SeriesOverridesCtrl($scope: any, $element: JQuery, popoverSrv: a
$scope
.
addOverrideOption
(
'Bars'
,
'bars'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Lines'
,
'lines'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Line fill'
,
'fill'
,
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]);
$scope
.
addOverrideOption
(
'Fill gradient'
,
'fillGradient'
,
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]);
$scope
.
addOverrideOption
(
'Line width'
,
'linewidth'
,
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]);
$scope
.
addOverrideOption
(
'Null point mode'
,
'nullPointMode'
,
[
'connected'
,
'null'
,
'null as zero'
]);
$scope
.
addOverrideOption
(
'Fill below to'
,
'fillBelowTo'
,
$scope
.
getSeriesNames
());
...
...
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