Skip to content

Commit

Permalink
removing seriesLabel from constructor function and keeping it as a va…
Browse files Browse the repository at this point in the history
…riable in the isLegendShown function
  • Loading branch information
stormpython committed Oct 28, 2014
1 parent abfeb41 commit a99967b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/kibana/components/vislib/lib/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ define(function (require) {

this.data = data;
this._normalizeOrdered();
this.seriesLabel;

this._attr = _.defaults(attr || {}, {

Expand Down Expand Up @@ -93,18 +92,19 @@ define(function (require) {
var isLegend = false;
var visData = this.getVisData();
var sameSeriesLabel = true;
var seriesLabel;

_.forEach(visData, function countSeriesLength(obj) {
var rootSeries = obj.series || (obj.slices && obj.slices.children);
var dataLength = rootSeries ? rootSeries.length : 0;
var label = dataLength === 1 ? rootSeries[0].label || rootSeries[0].name : undefined;
var children = (obj.slices && obj.slices.children && obj.slices.children[0].children);

if (!this.seriesLabel) {
this.seriesLabel = label;
if (!seriesLabel) {
seriesLabel = label;
}

if (this.seriesLabel !== label) {
if (seriesLabel !== label) {
sameSeriesLabel = false;
}

Expand Down

0 comments on commit a99967b

Please sign in to comment.