Skip to content

Commit

Permalink
fix(facet): fixed bug of #361
Browse files Browse the repository at this point in the history
  • Loading branch information
dxq613 committed Jan 16, 2018
1 parent 361422c commit 61e49db
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/chart/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -908,8 +908,8 @@ class View extends Base {
this.clearInner();
this.emit('beforerender');
this.beforeRender();
this.drawComponents();
this.emit('beforepaint');
this.drawComponents();
this.paint();
this.emit('afterpaint');
this.drawCanvas(stopDraw);
Expand Down
4 changes: 2 additions & 2 deletions src/facet/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Base {
style: {
fontSize: 14,
textAlign: 'center',
fill: '#444',
fill: '#666',
fontFamily: Global.fontFamily
}
},
Expand All @@ -82,7 +82,7 @@ class Base {
fontSize: 14,
textAlign: 'center',
rotate: 90,
fill: '#444',
fill: '#666',
fontFamily: Global.fontFamily
}
}
Expand Down
43 changes: 43 additions & 0 deletions test/bugs/issue-361-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// const expect = require('chai').expect;
const G2 = require('../../index');
const diamonds = require('../../demos/data/diamond.json');

describe('#361', () => {
it('facet title error', () => {
const div = document.createElement('div');
document.body.appendChild(div);

const chart = new G2.Chart({
container: div,
width: 500,
height: 540
});

chart.source(diamonds, {
carat: {
sync: true
},
price: {
sync: true
},
cut: {
sync: true
}
});
chart.facet('list', {
fields: [ 'cut' ],
cols: 3, // 超过3个换行
padding: 30,
eachView(view) {
view.point()
.position('carat*price')
.color('cut')
.shape('circle')
.opacity(0.3)
.size(3);
}
});
chart.render();

});
});

0 comments on commit 61e49db

Please sign in to comment.