Commit 70f6a297 by Rashid Khan

Added missing text panel, added hover to pie and histogram

parent 4b9310ea
...@@ -41,7 +41,8 @@ var dashboards = ...@@ -41,7 +41,8 @@ var dashboards =
span: 3, span: 3,
content : "Panels can send events to other panels. In the case of" + content : "Panels can send events to other panels. In the case of" +
" the sort panel, it also receives a field event that it uses" + " the sort panel, it also receives a field event that it uses" +
" to populate its list of fields from the table panel" " to populate its list of fields from the table panel. The time " +
" selector is a member of two groups."
}, },
] ]
}, },
...@@ -55,10 +56,11 @@ var dashboards = ...@@ -55,10 +56,11 @@ var dashboards =
title : "About", title : "About",
fontsize : "85%", fontsize : "85%",
span: 2, span: 2,
content : "These pies demonstrate configurable binding. They are" + content : "These donut charts demonstrate configurable binding." +
" They exist in a different group from the other panels and are" +
" bound only to the time selector, not to the query input. Thus" + " bound only to the time selector, not to the query input. Thus" +
" they will change when you select a new time range, but not if" + " they will change when you select a new time range, but not if" +
" you enter a search. Try hovering over a pie slice.", " you enter a search.",
}, },
{ {
title : "Hamlet", title : "Hamlet",
...@@ -175,8 +177,8 @@ var dashboards = ...@@ -175,8 +177,8 @@ var dashboards =
title : "Monkey Shakespeare Lines", title : "Monkey Shakespeare Lines",
type : "histogram", type : "histogram",
span : 5, span : 5,
show : ['lines','stack'], show : ['bars','stack'],
fill : 0.3, fill : 1,
query : [ query : [
{ label : "Query Hits", query : "*", color: '#86B32D' }, { label : "Query Hits", query : "*", color: '#86B32D' },
{ label : "Hamlet", query : "play_name:Hamlet" }, { label : "Hamlet", query : "play_name:Hamlet" },
......
...@@ -164,6 +164,33 @@ angular.module('kibana.histogram', []) ...@@ -164,6 +164,33 @@ angular.module('kibana.histogram', [])
} }
}) })
}) })
function tt(x, y, contents) {
var tooltip = $('#pie-tooltip').length ?
$('#pie-tooltip') : $('<div id="pie-tooltip"></div>');
//var tooltip = $('#pie-tooltip')
tooltip.text(contents).css({
position: 'absolute',
top : y + 5,
left : x + 5,
color : "#FFF",
border : '1px solid #FFF',
padding : '2px',
'font-size': '8pt',
'background-color': '#000',
}).appendTo("body");
}
elem.bind("plothover", function (event, pos, item) {
if (item) {
var percent = parseFloat(item.series.percent).toFixed(1) + "%";
tt(pos.pageX, pos.pageY,
item.datapoint[1].toFixed(1) + " @ " +
new Date(item.datapoint[0]).format(config.timeformat));
} else {
$("#pie-tooltip").remove();
}
});
} }
} }
}; };
......
...@@ -191,7 +191,7 @@ angular.module('kibana.pie', []) ...@@ -191,7 +191,7 @@ angular.module('kibana.pie', [])
elem.bind("plothover", function (event, pos, item) { elem.bind("plothover", function (event, pos, item) {
if (item) { if (item) {
var percent = parseFloat(item.series.percent).toFixed(2) + "%"; var percent = parseFloat(item.series.percent).toFixed(1) + "%";
piett(pos.pageX, pos.pageY, percent + " " + item.series.label); piett(pos.pageX, pos.pageY, percent + " " + item.series.label);
} else { } else {
$("#pie-tooltip").remove(); $("#pie-tooltip").remove();
......
<div ng-controller='text'>
<h4 ng-class="{'ng-cloak': !panel.title}">{{panel.title}}</h4>
<p style="font-size:{{panel.fontsize}}">{{panel.content}}</p>
</div>
\ No newline at end of file
angular.module('kibana.text', [])
.controller('text', function($scope, $rootScope) {
var _id = _.uniqueId();
// Set and populate defaults
var _d = {
group : "default",
content : "",
'fontsize': "100%"
}
_.defaults($scope.panel,_d);
$scope.init = function() {
}
$scope.init();
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment