gpt4 book ai didi

javascript - 在手机上测试时文本隐藏在图表 js 中

转载 作者:太空宇宙 更新时间:2023-11-04 06:12:15 25 4
gpt4 key购买 nike

Error image is attached

我正在我的应用程序中开发图表,它在网络浏览器中工作正常,但当我测试更改时,在手机上进行 UAT 测试,然后在 galaxy S5 手机上隐藏文本。

如果你需要我这边的任何其他东西,请告诉我,因为我被困在这里了。

function dashboardPieChart() {
Highcharts.chart('dashboardPieChart', {
colors: [
'#cff484',
'#4c89d3',
'#8bbc21',
'#910000',
'#1aadce',
'#492970',
'#f28f43',
'#77a1e5',
'#c42525',
'#a6c96a'
],

chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'

},
title: {
text: 'Wallet Balance'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: false,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name} RM {point.y:.2f}</b>',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || '#4c651e'
}


}

}
},

credits: {
enabled: false
},
series: [
{
name: 'Balance',
colorByPoint: true,
data: [
{
name: 'Balance',
y: Number($scope.currentBalance.replace(',', '')),
sliced: true,
selected: true

},
{
name: 'Market Cap',
y: 10000 - Number($scope.currentBalance.replace(',', '')),
sliced: true,
selected: true
}
]
}
]
});
}

来自 HTML 页面的代码就像 b

  <div class="col-lg-6">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-12">
<div id="dashboardPieChart">
<!-- style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"> -->
</div>
</div>
</div>
</div>
</div>
</div>

最佳答案

我认为这是因为您的屏幕宽度太小,无法正确显示 2 个文本。

因此您可以在 plotOptions.pie.dataLabels.style 中添加选项:textOverflow: 'none'

所以你的 plotOptions 变成:

        plotOptions: {
pie: {
allowPointSelect: false,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name} RM {point.y:.2f}</b>',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || '#4c651e',
textOverflow: 'none'
}


}

}
},

这是一个工作示例: https://jsfiddle.net/noswx17b/1/

关于javascript - 在手机上测试时文本隐藏在图表 js 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56326592/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com