Skip to content

Commit 4b4606c

Browse files
committed
v0.13.5
1 parent 77383c7 commit 4b4606c

13 files changed

+40
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- __0.13.2__ Add `xKey` and `yKey` to `mixins.XY` and lots of docs updates
88
- __0.13.3__ For `xy`, add given components after generated
99
- __0.13.4__ Clear unset options on set and fix axis layout issue for inverted
10+
- __0.13.5__ Fix bars axis offset issue
1011

1112
# 0.12.0
1213

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "d3.compose",
33
"homepage": "https://github.com/CSNW/d3.compose",
4-
"version": "0.13.4",
4+
"version": "0.13.5",
55
"main": [
66
"./dist/d3.compose.js",
77
"./dist/d3.compose.css"

dist/d3.compose-all.js

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! d3.compose - v0.13.4
1+
/*! d3.compose - v0.13.5
22
* https://github.com/CSNW/d3.compose
33
* License: MIT
44
*/
@@ -22,6 +22,7 @@
2222
each: _.each,
2323
extend: _.extend,
2424
flatten: _.flatten,
25+
find: _.find,
2526
first: function(array, n) {
2627
// Underscore vs. Lo-dash disagree on the implementation for first
2728
// use Underscore's
@@ -4040,6 +4041,10 @@
40404041
mixins.StandardLayer,
40414042
{
40424043
initialize: function() {
4044+
this.on('before:draw', function() {
4045+
this.offset_axis = this.getOffsetAxis();
4046+
}.bind(this));
4047+
40434048
// Use standard series layer for extensibility
40444049
// (dataBind, insert, and events defined in prototype)
40454050
this.standardSeriesLayer('Bars', this.base.append('g').classed('chart-bars', true));
@@ -4068,17 +4073,21 @@
40684073

40694074
// Shift bars slightly to account for axis thickness
40704075
barOffset: function barOffset() {
4071-
var axis = this.getOffsetAxis();
4072-
if (axis) {
4073-
var axis_thickness = parseInt(axis.base.select('.domain').style('stroke-width')) || 0;
4076+
if (this.offset_axis) {
4077+
var axis_thickness = parseInt(this.offset_axis.base.select('.domain').style('stroke-width')) || 0;
40744078
return axis_thickness / 2;
40754079
}
40764080
else {
40774081
return 0;
40784082
}
40794083
},
4084+
40804085
getOffsetAxis: function getOffsetAxis() {
4081-
return this.container && this.container.components()['axis.x'];
4086+
var components = this.container && this.container.components();
4087+
return utils.find(components, function(component, id) {
4088+
if (component.type == 'Axis' && component.position() == 'bottom')
4089+
return component;
4090+
});
40824091
},
40834092

40844093
// Override StandardLayer
@@ -4247,6 +4256,14 @@
42474256
return chart.itemWidth();
42484257
}),
42494258

4259+
getOffsetAxis: function getOffsetAxis() {
4260+
var components = this.container && this.container.components();
4261+
return utils.find(components, function(component, id) {
4262+
if (component.type == 'Axis' && component.position() == 'left')
4263+
return component;
4264+
});
4265+
},
4266+
42504267
onEnter: function onEnter(selection) {
42514268
selection
42524269
.attr('x', this.x0())

dist/d3.compose-all.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/d3.compose-all.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/d3.compose-mixins.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! d3.compose - v0.13.4
1+
/*! d3.compose - v0.13.5
22
* https://github.com/CSNW/d3.compose
33
* License: MIT
44
*/
@@ -22,6 +22,7 @@
2222
each: _.each,
2323
extend: _.extend,
2424
flatten: _.flatten,
25+
find: _.find,
2526
first: function(array, n) {
2627
// Underscore vs. Lo-dash disagree on the implementation for first
2728
// use Underscore's

dist/d3.compose-mixins.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/d3.compose-mixins.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/d3.compose.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! d3.compose - v0.13.4
1+
/*! d3.compose - v0.13.5
22
* https://github.com/CSNW/d3.compose
33
* License: MIT
44
*/

dist/d3.compose.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! d3.compose - v0.13.4
1+
/*! d3.compose - v0.13.5
22
* https://github.com/CSNW/d3.compose
33
* License: MIT
44
*/
@@ -22,6 +22,7 @@
2222
each: _.each,
2323
extend: _.extend,
2424
flatten: _.flatten,
25+
find: _.find,
2526
first: function(array, n) {
2627
// Underscore vs. Lo-dash disagree on the implementation for first
2728
// use Underscore's

0 commit comments

Comments
 (0)