Removed loops to build legend, replaced by adding plot to scope

This commit is contained in:
Rashid Khan
2013-04-09 08:04:29 -07:00
parent ed297092a4
commit 1d51e96ccb
5 changed files with 25 additions and 39 deletions
+3 -8
View File
@@ -147,8 +147,9 @@ angular.module('kibana.hits', [])
// Populate element. Note that jvectormap appends, does not replace.
scripts.wait(function(){
// Populate element
try {
var plot = $.plot(elem, scope.data, {
try {
// Add plot to scope so we can build out own legend
scope.plot = $.plot(elem, scope.data, {
legend: { show: false },
series: {
lines: { show: false, },
@@ -166,12 +167,6 @@ angular.module('kibana.hits', [])
},
colors: ['#EB6841','#00A0B0','#6A4A3C','#EDC951','#CC333F']
})
var i = 0;
_.each(plot.getData(),function(series) {
scope.data[i].color = series.color;
i++;
})
// Work around for missing legend at initialization
if(!scope.$$phase)