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
b01df5c2
Commit
b01df5c2
authored
Apr 04, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #29 from rashidkpc/master
Add hit counters to histogram
parents
3474ee09
66680457
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
panels/histogram/module.html
+3
-2
panels/histogram/module.js
+8
-4
No files found.
panels/histogram/module.html
View file @
b01df5c2
...
@@ -9,8 +9,8 @@
...
@@ -9,8 +9,8 @@
<div>
<div>
<span
ng-repeat=
'series in legend'
style=
'display:inline-block;padding-right:5px'
>
<span
ng-repeat=
'series in legend'
style=
'display:inline-block;padding-right:5px'
>
<div
style=
"display:inline-block;background:{{series.color}};height:10px;width:10px"
></div>
<div
style=
"display:inline-block;background:{{series.color}};height:10px;width:10px"
></div>
<div
class=
'small'
style=
'display:inline-block'
>
{{series.label}}
/ {{panel.interval}}
</div>
<div
class=
'small'
style=
'display:inline-block'
>
{{series.label}}
({{series.hits}})
</div>
</span>
</span>
<span
class=
"small"
>
per
<strong>
{{panel.interval}}
</strong>
| (
<strong>
{{hits}}
</strong>
total)
</span>
</div>
</div>
<div
histogram
params=
"{{panel}}"
style=
"height:{{panel.height || row.height}};position:relative"
></div>
<div
histogram
params=
"{{panel}}"
style=
"height:{{panel.height || row.height}};position:relative"
></div>
</kibana-panel>
</kibana-panel>
\ No newline at end of file
panels/histogram/module.js
View file @
b01df5c2
...
@@ -75,8 +75,6 @@ angular.module('kibana.histogram', [])
...
@@ -75,8 +75,6 @@ angular.module('kibana.histogram', [])
.
field
(
$scope
.
time
.
field
)
.
field
(
$scope
.
time
.
field
)
.
interval
(
$scope
.
panel
.
interval
)
.
interval
(
$scope
.
panel
.
interval
)
.
facetFilter
(
$scope
.
ejs
.
QueryFilter
(
v
))
.
facetFilter
(
$scope
.
ejs
.
QueryFilter
(
v
))
)
.
facet
(
$scope
.
ejs
.
QueryFacet
(
"query"
+
_
.
indexOf
(
queries
,
v
)).
query
(
v
)
).
size
(
0
)
).
size
(
0
)
})
})
...
@@ -101,30 +99,36 @@ angular.module('kibana.histogram', [])
...
@@ -101,30 +99,36 @@ angular.module('kibana.histogram', [])
// If this isn't a date histogram it must be a QueryFacet, get the
// If this isn't a date histogram it must be a QueryFacet, get the
// count and return
// count and return
if
(
v
.
_type
!==
'date_histogram'
)
{
if
(
v
.
_type
!==
'date_histogram'
)
{
$scope
.
hits
+=
v
.
count
;
//
$scope.hits += v.count;
return
return
}
}
// Null values at each end of the time range ensure we see entire range
// Null values at each end of the time range ensure we see entire range
if
(
_
.
isUndefined
(
$scope
.
data
[
i
])
||
_segment
==
0
)
{
if
(
_
.
isUndefined
(
$scope
.
data
[
i
])
||
_segment
==
0
)
{
var
data
=
[[
$scope
.
time
.
from
.
getTime
(),
null
],[
$scope
.
time
.
to
.
getTime
(),
null
]];
var
data
=
[[
$scope
.
time
.
from
.
getTime
(),
null
],[
$scope
.
time
.
to
.
getTime
(),
null
]];
var
hits
=
0
;
}
else
{
}
else
{
var
data
=
$scope
.
data
[
i
].
data
var
data
=
$scope
.
data
[
i
].
data
var
hits
=
$scope
.
data
[
i
].
hits
}
}
// Assemble segments
// Assemble segments
var
segment_data
=
[];
var
segment_data
=
[];
_
.
each
(
v
.
entries
,
function
(
v
,
k
)
{
_
.
each
(
v
.
entries
,
function
(
v
,
k
)
{
segment_data
.
push
([
v
[
'time'
],
v
[
'count'
]])
segment_data
.
push
([
v
[
'time'
],
v
[
'count'
]])
hits
+=
v
[
'count'
];
$scope
.
hits
+=
v
[
'count'
];
});
});
data
.
splice
.
apply
(
data
,[
1
,
0
].
concat
(
segment_data
))
data
.
splice
.
apply
(
data
,[
1
,
0
].
concat
(
segment_data
))
// Create the flot series
// Create the flot series
var
series
=
{
var
series
=
{
data
:
{
data
:
{
label
:
$scope
.
panel
.
query
[
i
].
label
||
"query"
+
(
parseInt
(
i
)
+
1
),
label
:
$scope
.
panel
.
query
[
i
].
label
||
"query"
+
(
parseInt
(
i
)
+
1
),
data
:
data
,
data
:
data
,
hits
:
hits
},
},
};
};
...
@@ -255,7 +259,7 @@ angular.module('kibana.histogram', [])
...
@@ -255,7 +259,7 @@ angular.module('kibana.histogram', [])
scope
.
legend
=
[];
scope
.
legend
=
[];
_
.
each
(
plot
.
getData
(),
function
(
series
)
{
_
.
each
(
plot
.
getData
(),
function
(
series
)
{
scope
.
legend
.
push
(
_
.
pick
(
series
,
'label'
,
'color'
))
scope
.
legend
.
push
(
_
.
pick
(
series
,
'label'
,
'color'
,
'hits'
))
})
})
// Work around for missing legend at initialization
// Work around for missing legend at initialization
...
...
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