apache / apache/echarts

Series data dont apply on legend but data exist on series and legend.

Open
#20,577 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

The problem is the series set the data and legend set the data but in the end the legend dont show and have an error `Legend data should be same with series name or data name.`

charts varsion: 5.5.1

```js
const option = shallowRef({
legend: {
type: 'scroll',
bottom: '0%',
left: 'center',
},
polar: {
radius: [50, '60%'],
startAngle: 90,
},
angleAxis: {
show: false,
},
radiusAxis: {
show: false,
type: 'category',
},
series: {
name: 'Alarms',
type: 'bar',
roundCap: true,
data: {},
coordinateSystem: 'polar',
label: {
show: false,
},
},
graphic: [
{
type: 'text',
left: 'center',
top: '46%',
style: {
text: 'TOTAL',
textAlign: 'center',
fontSize: 22,
fontWeight: 'normal',
fill: '#6A5ACD',
}
},
{
type: 'text',
left: 'center',
top: '51%',
style: {
text: null,
textAlign: 'center',
fontSize: 22,
fontWeight: 'normal',
fill: '#6A5ACD',
}
}
]
})

onMounted(async () => {
data.value = await fetchData()

const chartData = [
{ name: 'Alarms', value: data.value.alarms, },
{ name: 'Readings', value: data.value.readings, },
{ name: 'Smart', value: data.value.smart, },
]

option.value.series.data = chartData
option.value.legend.data = chartData
option.value.angleAxis.max = data.value.total
option.value.graphic[1].style.text = data.value.total
})
```

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.