You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/10/17 00:40:46 UTC
[GitHub] [echarts] 100pah commented on a change in pull request #15851: fix(label): label not show on singleaxis
100pah commented on a change in pull request #15851:
URL: https://github.com/apache/echarts/pull/15851#discussion_r729775267
##########
File path: src/chart/helper/labelHelper.ts
##########
@@ -45,6 +45,10 @@ export function getDefaultLabel(
}
return vals.join(' ');
}
+ else {
+ const rawVal = retrieveRawValue(data, dataIndex, 'value');
Review comment:
@susiwen8 I think it's probably not a good strategy to `retrieveRawValue(data, dataIndex, 'value');` here.
The `option` provided in #15830 is:
```js
option = {
singleAxis: {
type: 'category',
data: ['a', 'b', 'c']
},
series: {
data: [
value: [0, 5]
]
}
}
```
where only the first dimension of data (that is, `0`) is used by the coord sys,
and the second dimension (that is, `5`) is not used by the coord sys.
Consider the data might comes form `series.data` or `dataset.source`,
`!isExtraCoord` means: this is a dimension that used by this series and used by coord sys.
At present the strategy that "find a proper dimension as the default label" is:
only find from the dimensions that are `!isExtraCoord`.
Because if data comes from dataset, `isExtraCoord` dimensions may be used by other series.
But there is another detail in the strategy: it only choose dimensions that are not of type `category` and `time`.
That is why the label did not display in case #15830 , where the only `!isExtraCoord` dimension is a `category` dimension. See https://github.com/apache/echarts/blob/master/src/data/helper/dimensionHelper.ts#L124
I think we could change the strategy in https://github.com/apache/echarts/blob/master/src/data/helper/dimensionHelper.ts#L124 to:
(A) if no `defaultedLabel` selected, use the last `!isExtraCoord` dimension no matter it's `category` or `time`.
(B) if data is from series rather than dataset, do not need to consider `isExtraCoord` when finding `defaultedLabel`.
(A) can solve #15830
(B) might make it better but brings a breaking change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org