mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Merge pull request #4666 from w33ble/fix/pie-all-label
Fix "Count" label on pie charts
This commit is contained in:
commit
649cbfea64
4 changed files with 16 additions and 10 deletions
|
@ -11,7 +11,7 @@ var AggConfigs;
|
|||
var indexPattern;
|
||||
var buildHierarchicalData;
|
||||
|
||||
describe('buildHierarchicalData()', function () {
|
||||
describe('buildHierarchicalData', function () {
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private, $injector) {
|
||||
|
@ -43,14 +43,15 @@ describe('buildHierarchicalData()', function () {
|
|||
|
||||
});
|
||||
|
||||
it('should set the slices with one children with the name _all', function () {
|
||||
it('should set the slices with one child to a consistent label', function () {
|
||||
var checkLabel = 'Count';
|
||||
expect(results).to.have.property('slices');
|
||||
expect(results.slices).to.have.property('children');
|
||||
expect(results.slices.children).to.have.length(1);
|
||||
expect(results.slices.children[0]).to.have.property('name', '_all');
|
||||
expect(results.slices.children[0]).to.have.property('name', checkLabel);
|
||||
expect(results.slices.children[0]).to.have.property('size', 412032);
|
||||
expect(results).to.have.property('names');
|
||||
expect(results.names).to.eql(['_all']);
|
||||
expect(results.names).to.eql([checkLabel]);
|
||||
expect(results).to.have.property('raw');
|
||||
expect(results.raw).to.have.property('rows');
|
||||
expect(results.raw.rows).to.have.length(1);
|
||||
|
|
|
@ -31,6 +31,7 @@ define(function (require) {
|
|||
|
||||
// If buckets is falsy then we should just return the aggs
|
||||
if (!buckets) {
|
||||
var label = 'Count';
|
||||
var value = resp.aggregations
|
||||
&& resp.aggregations[metric.id]
|
||||
&& resp.aggregations[metric.id].value
|
||||
|
@ -38,11 +39,11 @@ define(function (require) {
|
|||
return {
|
||||
hits: resp.hits.total,
|
||||
raw: raw,
|
||||
names: ['_all'],
|
||||
names: [label],
|
||||
tooltipFormatter: tooltipFormatter(raw.columns),
|
||||
slices: {
|
||||
children: [
|
||||
{ name: '_all', size: value }
|
||||
{ name: label, size: value }
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -517,8 +517,12 @@ define(function (require) {
|
|||
var names = [];
|
||||
var self = this;
|
||||
|
||||
_.forEach(array, function (obj) {
|
||||
names.push({ label: obj.name, values: obj, index: index });
|
||||
_.forEach(array, function (obj, i) {
|
||||
names.push({
|
||||
label: obj.name,
|
||||
values: obj,
|
||||
index: index
|
||||
});
|
||||
|
||||
if (obj.children) {
|
||||
var plusIndex = index + 1;
|
||||
|
|
|
@ -167,7 +167,7 @@ define(function (require) {
|
|||
return pointLabel !== label.toString();
|
||||
}
|
||||
|
||||
if (label && label !== '_all') {
|
||||
if (label && label !== 'Count') {
|
||||
d3.select(this).style('cursor', 'pointer');
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ define(function (require) {
|
|||
|
||||
legendDiv.selectAll('li.color').each(function (d) {
|
||||
var label = d.label;
|
||||
if (label !== undefined && label !== '_all') {
|
||||
if (label !== undefined && label !== 'Count') {
|
||||
d3.select(this).call(self.events.addClickEvent());
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue