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
cdcbb872
Commit
cdcbb872
authored
Aug 19, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
options per series is starting to work nicely
parent
04876305
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
11 deletions
+43
-11
src/app/directives/grafanaGraph.js
+14
-6
src/app/panels/graph/module.js
+1
-0
src/app/panels/graph/seriesOverridesCtrl.js
+3
-1
src/app/panels/graph/styleEditor.html
+4
-1
src/test/specs/grafanaGraph-specs.js
+21
-3
No files found.
src/app/directives/grafanaGraph.js
View file @
cdcbb872
...
...
@@ -184,18 +184,26 @@ function (angular, $, kbn, moment, _) {
}
function
applySeriesOverrideOptions
(
series
)
{
series
.
lines
=
{};
series
.
points
=
{};
series
.
bars
=
{};
for
(
var
i
=
0
;
i
<
scope
.
panel
.
seriesOverrides
.
length
;
i
++
)
{
var
override
=
scope
.
panel
.
seriesOverrides
[
i
];
if
(
override
.
alias
===
series
.
info
.
alias
)
{
if
(
!
_
.
isUndefined
(
override
.
fill
))
{
series
.
lines
=
{
fill
:
override
.
fill
===
0
?
0.001
:
override
.
fill
/
10
};
}
if
(
override
.
alias
!==
series
.
info
.
alias
)
{
continue
;
}
if
(
override
.
lines
!==
void
0
)
{
series
.
lines
.
show
=
override
.
lines
;
}
if
(
override
.
points
!==
void
0
)
{
series
.
points
.
show
=
override
.
points
;
}
if
(
override
.
bars
!==
void
0
)
{
series
.
bars
.
show
=
override
.
bars
;
}
if
(
override
.
fill
!==
void
0
)
{
series
.
lines
.
fill
=
translateFillOption
(
override
.
fill
);
}
}
}
function
translateFillOption
(
fill
)
{
return
fill
===
0
?
0.001
:
fill
/
10
;
}
function
shouldDelayDraw
(
panel
)
{
if
(
panel
.
legend
.
rightSide
)
{
return
true
;
...
...
src/app/panels/graph/module.js
View file @
cdcbb872
...
...
@@ -352,6 +352,7 @@ function (angular, app, $, _, kbn, moment, TimeSeries) {
$scope
.
removeSeriesOverride
=
function
(
override
)
{
$scope
.
panel
.
seriesOverrides
=
_
.
without
(
$scope
.
panel
.
seriesOverrides
,
override
);
$scope
.
render
();
};
panelSrv
.
init
(
$scope
);
...
...
src/app/panels/graph/seriesOverridesCtrl.js
View file @
cdcbb872
...
...
@@ -41,6 +41,7 @@ define([
$scope
.
removeOverride
=
function
(
option
)
{
delete
$scope
.
override
[
option
.
propertyName
];
$scope
.
updateCurrentOverrides
();
$scope
.
render
();
};
$scope
.
updateCurrentOverrides
=
function
()
{
...
...
@@ -59,7 +60,8 @@ define([
$scope
.
addOverrideOption
(
'Bars'
,
'bars'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Lines'
,
'lines'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Points'
,
'points'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Line fill'
,
'fill'
,
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
]);
$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
.
updateCurrentOverrides
();
});
...
...
src/app/panels/graph/styleEditor.html
View file @
cdcbb872
...
...
@@ -84,7 +84,10 @@
alias or regex
</li>
<li>
<input
type=
"text"
ng-model=
"override.alias"
class=
"input-medium grafana-target-segment-input"
>
<input
type=
"text"
ng-model=
"override.alias"
ng-model-onblur
ng-change=
"render()"
class=
"input-medium grafana-target-segment-input"
>
</li>
<li
class=
"grafana-target-segment"
ng-repeat=
"option in currentOverrides"
>
<a
class=
"pointer"
ng-click=
"removeOverride(option)"
>
...
...
src/test/specs/grafanaGraph-specs.js
View file @
cdcbb872
...
...
@@ -74,23 +74,41 @@ define([
});
graphScenario
(
'series option
fill override
'
,
function
(
ctx
)
{
graphScenario
(
'series option
overrides, fill & points
'
,
function
(
ctx
)
{
ctx
.
setup
(
function
(
scope
,
data
)
{
scope
.
panel
.
lines
=
true
;
scope
.
panel
.
fill
=
5
;
scope
.
panel
.
seriesOverrides
=
[
{
alias
:
'test'
,
fill
:
0
}
{
alias
:
'test'
,
fill
:
0
,
points
:
true
}
];
data
[
1
].
info
.
alias
=
'test'
;
});
it
(
'should match second series and
set line fill
'
,
function
()
{
it
(
'should match second series and
fill zero, and enable points
'
,
function
()
{
expect
(
ctx
.
plotOptions
.
series
.
lines
.
fill
).
to
.
be
(
0.5
);
expect
(
ctx
.
plotData
[
1
].
lines
.
fill
).
to
.
be
(
0.001
);
expect
(
ctx
.
plotData
[
1
].
points
.
show
).
to
.
be
(
true
);
});
});
graphScenario
(
'series option overrides, bars, true & lines false'
,
function
(
ctx
)
{
ctx
.
setup
(
function
(
scope
,
data
)
{
scope
.
panel
.
lines
=
true
;
scope
.
panel
.
seriesOverrides
=
[
{
alias
:
'test'
,
bars
:
true
,
lines
:
false
}
];
data
[
1
].
info
.
alias
=
'test'
;
});
it
(
'should match second series and disable lines, and enable bars'
,
function
()
{
expect
(
ctx
.
plotOptions
.
series
.
lines
.
show
).
to
.
be
(
true
);
expect
(
ctx
.
plotData
[
1
].
lines
.
show
).
to
.
be
(
false
);
expect
(
ctx
.
plotData
[
1
].
bars
.
show
).
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