-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Guide component add limitInPlot property to limit guide draw in…
… chart plot area. Closed #203
- Loading branch information
Showing
10 changed files
with
93 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const expect = require('chai').expect; | ||
const F2 = require('../../src/core'); | ||
require('../../src/geom/line'); | ||
require('../../src/component/guide/text'); // 加载 guide 组件 | ||
const Guide = require('../../src/plugin/guide'); | ||
|
||
const canvas = document.createElement('canvas'); | ||
canvas.width = 500; | ||
canvas.height = 500; | ||
canvas.id = 'issue203'; | ||
document.body.appendChild(canvas); | ||
|
||
describe('issue 203', () => { | ||
it('set guide limit in plot', () => { | ||
const data = [ | ||
{ day: '周一', value: 300 }, | ||
{ day: '周二', value: 400 }, | ||
{ day: '周三', value: 350 }, | ||
{ day: '周四', value: 500 }, | ||
{ day: '周五', value: 490 }, | ||
{ day: '周六', value: 600 }, | ||
{ day: '周日', value: 900 } | ||
]; | ||
const chart = new F2.Chart({ | ||
id: 'issue203', | ||
pixelRatio: window.devicePixelRatio, | ||
plugins: Guide | ||
}); | ||
|
||
chart.source(data, { | ||
value: { | ||
tickCount: 5, | ||
min: 0 | ||
}, | ||
day: { | ||
range: [ 0, 1 ] | ||
} | ||
}); | ||
chart.guide().text({ | ||
position: [ -0.4, 300 ], | ||
content: '旋转跳跃', | ||
top: false, | ||
limitInPlot: true | ||
}); | ||
chart.line().position('day*value'); | ||
chart.render(); | ||
|
||
const guideController = chart.get('guideController'); | ||
expect(guideController.backPlot.get('children').length).to.equal(0); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters