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(axis): only value has scale in cartesian #15998

Merged
merged 5 commits into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 11 additions & 1 deletion src/coord/cartesian/AxisModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import GridModel from './GridModel';
import { AxisBaseModel } from '../AxisBaseModel';
import {OrdinalSortInfo} from '../../util/types';
import { SINGLE_REFERRING } from '../../util/model';

import axisDefault from '../axisDefault';

export type CartesianAxisPosition = 'top' | 'bottom' | 'left' | 'right';

Expand Down Expand Up @@ -57,6 +57,16 @@ export class CartesianAxisModel extends ComponentModel<CartesianAxisOption>
getCoordSysModel(): GridModel {
return this.getReferringComponents('grid', SINGLE_REFERRING).models[0] as GridModel;
}

getNeedCrossZero(): boolean {
const option = this.option;

if (option.type === 'value') {
return !option.scale;
}

return !axisDefault[option.type].scale;
susiwen8 marked this conversation as resolved.
Show resolved Hide resolved
susiwen8 marked this conversation as resolved.
Show resolved Hide resolved
susiwen8 marked this conversation as resolved.
Show resolved Hide resolved
susiwen8 marked this conversation as resolved.
Show resolved Hide resolved
}
}

export interface CartesianAxisModel extends AxisModelCommonMixin<CartesianAxisOption>,
Expand Down
3 changes: 2 additions & 1 deletion test/logScale.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.