-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xuxinyue.xxy
committed
Sep 22, 2023
1 parent
424f9c6
commit 233a3d9
Showing
8 changed files
with
37 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,5 @@ export function AutoMark(): G2Spec { | |
smartColor: true, | ||
}; | ||
} | ||
|
||
AutoMark.skip = true; |
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,10 @@ | ||
import { autolib } from '../../../src/lib'; | ||
import { Auto } from '../../../src'; | ||
|
||
describe('autolib', () => { | ||
it('autolib() should returns expected autolib components.', () => { | ||
expect(autolib()).toEqual({ | ||
'mark.auto': Auto, | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,8 +1,24 @@ | ||
import { Advisor } from '@antv/ava'; | ||
import { AutoMark } from '../spec'; | ||
import { deepMix } from '@antv/util'; | ||
|
||
export const Auto = (options: AutoMark) => { | ||
export const Auto = (options) => { | ||
const chartAdvisor = new Advisor(); | ||
const results = chartAdvisor.advise(options); | ||
return results?.[0].spec; | ||
const { | ||
data, | ||
dataProps, | ||
fields, | ||
smartColor, | ||
options: o, | ||
colorOptions, | ||
...rest | ||
} = options; | ||
const results = chartAdvisor.advise({ | ||
data, | ||
dataProps, | ||
fields, | ||
smartColor, | ||
options: o, | ||
colorOptions, | ||
}); | ||
return deepMix({}, rest, results?.[0].spec); | ||
}; |
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