-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: line,area,radar label style with callback (#3805)
* fix: line,area,radar label style with callback * chore: new version * chore: remove console.log * chore: update node version of ci * chore; update ci workflow
- Loading branch information
Showing
8 changed files
with
74 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { get } from '@antv/util'; | ||
import { Line } from '../../src'; | ||
import { createDiv } from '../utils/dom'; | ||
|
||
describe('#3804', () => { | ||
it('line label style with callback', () => { | ||
const line = new Line(createDiv(), { | ||
width: 400, | ||
height: 300, | ||
autoFit: false, | ||
data: [ | ||
{ year: '1991', value: 3 }, | ||
{ year: '1992', value: 4 }, | ||
{ year: '1993', value: 3.5 }, | ||
{ year: '1994', value: 5 }, | ||
{ year: '1995', value: 4.9 }, | ||
{ year: '1996', value: 6 }, | ||
{ year: '1997', value: 7 }, | ||
{ year: '1998', value: 9 }, | ||
{ year: '1999', value: 13 }, | ||
], | ||
xField: 'year', | ||
yField: 'value', | ||
label: { | ||
fields: ['year', 'value'], | ||
callback: (year, value) => { | ||
return { | ||
style: { | ||
text: value, | ||
fill: value > 10 ? '#f24' : '#000', | ||
}, | ||
}; | ||
}, | ||
}, | ||
}); | ||
line.render(); | ||
const geometry = line.chart.geometries[0]; | ||
expect(get(geometry, ['labelOption', 'fields'])).toEqual(['year', 'value']); | ||
line.destroy(); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export const version = '2.4.31'; | ||
export const version = '2.4.32'; | ||
|
||
// G2 自定义能力透出 | ||
import * as G2 from '@antv/g2'; | ||
|
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