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
18276edd
Commit
18276edd
authored
Apr 15, 2013
by
Zachary Tong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor facet counting metric into facet if/else
parent
a16b38a9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
panels/map2/module.js
+8
-11
No files found.
panels/map2/module.js
View file @
18276edd
...
...
@@ -78,6 +78,8 @@ angular.module('kibana.map2', [])
var
request
=
$scope
.
ejs
.
Request
().
indices
(
$scope
.
panel
.
index
);
var
metric
=
'count'
;
//Use a regular term facet if there is no secondary field
if
(
typeof
$scope
.
panel
.
secondaryfield
===
"undefined"
)
{
var
facet
=
$scope
.
ejs
.
TermsFacet
(
'map'
)
...
...
@@ -90,6 +92,8 @@ angular.module('kibana.map2', [])
ejs
.
RangeFilter
(
$scope
.
time
.
field
)
.
from
(
$scope
.
time
.
from
)
.
to
(
$scope
.
time
.
to
))));
metric
=
'count'
;
}
else
{
//otherwise, use term stats
//NOTE: this will break if valueField is a geo_point
...
...
@@ -104,6 +108,8 @@ angular.module('kibana.map2', [])
ejs
.
RangeFilter
(
$scope
.
time
.
field
)
.
from
(
$scope
.
time
.
from
)
.
to
(
$scope
.
time
.
to
))));
metric
=
'total'
;
}
...
...
@@ -122,17 +128,6 @@ angular.module('kibana.map2', [])
_
.
each
(
results
.
facets
.
map
.
terms
,
function
(
v
)
{
var
metric
=
'count'
;
//If it is a Term facet, use count, otherwise use Total
//May retool this to allow users to pick mean/median/etc
if
(
typeof
$scope
.
panel
.
secondaryfield
===
"undefined"
)
{
metric
=
'count'
;
}
else
{
metric
=
'total'
;
}
//FIX THIS
if
(
!
$scope
.
isNumber
(
v
.
term
))
{
$scope
.
data
[
v
.
term
.
toUpperCase
()]
=
v
[
metric
];
...
...
@@ -359,9 +354,11 @@ angular.module('kibana.map2', [])
var
path
=
d3
.
geo
.
path
()
.
projection
(
scope
.
projection
);
console
.
log
(
scope
.
data
);
//Geocoded points are decoded into lonlat
scope
.
points
=
_
.
map
(
scope
.
data
,
function
(
k
,
v
)
{
//console.log(k,v);
var
decoded
=
geohash
.
decode
(
v
);
return
[
decoded
.
longitude
,
decoded
.
latitude
];
});
...
...
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