apache / apache/echarts

[Bug] Can't reuse dimension in "encode"

Open
#20,330 3 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.5.1

### Link to Minimal Reproduction

https://codesandbox.io/p/sandbox/loving-franklin-nscx3x?workspaceId=82a1e239-6a5d-480b-ae78-4592614b9767

### Steps to Reproduce

Once the sample loads, you should see X and Y axis, but no line series

### Current Behavior

The following option works fine and renders a straight line:

```javascript
{
dataset: {
source: [
['s1',3,11,14],
['s1',3,11,14]
]
},
xAxis: [
{
type: 'value'
},
],
yAxis: [
{
type: 'value'
},
],
series: [
{
name: 's1',
encode: {
x: 0,
y: 1,
},
seriesLayoutBy: 'row',
type: 'line'
},
]
}
```

But since both rows in the dataset are exactly the same, I tried to simplify it to the following code, which results in the empty grid and no line displayed:

```javascript
{
dataset: {
source: [
['s1',3,11,14]
]
},
xAxis: [
{
type: 'value'
},
],
yAxis: [
{
type: 'value'
},
],
series: [
{
name: 's1',
encode: {
x: 0,
y: 0,
},
seriesLayoutBy: 'row',
type: 'line'
},
]
};
```

### Expected Behavior

I should be able to specify the same dimension for both X and Y in "encode" like this: `encode: {x: 0, y: 0}`

### Environment

```markdown
- OS: MacOS 14.6.1
- Browser: Chrome 128.0.6613.120, FireFox 130.0
- Framework: DFLib - https://github.com/dflib/dflib . DFLib is a Java framework that can generate ECharts JS code. I am working on a new DFLib version that tries to reuse repeating data in the dataset.
```

### Any additional comments?

_No response_

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.