Skip to content
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

RN0.75.3上yAxis的axisLabel formatter用函数无法显示,之前RN版本是0.64.3可以显示 #131

Open
wszhutianyu opened this issue Oct 12, 2024 · 4 comments

Comments

@wszhutianyu
Copy link

axisLabel: {
  show: true,
  formatter: (value) => {
    return value
  },
},
@wszhutianyu
Copy link
Author

react-native-webview 版本为 13.12.2

@supervons
Copy link
Owner

完整示例请提供一下。

@wszhutianyu
Copy link
Author

{
xAxis: {
type: 'category',
data: ['数据'],
},
toolbox: {
show: false,
},
yAxis: {
type: 'value',
axisLabel: {
show: true,
formatter: value => {
let v = 0
if (value > 0) {
if (value < 1000) {
v = value
} else if (value >= 1000 && value < 1000000) {
v = (value / 1000).toFixed(0) + 'K'
} else {
v = (value / 1000000).toFixed(0) + 'M'
}
} else {
v = value
}
return v
}
},
},
series: [
{
data: [10000, 30000, 500000, 60000],
type: 'bar',
name: 'bar',
}
],
}
option大致是这样的,主要目的是y轴数据太大的时候想转换一下单位

@wszhutianyu
Copy link
Author

{ xAxis: { type: 'category', data: ['数据'], }, toolbox: { show: false, }, yAxis: { type: 'value', axisLabel: { show: true, formatter: value => { let v = 0 if (value > 0) { if (value < 1000) { v = value } else if (value >= 1000 && value < 1000000) { v = (value / 1000).toFixed(0) + 'K' } else { v = (value / 1000000).toFixed(0) + 'M' } } else { v = value } return v } }, }, series: [ { data: [10000, 30000, 500000, 60000], type: 'bar', name: 'bar', } ], } option大致是这样的,主要目的是y轴数据太大的时候想转换一下单位

@supervons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants