好
Estor使用Chart JS 2.7,但是Radar图有问题,我传递了一个显示值0.5到5的数据源,并在我的SQL数据库中进行验证,我的参数为4.7 4.6 4.8,但是仅该图它总是向我显示整个值4,4,4,4,4。
有人知道如何更改格式以允许我使用浮点小数输入。
我将不胜感激
我保留当前代码。
<div class="grafico_radar">
<canvas id="Graf0" class="radar"></canvas>
</div>
<!-- SCRIPT RADAR -->
<script>
var Etiqueta4 = <%= Etiquetas4 %>;
var Valor4 = <%= valores4 %>;
var ctx2 = document.getElementById("Graf0").getContext('2d');
Chart.defaults.global.defaultFontFamily = "candara"
Chart.defaults.global.defaultFontSize = 0
var Graf0 = new Chart(ctx2, {
type: 'radar',
responsive: true,
scaleSteps: 4,
scaleStepWidth: 5,
scaleStartValue: 1,
data: {
labels: Etiqueta4,
datasets: [{
backgroundColor: ['rgba(232,95,0,0.4)'],
scaleSteps: 5,
fill: true,
min: 1,
max: 5,
scaleStartValue: 1,
pointRadius: 3,
pointBorderWidth: 3,
pointHoverRadius: 5,
pointBackgroundColor: "#FF4400",
pointBorderColor: ['rgba(255,68,0,0.9)'],
data: Valor4,},
]
},
options: {
legend: {
display: false
},
scale: {
ticks: {
beginAtZero: true,
min: 0.5,
max: 5,
stepSize: 0.5,
},
pointLabels: {
fontSize: 18,
}
},
title: {
display: true,
text: 'EVALUACIÓN DE DESEMPEÑO',
fontSize: 18,
fontFamily: "candara",
},
}
});
</script>