折线图label因为showSymbol属性设置为false显示不出来bug
设置了折线图 label.show 为true,该折线图就应该显示出来
option ={
"xAxis": {
"show": true,
"name": "",
"type": "category"
},
"yAxis": {
"show": true,
"name": "",
"type": "value"
},
"series": [
{
"type": "line",
"showSymbol": false,
"itemStyle": {
"color": "#4191FA"
},
"lineStyle": {
"color": "#4191FA",
"width": 2,
"type": "solid"
},
"label": {
"show": true,
"fontSize": 12,
"color": "#999999",
"offset": [
0,
0
]
},
"encode": {
"x": "x_idata",
"y": "s_idata"
}
}
],
"dataset": {
"source": [
[
"2010/01/01 00:00:00",
100
],
[
"2010/01/02 00:00:00",
160
],
[
"2010/01/03 00:00:00",
100
],
[
"2010/01/04 00:00:00",
16
],
[
"2010/01/05 00:00:00",
100
],
[
"2010/01/06 00:00:00",
10
]
],
"dimensions": [
"x_idata",
"s_idata"
]
}
}
@shentao1
I checked the code, label is connected with symbol. If showSymbol = false, it won't draw label.
And if you want to show label without symbol, you need to set symbol: 'none' instead of showSymbol: false.

However, when I set symbol: 'none', it still doesn't draw label.
I checked the code again, and found a function symbolNeedsDraw.

so when symbol: 'none' , this function will return false, it won't draw symbol, neither label.
I think maybe the developer doesn't want to show label without symbol, so I'm not sure whether it is a bug or not.
And I tested, if the condition data.getItemVisual(idx, 'symbol') !== 'none' is removed, we can draw the line chart like this.

Hope it helps.
It makes sense to be able to have a label without a symbol, so it's definitely a bug, but this would be a breaking change, is there a long-term plan? Maybe this could be tagged to be implemented for a future major release with a proper CHANGELOG entry.
The case when "showSymbol = false" and "label.show=true" is not handled. So I think we can add a judgment to deal with this case. The way consists of the following steps:
render of line
symbolProto.updateData
We can draw the line chart like this.

Hope it helps.
Most helpful comment
@shentao1



I checked the code, label is connected with symbol. If
showSymbol = false, it won't draw label.And if you want to show label without symbol, you need to set
symbol: 'none'instead ofshowSymbol: false.However, when I set
symbol: 'none', it still doesn't draw label.I checked the code again, and found a function
symbolNeedsDraw.so when
symbol: 'none', this function will return false, it won't draw symbol, neither label.I think maybe the developer doesn't want to show label without symbol, so I'm not sure whether it is a bug or not.
And I tested, if the condition
data.getItemVisual(idx, 'symbol') !== 'none'is removed, we can draw the line chart like this.Hope it helps.