Skip to content

Commit

Permalink
Restore axes labels (#139)
Browse files Browse the repository at this point in the history
* Restore axes legends

* Fix test
  • Loading branch information
barabba9174 authored and harunhasdal committed Oct 26, 2018
1 parent a3ad54c commit 0fc1d48
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions modules/bar-chart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ export default class BarChart extends PureComponent {
.attr('x', 0)
.attr('y',
(yAxisOrientRight)
? -25 + m.right
: 10 - m.left)
? -20 + m.right
: 5 - m.left)
.attr('dy', '.9em')
.style('text-anchor', 'end')
.text(label);
Expand Down
4 changes: 3 additions & 1 deletion modules/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ export const defaultStyles = {
'font-size': '9px'
},
'.axis .label': {
font: '14px arial'
'font-size': '14px',
'font-family': 'dobra-light,Arial,sans-serif',
fill: '#000'
},
'.axis path, .axis line': {
fill: 'none',
Expand Down
4 changes: 2 additions & 2 deletions tests/bar-chart/bar-chart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ describe('BarChart component', () => {
expect(mockRoot.append.calledWith('text')).to.be.true;
expect(mockRoot.attr.calledWith('class', 'label')).to.be.true;
expect(mockRoot.attr.calledWith('x', 0)).to.be.true;
expect(mockRoot.attr.calledWith('y', 10)).to.be.true;
expect(mockRoot.attr.calledWith('y', 5)).to.be.true;
expect(mockRoot.attr.calledWith('dy', '.9em')).to.be.true;
expect(mockRoot.style.calledWith('text-anchor', 'end')).to.be.true;
expect(mockRoot.text.calledWith('Mock Y Label')).to.be.true;
Expand All @@ -578,7 +578,7 @@ describe('BarChart component', () => {
expect(mockRoot.append.calledWith('text')).to.be.true;
expect(mockRoot.attr.calledWith('class', 'label')).to.be.true;
expect(mockRoot.attr.calledWith('x', 0)).to.be.true;
expect(mockRoot.attr.calledWith('y', -25)).to.be.true;
expect(mockRoot.attr.calledWith('y', -20)).to.be.true;
expect(mockRoot.attr.calledWith('dy', '.9em')).to.be.true;
expect(mockRoot.style.calledWith('text-anchor', 'end')).to.be.true;
expect(mockRoot.text.calledWith('Mock Y Label')).to.be.true;
Expand Down

0 comments on commit 0fc1d48

Please sign in to comment.