100pah commented on a change in pull request #11973: fix bug #11528 Modify
default value of tooltip and label
URL:
https://github.com/apache/incubator-echarts/pull/11973#discussion_r363178407
##########
File path: src/chart/helper/labelHelper.js
##########
@@ -25,7 +25,8 @@ import {retrieveRawValue} from
'../../data/helper/dataProvider';
* @return {string} label string. Not null/undefined
*/
export function getDefaultLabel(data, dataIndex) {
- var labelDims = data.mapDimension('defaultedLabel', true);
+ var dataDimsLen = data.dimensions.length;
+ var labelDims = data.mapDimension(dataDimsLen > 2 ?
data.dimensions[dataDimsLen - 1] : 'defaultedLabel', true);
Review comment:
@pissang
> In the dataset case. encode is a necessary configuration.
`encode` is not necessary in `dataset` case.
```js
option = {
xAxis: {},
yAxis: {},
dataset: {
source: [
// series0x series0y series1x series1y series2x series2y
[11, 22, 33, 99, 33,
91 ],
[121, 62, 93, 99, 83,
91 ],
[16, 52, 33, 99, 33,
91 ],
]
},
series: [{
type: 'scatter'
}, {
type: 'scatter'
}, {
type: 'scatter'
}]
};
```
is a common usage.
A possible way for this issue could be:
when we guessing which dimension can be the "default label", we detect that
if the data is from dataset, use the current way, otherwise, if the data is
from series itself (that means the data will not shared by other series), use
the laster dimension as the label.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]