【发布时间】:2021-05-24 08:36:56
【问题描述】:
我目前正在处理仪表板,并试图在很多人中显示分数。
这是我的 chart.js 代码。
<script>
const labels = [
@foreach($all_staff as $staff)
@php
$i++;
@endphp
'{{ $i }}',
@endforeach
];
const data = {
labels: labels,
datasets: [{
label: 'My First dataset',
backgroundColor: 'rgb(255, 99, 132)',
borderColor: 'rgb(255, 99, 132)',
data: [0, 10, 5, 2, 20, 50],
}]
};
// </block:setup>
// <block:config:0>
const config = {
type: 'bar',
data,
options: {indexAxis: 'y',
scaleShowValues: true,
scales: {
xAxes: [{
ticks: {
beginAtZero: true
}
}],
yAxes: [{
stacked: false,
ticks: {
autoSkip: false,
beginAtZero: true,
stepSize: 1,
}
}]
}
}
};
// </block:config>
// === include 'setup' then 'config' above ===
var myChart = new Chart(
document.getElementById('myChart'),
config
);
</script>
现在就像标题所说的那样,它没有显示所有标签: my chart
所以我从这里尝试了修复:https://github.com/chartjs/Chart.js/issues/2801
遗憾的是,这些都不起作用。
任何帮助都会很棒!谢谢大家!
【问题讨论】:
标签: javascript php laravel chart.js