Commit 7137a998 by Torkel Ödegaard

Fix to series toggling bug that caused annotations to be hidden when toggling…

Fix to series toggling bug that caused annotations to be hidden when toggling (hiding) series. Fixes #328
parent 4ce386c6
...@@ -15,6 +15,7 @@ vNext ...@@ -15,6 +15,7 @@ vNext
After an option is changed and a nested template param is also reloaded, if the current value After an option is changed and a nested template param is also reloaded, if the current value
exists after the options are reloaded the current selected value is kept (Closes #447, Closes #412) exists after the options are reloaded the current selected value is kept (Closes #447, Closes #412)
- Legend Current value did not display when value was zero, Fixes #460 - Legend Current value did not display when value was zero, Fixes #460
- Fix to series toggling bug that caused annotations to be hidden when toggling (hiding) series. Fixes #328
# 1.5.4 (2014-05-13) # 1.5.4 (2014-05-13)
### New features and improvements ### New features and improvements
......
...@@ -15,7 +15,7 @@ function (angular, $, kbn, moment, _) { ...@@ -15,7 +15,7 @@ function (angular, $, kbn, moment, _) {
restrict: 'A', restrict: 'A',
template: '<div> </div>', template: '<div> </div>',
link: function(scope, elem) { link: function(scope, elem) {
var data, plot; var data, plot, annotations;
var hiddenData = {}; var hiddenData = {};
scope.$on('refresh',function() { scope.$on('refresh',function() {
...@@ -35,8 +35,9 @@ function (angular, $, kbn, moment, _) { ...@@ -35,8 +35,9 @@ function (angular, $, kbn, moment, _) {
}); });
// Receive render events // Receive render events
scope.$on('render',function(event, d) { scope.$on('render',function(event, renderData) {
data = d || data; data = renderData || data;
annotations = renderData.annotations;
render_panel(); render_panel();
}); });
...@@ -206,13 +207,13 @@ function (angular, $, kbn, moment, _) { ...@@ -206,13 +207,13 @@ function (angular, $, kbn, moment, _) {
} }
function addAnnotations(options) { function addAnnotations(options) {
if(!data.annotations || data.annotations.length === 0) { if(!annotations || annotations.length === 0) {
return; return;
} }
var types = {}; var types = {};
_.each(data.annotations, function(event) { _.each(annotations, function(event) {
if (!types[event.annotation.name]) { if (!types[event.annotation.name]) {
types[event.annotation.name] = { types[event.annotation.name] = {
level: _.keys(types).length + 1, level: _.keys(types).length + 1,
...@@ -235,7 +236,7 @@ function (angular, $, kbn, moment, _) { ...@@ -235,7 +236,7 @@ function (angular, $, kbn, moment, _) {
options.events = { options.events = {
levels: _.keys(types).length + 1, levels: _.keys(types).length + 1,
data: data.annotations, data: annotations,
types: types types: types
}; };
} }
......
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