Skip to content

Commit

Permalink
Merge pull request #6766 from stormpython/backport/6654-4.5
Browse files Browse the repository at this point in the history
Backporting 6654 to 4.5
  • Loading branch information
w33ble committed Apr 5, 2016
2 parents 5412663 + f054795 commit 6ef64bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,20 @@ describe('Vislib Split Function Test Suite', function () {
});

describe('chart title split function', function () {
let visEl;
let newEl;
let fixture;

beforeEach(ngMock.inject(function () {
el.append('div').attr('class', 'x-axis-chart-title');
el.append('div').attr('class', 'y-axis-chart-title');
d3.select('.x-axis-chart-title').call(chartTitleSplit);
d3.select('.y-axis-chart-title').call(chartTitleSplit);
visEl = el.append('div').attr('class', 'vis-wrapper');
visEl.append('div').attr('class', 'x-axis-chart-title');
visEl.append('div').attr('class', 'y-axis-chart-title');
visEl.select('.x-axis-chart-title').call(chartTitleSplit);
visEl.select('.y-axis-chart-title').call(chartTitleSplit);

newEl = d3.select('body').append('div')
.attr('class', 'series')
.datum({ series: []});
.attr('class', 'vis-wrapper')
.datum({ series: [] });

newEl.append('div').attr('class', 'x-axis-chart-title');
newEl.append('div').attr('class', 'y-axis-chart-title');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(function () {
return function ChartTitleSplitFactory() {
var d3 = require('d3');
var $ = require('jquery');

/*
* Adds div DOM elements to either the `.y-axis-chart-title` element or the
Expand All @@ -12,10 +13,10 @@ define(function () {
return function (selection) {
selection.each(function (data) {
var div = d3.select(this);
var parent = $(this).parents('.vis-wrapper');

if (!data.series) {
div.selectAll('.chart-title')
.append('div')
.data(function (d) {
return d.rows ? d.rows : d.columns;
})
Expand All @@ -24,9 +25,9 @@ define(function () {
.attr('class', 'chart-title');

if (data.rows) {
d3.select('.x-axis-chart-title').remove();
parent.find('.x-axis-chart-title').remove();
} else {
d3.select('.y-axis-chart-title').remove();
parent.find('.y-axis-chart-title').remove();
}

return div;
Expand Down

0 comments on commit 6ef64bd

Please sign in to comment.