我通过网络搜索,但找不到任何有用的建议来解决我的问题。我使用chart.js,我想创建一个polararea类型图表。到目前为止一切都那么好,但是当我画它时没有标签。
编辑代码:
HTML
<canvas id="myChart" width="300" height="300"></canvas>
的Javascript
var ctx = document.getElementById("myChart").getContext("2d");
var myChart = new Chart(ctx, {
type: "polarArea",
data: {
labels: ["Vision", "Crossing", "Free Kick", "Short Passing", "Long Passing", "Curve"],
datasets: [{
label: "# of Votes",
data: [99, 90, 99, 99, 89, 99],
backgroundColor: [
"rgba(255, 99, 132, 0.2)",
"rgba(54, 162, 235, 0.2)",
"rgba(255, 206, 86, 0.2)",
"rgba(75, 192, 192, 0.2)",
"rgba(153, 102, 255, 0.2)",
"rgba(255, 159, 64, 0.2)"
],
borderColor: [
"rgba(255,99,132,1)",
"rgba(54, 162, 235, 1)",
"rgba(255, 206, 86, 1)",
"rgba(75, 192, 192, 1)",
"rgba(153, 102, 255, 1)",
"rgba(255, 159, 64, 1)"
],
borderWidth: 1,
hoverBackgroundColor: [
"rgba(25, 99, 132, 0.2)",
"rgba(69, 162, 235, 0.2)",
"rgba(25, 206, 86, 0.2)",
"rgba(20, 192, 192, 0.2)",
"rgba(13, 102, 255, 0.2)",
"rgba(55, 159, 64, 0.2)"
]
}]
},
options: {
legend: {
display: false,
},
scale: {
display: false
},title: {
display: true,
text: "Passing"
},tooltips:{
enabled:true,
},
},
});