Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(line): do not set default range as [0, 1] #2007

Merged
merged 2 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __tests__/unit/plots/area/index-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('area', () => {
area.render();

expect(area.chart.getScaleByField('x').type).toBe('cat');
expect(area.chart.getScaleByField('x').range).toEqual([0, 1]);
expect(area.chart.getScaleByField('x').range).toEqual([1 / 8, 7 / 8]);
area.update({
...area.options,
meta: {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/plots/line/index-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('line', () => {
line.render();

expect(line.chart.getScaleByField('x').type).toBe('cat');
expect(line.chart.getScaleByField('x').range).toEqual([0, 1]);
expect(line.chart.getScaleByField('x').range).toEqual([1 / 8, 7 / 8]);
line.update({
meta: {
x: {
Expand Down
1 change: 1 addition & 0 deletions examples/area/basic/demo/basic-gradients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fetch('https://gw.alipayobjects.com/os/bmw-prod/1d565782-dde4-4bb6-8946-ea6a38cc
xField: 'Date',
yField: 'scales',
xAxis: {
range: [0, 1],
tickCount: 5,
},
areaStyle: () => {
Expand Down
1 change: 1 addition & 0 deletions examples/area/basic/demo/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fetch('https://gw.alipayobjects.com/os/bmw-prod/1d565782-dde4-4bb6-8946-ea6a38cc
xField: 'Date',
yField: 'scales',
xAxis: {
range: [0, 1],
tickCount: 5,
},
});
Expand Down
2 changes: 2 additions & 0 deletions src/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const AXIS_META_CONFIG_KEYS = [
'nice',
'minLimit',
'maxLimit',
// 坐标轴的范围
'range',
'tickMethod',
// type: 'log' 的底
'base',
Expand Down
1 change: 0 additions & 1 deletion src/plots/line/adaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export function meta(params: Params<LineOptions>): Params<LineOptions> {
{
[xField]: {
type: 'cat',
range: [0, 1],
},
[yField]: adjustYMetaByZero(data, yField),
}
Expand Down