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
3474ee09
Commit
3474ee09
authored
Apr 04, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix multiple histograms and hit count
parent
802d34ce
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
16 deletions
+33
-16
panels/dashcontrol/module.js
+5
-5
panels/dashcontrol/save.html
+1
-1
panels/histogram/module.js
+27
-10
No files found.
panels/dashcontrol/module.js
View file @
3474ee09
...
...
@@ -13,13 +13,13 @@ angular.module('kibana.dashcontrol', [])
load
:
{
gist
:
true
,
elasticsearch
:
true
,
local
:
true
,
local
:
true
},
hide_control
:
false
,
elasticsearch_size
:
20
,
elasticsearch_saveto
:
$scope
.
config
.
kibana_index
,
temp
:
true
,
temp_ttl
:
'30d'
,
temp_ttl
:
'30d'
}
_
.
defaults
(
$scope
.
panel
,
_d
);
...
...
@@ -27,7 +27,7 @@ angular.module('kibana.dashcontrol', [])
var
_dash
=
{
title
:
""
,
editable
:
true
,
rows
:
[]
,
rows
:
[]
}
$scope
.
init
=
function
()
{
...
...
@@ -69,7 +69,7 @@ angular.module('kibana.dashcontrol', [])
$scope
.
elasticsearch
=
{};
}
$scope
.
export
=
function
()
{
$scope
.
to_file
=
function
()
{
var
blob
=
new
Blob
([
angular
.
toJson
(
$scope
.
dashboards
,
true
)],
{
type
:
"application/json;charset=utf-8"
});
saveAs
(
blob
,
$scope
.
dashboards
.
title
+
"-"
+
new
Date
().
getTime
());
}
...
...
@@ -93,7 +93,7 @@ angular.module('kibana.dashcontrol', [])
type
:
type
,
id
:
id
,
link
:
location
.
href
.
replace
(
location
.
hash
,
""
)
+
"#dashboard/"
+
type
+
"/"
+
id
,
title
:
title
,
title
:
title
};
}
...
...
panels/dashcontrol/save.html
View file @
3474ee09
...
...
@@ -6,7 +6,7 @@
<h5>
Locally
</h5>
<form>
<ul
class=
"nav nav-list"
>
<li><a
ng-show=
"panel.save.local"
ng-click=
"
export
()"
><i
class=
"icon-download"
></i>
Export to File
</a></li>
<li><a
ng-show=
"panel.save.local"
ng-click=
"
to_file
()"
><i
class=
"icon-download"
></i>
Export to File
</a></li>
<li><a
ng-show=
"panel.save.default"
ng-click=
"default()"
><i
class=
"icon-bookmark"
></i>
Set as My Default
</a></li>
<li><a
ng-show=
"panel.save.default"
ng-click=
"purge()"
><i
class=
"icon-ban-circle"
></i>
Clear My Default
</a></li>
</ul>
...
...
panels/histogram/module.js
View file @
3474ee09
...
...
@@ -71,11 +71,13 @@ angular.module('kibana.histogram', [])
// Build the facet part
_
.
each
(
queries
,
function
(
v
)
{
request
=
request
.
facet
(
$scope
.
ejs
.
DateHistogramFacet
(
_
.
indexOf
(
queries
,
v
))
.
facet
(
$scope
.
ejs
.
DateHistogramFacet
(
"chart"
+
_
.
indexOf
(
queries
,
v
))
.
field
(
$scope
.
time
.
field
)
.
interval
(
$scope
.
panel
.
interval
)
.
facetFilter
(
$scope
.
ejs
.
QueryFilter
(
v
))
).
query
(
v
).
size
(
0
)
)
.
facet
(
$scope
.
ejs
.
QueryFacet
(
"query"
+
_
.
indexOf
(
queries
,
v
)).
query
(
v
)
).
size
(
0
)
})
$scope
.
populate_modal
(
request
);
...
...
@@ -93,16 +95,24 @@ angular.module('kibana.histogram', [])
}
if
(
$scope
.
query_id
===
query_id
)
{
$scope
.
hits
+=
results
.
hits
.
total
;
var
i
=
0
;
_
.
each
(
results
.
facets
,
function
(
v
,
k
)
{
// If this isn't a date histogram it must be a QueryFacet, get the
// count and return
if
(
v
.
_type
!==
'date_histogram'
)
{
$scope
.
hits
+=
v
.
count
;
return
}
// Null values at each end of the time range ensure we see entire range
if
(
_
.
isUndefined
(
$scope
.
data
[
k
])
||
_segment
==
0
)
{
if
(
_
.
isUndefined
(
$scope
.
data
[
i
])
||
_segment
==
0
)
{
var
data
=
[[
$scope
.
time
.
from
.
getTime
(),
null
],[
$scope
.
time
.
to
.
getTime
(),
null
]];
}
else
{
var
data
=
$scope
.
data
[
k
].
data
var
data
=
$scope
.
data
[
i
].
data
}
// Assemble segments
var
segment_data
=
[];
_
.
each
(
v
.
entries
,
function
(
v
,
k
)
{
segment_data
.
push
([
v
[
'time'
],
v
[
'count'
]])
...
...
@@ -110,18 +120,20 @@ angular.module('kibana.histogram', [])
data
.
splice
.
apply
(
data
,[
1
,
0
].
concat
(
segment_data
))
// Create the flot series
var
series
=
{
data
:
{
label
:
$scope
.
panel
.
query
[
k
].
label
||
(
parseInt
(
k
)
+
1
),
label
:
$scope
.
panel
.
query
[
i
].
label
||
"query"
+
(
parseInt
(
i
)
+
1
),
data
:
data
,
},
};
if
(
!
(
_
.
isUndefined
(
$scope
.
panel
.
query
[
k
].
color
)))
series
.
data
.
color
=
$scope
.
panel
.
query
[
k
].
color
;
if
(
!
(
_
.
isUndefined
(
$scope
.
panel
.
query
[
i
].
color
)))
series
.
data
.
color
=
$scope
.
panel
.
query
[
i
].
color
;
$scope
.
data
[
k
]
=
series
.
data
$scope
.
data
[
i
]
=
series
.
data
i
++
;
});
eventBus
.
broadcast
(
$scope
.
$id
,
$scope
.
panel
.
group
,
'hits'
,
$scope
.
hits
)
...
...
@@ -205,6 +217,7 @@ angular.module('kibana.histogram', [])
// Populate element. Note that jvectormap appends, does not replace.
scripts
.
wait
(
function
(){
// Populate element
try
{
var
plot
=
$
.
plot
(
elem
,
scope
.
data
,
{
...
...
@@ -244,7 +257,11 @@ angular.module('kibana.histogram', [])
_
.
each
(
plot
.
getData
(),
function
(
series
)
{
scope
.
legend
.
push
(
_
.
pick
(
series
,
'label'
,
'color'
))
})
// Work around for missing legend at initialization
if
(
!
scope
.
$$phase
)
scope
.
$apply
()
}
catch
(
e
)
{
elem
.
text
(
e
)
}
...
...
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