apache / apache/echarts

[Bug] cannot use `scale` property with `type: 'log'`

Open
#19,073 5 comments 0 reactions 0 assignees View on GitHub
bug en pending
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.4.3

### Link to Minimal Reproduction

https://codesandbox.io/s/vigilant-sun-gcv5ph?file=/src/App.tsx

### Steps to Reproduce

1. set `type: 'log'` and `scale: true` in y axis object
```ts
yAxis: { type: 'log', scale: true }
```
2. I got the following error

```
Type '{ type: "log"; scale: true; }' is not assignable to type 'YAXisOption | YAXisOption[]'.
Object literal may only specify known properties, and 'scale' does not exist in type '(AxisBaseOptionCommon & { gridIndex?: number; gridId?: string; position?: CartesianAxisPosition; offset?: number; categorySortInfo?: OrdinalSortInfo; } & { ...; }) | (LogAxisBaseOption & ... 1 more ... & { ...; })'.

echarts.d.ts(10909, 5): The expected type comes from property 'yAxis' which is declared here on type 'EChartsOption'
```

### Current Behavior

I get a type error in Typescript

### Expected Behavior

If [the scale doc](https://echarts.apache.org/en/option.html#xAxis.scale) is correct, it should not throw errors

> It is available only in numerical axis, i.e., [type](https://echarts.apache.org/en/option.html#xAxis.type): 'value'.

I think `type : 'log'` is also numerical axis

### Environment

```markdown
- OS: macOS
- Browser: Chrome
- Framework: React, Typescript
```

### Any additional comments?

If this error is expected, the doc should be fixed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.