mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Merge branch 'master' of github.com:elasticsearch/kibana
This commit is contained in:
commit
52c0767ae8
7 changed files with 86 additions and 12 deletions
|
@ -91,7 +91,7 @@ define(function (require) {
|
|||
}
|
||||
|
||||
if (obj.splits) {
|
||||
d3.select(this.el).select('.' + obj.class).call(obj.splits);
|
||||
d3.select(this.el).select('.' + obj.class).call(obj.splits, obj.parent);
|
||||
}
|
||||
|
||||
if (obj.children) {
|
||||
|
|
|
@ -9,7 +9,7 @@ define(function () {
|
|||
* if not data.rows or data.columns, return no chart titles
|
||||
*/
|
||||
|
||||
return function (selection) {
|
||||
return function (selection, parent) {
|
||||
selection.each(function (data) {
|
||||
var div = d3.select(this);
|
||||
|
||||
|
@ -24,9 +24,9 @@ define(function () {
|
|||
.attr('class', 'chart-title');
|
||||
|
||||
if (data.rows) {
|
||||
d3.select('.x-axis-chart-title').remove();
|
||||
d3.select(parent).select('.x-axis-chart-title').remove();
|
||||
} else {
|
||||
d3.select('.y-axis-chart-title').remove();
|
||||
d3.select(parent).select('.y-axis-chart-title').remove();
|
||||
}
|
||||
|
||||
return div;
|
||||
|
|
|
@ -208,10 +208,10 @@ define(function (require) {
|
|||
selection.each(function () {
|
||||
axis = d3.select(this);
|
||||
labels = axis.selectAll('.tick text');
|
||||
if (!ordered || ordered === undefined) {
|
||||
axis.call(self.rotateAxisLabels());
|
||||
} else {
|
||||
if (ordered && ordered.date) {
|
||||
axis.call(self.filterAxisLabels());
|
||||
} else {
|
||||
axis.call(self.rotateAxisLabels());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -164,6 +164,7 @@
|
|||
min-height: 15px;
|
||||
max-height: 15px;
|
||||
min-width: 20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.x-axis-div {
|
||||
|
|
|
@ -7,7 +7,7 @@ define(function (require) {
|
|||
|
||||
$('body').append('<div class=visualize-chart></div>');
|
||||
|
||||
var $el = $('.visualize-chart');
|
||||
var $el = $('.visualize-chart:last');
|
||||
|
||||
$el.width(1024);
|
||||
$el.height(300);
|
||||
|
|
|
@ -7,24 +7,24 @@ define(function (require) {
|
|||
// Data
|
||||
var series = require('vislib_fixtures/mock_data/date_histogram/_series');
|
||||
var termsColumns = require('vislib_fixtures/mock_data/terms/_columns');
|
||||
var histogramRows = require('vislib_fixtures/mock_data/histogram/_rows');
|
||||
//var histogramRows = require('vislib_fixtures/mock_data/histogram/_rows');
|
||||
var stackedSeries = require('vislib_fixtures/mock_data/date_histogram/_stacked_series');
|
||||
var dataArray = [
|
||||
series,
|
||||
termsColumns,
|
||||
histogramRows,
|
||||
//histogramRows,
|
||||
stackedSeries
|
||||
];
|
||||
var names = [
|
||||
'series',
|
||||
'terms columns',
|
||||
'histogram rows',
|
||||
//'histogram rows',
|
||||
'stackedSeries'
|
||||
];
|
||||
var modes = [
|
||||
'stacked',
|
||||
'grouped',
|
||||
'percentage',
|
||||
//'percentage',
|
||||
'stacked'
|
||||
];
|
||||
|
||||
|
|
|
@ -47,6 +47,79 @@ define(function (require) {
|
|||
120
|
||||
];
|
||||
|
||||
describe('No global chart settings', function () {
|
||||
var visLibParams1 = {
|
||||
el: '<div class=chart1></div>',
|
||||
type: 'pie',
|
||||
addLegend: true,
|
||||
addTooltip: true
|
||||
};
|
||||
var visLibParams2 = {
|
||||
el: '<div class=chart2></div>',
|
||||
type: 'pie',
|
||||
addLegend: true,
|
||||
addTooltip: true
|
||||
};
|
||||
var chart1;
|
||||
var chart2;
|
||||
var Vis;
|
||||
var indexPattern;
|
||||
var buildHierarchicalData;
|
||||
var data1;
|
||||
var data2;
|
||||
|
||||
beforeEach(function () {
|
||||
module('PieChartFactory');
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
inject(function (d3, Private) {
|
||||
chart1 = Private(require('vislib_fixtures/_vis_fixture'))(visLibParams1);
|
||||
chart2 = Private(require('vislib_fixtures/_vis_fixture'))(visLibParams2);
|
||||
Vis = Private(require('components/vis/vis'));
|
||||
indexPattern = Private(require('fixtures/stubbed_logstash_index_pattern'));
|
||||
buildHierarchicalData = Private(require('components/agg_response/hierarchical/build_hierarchical_data'));
|
||||
require('css!components/vislib/styles/main');
|
||||
|
||||
var id_1 = 1;
|
||||
var id_2 = 1;
|
||||
var stubVis1 = new Vis(indexPattern, {
|
||||
type: 'pie',
|
||||
aggs: rowAgg
|
||||
});
|
||||
var stubVis2 = new Vis(indexPattern, {
|
||||
type: 'pie',
|
||||
aggs: colAgg
|
||||
});
|
||||
|
||||
// We need to set the aggs to a known value.
|
||||
_.each(stubVis1.aggs, function (agg) {
|
||||
agg.id = 'agg_' + id_1++;
|
||||
});
|
||||
_.each(stubVis2.aggs, function (agg) {
|
||||
agg.id = 'agg_' + id_2++;
|
||||
});
|
||||
|
||||
data1 = buildHierarchicalData(stubVis1, fixtures.threeTermBuckets);
|
||||
data2 = buildHierarchicalData(stubVis2, fixtures.threeTermBuckets);
|
||||
|
||||
chart1.render(data1);
|
||||
chart2.render(data2);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
$('.visualize-chart').remove();
|
||||
chart1 = null;
|
||||
chart2 = null;
|
||||
});
|
||||
|
||||
it('should render chart titles for all charts', function () {
|
||||
expect($(chart1.el).find('.y-axis-chart-title').length).to.be(1);
|
||||
expect($(chart2.el).find('.x-axis-chart-title').length).to.be(1);
|
||||
});
|
||||
});
|
||||
|
||||
aggArray.forEach(function (dataAgg, i) {
|
||||
describe('Vislib PieChart Class Test Suite for ' + names[i] + ' data', function () {
|
||||
var visLibParams = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue