-
Notifications
You must be signed in to change notification settings - Fork 19.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: series.label.formatter callback #10248
bug: series.label.formatter callback #10248
Comments
Hi! We've received your issue and please be patient to get responded. 🎉 In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer. Have a nice day! 🍵 |
If you want to get the data of a specific dimension, you can use it as follows, with the doc: series: [
{
type: 'bar',
label: {
show: true,
formatter: '{b}: {@2015}'
}
}] |
I am not only want to get a specific dimension, I want to use a function to transform and calculate it, which is specified in API doc. And it doesn't have the correct behavior. |
Version
4.2.1
Steps to reproduce
https://echarts.baidu.com/examples/editor.html?c=dataset-simple1
option = {
legend: {},
tooltip: {},
dataset: {
dimensions: ['product', '2015', '2016', '2017'],
source: [
{product: 'Matcha Latte', '2015': 43.3, '2016': 85.8, '2017': 93.7},
{product: 'Milk Tea', '2015': 83.1, '2016': 73.4, '2017': 55.1},
{product: 'Cheese Cocoa', '2015': 86.4, '2016': 65.2, '2017': 82.5},
{product: 'Walnut Brownie', '2015': 72.4, '2016': 53.9, '2017': 39.1}
]
},
xAxis: {type: 'category'},
yAxis: {},
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
series: [
{type: 'bar',
encode: {x: 'product', y:'2015'},
label: {
show: true,
formatter: a => JSON.stringify(a.value)
}
}
]
};
猜测问题出在https://github.com/apache/incubator-echarts/blob/master/src/chart/bar/helper.js#L29
参数中缺一个dimIndex的参数,其它图表类型下也存在类似问题,不仅仅是bar
最终参数传递到
https://github.com/apache/incubator-echarts/blob/master/src/model/mixin/dataFormat.js#L87
What is expected?
series.label.formatter = function(params){}
params.value应该是该series对应的列的值
What is actually happening?
params.value获得的是所有列的值的数组
The text was updated successfully, but these errors were encountered: