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
062fe720
Commit
062fe720
authored
Aug 19, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More options can now be set on pre series basis, this is awesome!
parent
cdcbb872
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
1 deletions
+45
-1
src/app/directives/grafanaGraph.js
+5
-0
src/app/panels/graph/seriesOverridesCtrl.js
+4
-1
src/test/specs/grafanaGraph-specs.js
+36
-0
No files found.
src/app/directives/grafanaGraph.js
View file @
062fe720
...
@@ -187,6 +187,7 @@ function (angular, $, kbn, moment, _) {
...
@@ -187,6 +187,7 @@ function (angular, $, kbn, moment, _) {
series
.
lines
=
{};
series
.
lines
=
{};
series
.
points
=
{};
series
.
points
=
{};
series
.
bars
=
{};
series
.
bars
=
{};
delete
series
.
stack
;
for
(
var
i
=
0
;
i
<
scope
.
panel
.
seriesOverrides
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
scope
.
panel
.
seriesOverrides
.
length
;
i
++
)
{
var
override
=
scope
.
panel
.
seriesOverrides
[
i
];
var
override
=
scope
.
panel
.
seriesOverrides
[
i
];
...
@@ -197,6 +198,10 @@ function (angular, $, kbn, moment, _) {
...
@@ -197,6 +198,10 @@ function (angular, $, kbn, moment, _) {
if
(
override
.
points
!==
void
0
)
{
series
.
points
.
show
=
override
.
points
;
}
if
(
override
.
points
!==
void
0
)
{
series
.
points
.
show
=
override
.
points
;
}
if
(
override
.
bars
!==
void
0
)
{
series
.
bars
.
show
=
override
.
bars
;
}
if
(
override
.
bars
!==
void
0
)
{
series
.
bars
.
show
=
override
.
bars
;
}
if
(
override
.
fill
!==
void
0
)
{
series
.
lines
.
fill
=
translateFillOption
(
override
.
fill
);
}
if
(
override
.
fill
!==
void
0
)
{
series
.
lines
.
fill
=
translateFillOption
(
override
.
fill
);
}
if
(
override
.
stack
!==
void
0
)
{
series
.
stack
=
override
.
stack
;
}
if
(
override
.
linewidth
!==
void
0
)
{
series
.
lines
.
lineWidth
=
override
.
linewidth
;
}
if
(
override
.
pointradius
!==
void
0
)
{
series
.
points
.
radius
=
override
.
pointradius
;
}
if
(
override
.
steppedLine
!==
void
0
)
{
series
.
lines
.
steps
=
override
.
steppedLine
;
}
}
}
}
}
...
...
src/app/panels/graph/seriesOverridesCtrl.js
View file @
062fe720
...
@@ -59,9 +59,12 @@ define([
...
@@ -59,9 +59,12 @@ define([
$scope
.
addOverrideOption
(
'Bars'
,
'bars'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Bars'
,
'bars'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Lines'
,
'lines'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Lines'
,
'lines'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Points'
,
'points'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Line fill'
,
'fill'
,
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]);
$scope
.
addOverrideOption
(
'Line fill'
,
'fill'
,
[
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
(
'Line width'
,
'linewidth'
,
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]);
$scope
.
addOverrideOption
(
'Staircase line'
,
'steppedLine'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Points'
,
'points'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Points Radius'
,
'pointradius'
,
[
1
,
2
,
3
,
4
,
5
]);
$scope
.
addOverrideOption
(
'Stack'
,
'stack'
,
[
true
,
false
]);
$scope
.
updateCurrentOverrides
();
$scope
.
updateCurrentOverrides
();
});
});
...
...
src/test/specs/grafanaGraph-specs.js
View file @
062fe720
...
@@ -109,6 +109,42 @@ define([
...
@@ -109,6 +109,42 @@ define([
});
});
});
});
graphScenario
(
'series option overrides, linewidth, stack'
,
function
(
ctx
)
{
ctx
.
setup
(
function
(
scope
,
data
)
{
scope
.
panel
.
lines
=
true
;
scope
.
panel
.
stack
=
true
;
scope
.
panel
.
linewidth
=
2
;
scope
.
panel
.
seriesOverrides
=
[
{
alias
:
'test'
,
linewidth
:
5
,
stack
:
false
}
];
data
[
1
].
info
.
alias
=
'test'
;
});
it
(
'should match second series and disable stack, and set lineWidth'
,
function
()
{
expect
(
ctx
.
plotOptions
.
series
.
stack
).
to
.
be
(
true
);
expect
(
ctx
.
plotData
[
1
].
stack
).
to
.
be
(
false
);
expect
(
ctx
.
plotData
[
1
].
lines
.
lineWidth
).
to
.
be
(
5
);
});
});
graphScenario
(
'series option overrides, pointradius, steppedLine'
,
function
(
ctx
)
{
ctx
.
setup
(
function
(
scope
,
data
)
{
scope
.
panel
.
seriesOverrides
=
[
{
alias
:
'test'
,
pointradius
:
5
,
steppedLine
:
true
}
];
data
[
1
].
info
.
alias
=
'test'
;
});
it
(
'should match second series and set pointradius, and set steppedLine'
,
function
()
{
expect
(
ctx
.
plotData
[
1
].
points
.
radius
).
to
.
be
(
5
);
expect
(
ctx
.
plotData
[
1
].
lines
.
steps
).
to
.
be
(
true
);
});
});
});
});
});
});
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