javascript - chartjs 上的标签,当屏幕尺寸较小时无法点击
问题描述
我遇到了chartjs的问题,当我的屏幕尺寸较小时,我无法单击标签,可能只是其中一个但不是全部,就像它们被禁用或我不知道一样。
function generatePieChart(data, labels, chartElementId) {
var colors = new Array();
var randomColorFactor = function () {
return Math.round(Math.random() * 255);
};
var randomColor = function (opacity) {
return 'rgba(' + randomColorFactor() + ',' + randomColorFactor() + ',' + randomColorFactor() + ',' + (opacity || '.3') + ')';
};
for (var i = 0; i < labels.length; i++) {
colors.push(randomColor(0.7))
}
var config = {
type: 'pie',
data: {
datasets: [{
data: data,
label: labels,
backgroundColor: colors,
}],
labels: labels
},
options: {
responsive: true
}
};
var ctx = document.getElementById(chartElementId).getContext("2d");
window.myPie = new Chart(ctx, config);
}
解决方案
推荐阅读
- c++ - QSignalSpy:在等待()中崩溃
- c# - 在启动时从存储在数据库中添加自定义声明
- android - 动态添加视图时Android边距不起作用
- c# - 如何在不提取存档的情况下从存档中显示图像
- google-cloud-platform - Google Cloud Scheduler 在 Function 成功时调用 Google Cloud Function(返回 200 状态)仍然获得 500 状态
- r - 创建组并记录延时不大于特定数字(R,Dplyr)的持续时间
- javascript - 是否可以在 Axios 中发布 responseType: 'stream' ?
- r - 在 EC2 上通过 R 连接到 Athena
- c# - 从数据库中获取并分配给变量的值不会跨层保留
- vue.js - 如何在 VueJS 中的 innerHTML 中放置一个组件