diff --git a/src/kibana/components/vislib/lib/data.js b/src/kibana/components/vislib/lib/data.js index 084f48a6ec9f0..97264e71b43e1 100644 --- a/src/kibana/components/vislib/lib/data.js +++ b/src/kibana/components/vislib/lib/data.js @@ -43,6 +43,7 @@ define(function (require) { if (this.type === 'series') { if (getLabels(data).length === 1 && getLabels(data)[0] === '') { this.labels = [(this.get('yAxisLabel'))]; + this.data.series[0].label = this.get('yAxisLabel'); } else { this.labels = getLabels(data); } diff --git a/src/kibana/components/vislib/visualizations/area_chart.js b/src/kibana/components/vislib/visualizations/area_chart.js index 43448f0c43ea6..8fbab7df26c4c 100644 --- a/src/kibana/components/vislib/visualizations/area_chart.js +++ b/src/kibana/components/vislib/visualizations/area_chart.js @@ -96,11 +96,7 @@ define(function (require) { var path = layer.append('path') .call(this._addIdentifier) .style('fill', function (d) { - var label = d[0].label; - if (!label) { - label = this.getAttribute('data-label'); - } - return color(label); + return color(d[0].label); }) .classed('overlap_area', function () { return isOverlapping; @@ -183,11 +179,7 @@ define(function (require) { .append('circle') .call(this._addIdentifier) .attr('stroke', function strokeColor(d) { - var label = d.label; - if (!label) { - label = this.getAttribute('data-label'); - } - return color(label); + return color(d.label); }) .attr('fill', 'transparent') .attr('stroke-width', circleStrokeWidth); diff --git a/src/kibana/components/vislib/visualizations/column_chart.js b/src/kibana/components/vislib/visualizations/column_chart.js index 04955d36823dc..089f41f32709e 100644 --- a/src/kibana/components/vislib/visualizations/column_chart.js +++ b/src/kibana/components/vislib/visualizations/column_chart.js @@ -73,11 +73,7 @@ define(function (require) { .append('rect') .call(this._addIdentifier) .attr('fill', function (d) { - var label = d.label ; - if (!label) { - label = this.getAttribute('data-label'); - } - return color(label); + return color(d.label); }); self.updateBars(bars); diff --git a/src/kibana/components/vislib/visualizations/line_chart.js b/src/kibana/components/vislib/visualizations/line_chart.js index 203a3ec9d7a84..0639c596b7a6e 100644 --- a/src/kibana/components/vislib/visualizations/line_chart.js +++ b/src/kibana/components/vislib/visualizations/line_chart.js @@ -113,15 +113,7 @@ define(function (require) { } function cColor(d) { - getColor(d, this); - } - - function getColor(d, circleElement) { - var label = d.label; - if (!label) { - label = circleElement.getAttribute('data-label'); - } - return color(label); + return color(d.label); } function colorCircle(d) { @@ -131,7 +123,7 @@ define(function (require) { // If only 1 point exists, show circle if (!showCircles && !isVisible) return 'none'; - return getColor(d, this); + return cColor(d); } function getCircleRadiusFn(modifier) { return function getCircleRadius(d) { @@ -218,11 +210,7 @@ define(function (require) { }) .attr('fill', 'none') .attr('stroke', function lineStroke(d) { - var label = d.label; - if (!label) { - label = this.getAttribute('data-label'); - } - return color(label); + return color(d.label); }) .attr('stroke-width', 2);