Removed loops to build legend, replaced by adding plot to scope
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
<div ng-show="panel.counters">
|
||||
<p ng-style="panel.style" ng-show="panel.aggregate">{{hits}}</p>
|
||||
<table ng-style="panel.style" ng-show="!panel.aggregate && panel.arrangement == 'vertical'">
|
||||
<tr style="line-height:{{panel.style['font-size']}}" ng-repeat="query in data">
|
||||
<tr style="line-height:{{panel.style['font-size']}}" ng-repeat="query in plot.getData()">
|
||||
<td ng-show="panel.chart" style="background:{{query.color}};width:{{panel.style['font-size']}}"></td> <td style="padding-right:10px;padding-left:10px;">{{query.label}}</td><td>{{query.hits}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div ng-style="panel.style" ng-show="!panel.aggregate && panel.arrangement == 'horizontal'" ng-repeat="query in data" style="float:left;padding-left: 10px;">
|
||||
<div ng-style="panel.style" ng-show="!panel.aggregate && panel.arrangement == 'horizontal'" ng-repeat="query in plot.getData()" style="float:left;padding-left: 10px;">
|
||||
<span ng-show='panel.chart'><div style="display:inline-block;border-radius:{{panel.style['font-size']}};background:{{query.color}};height:{{panel.style['font-size']}};width:{{panel.style['font-size']}}"></div></span> {{query.label}} ({{query.hits}}) <span ng-show="!$last">|</span>
|
||||
</div><br>
|
||||
</div><div style="clear:both"></div>
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user