我是 chart.js 的新手,我正在尝试设置一个水平条形图,在 x 和 y 轴上都有类别。我已经让轴正确显示,但没有显示任何数据。
我尝试切换到折线图,同时试图找出我出错的地方,并且数据在折线图上显示得很好。我可以不使用带有水平条形图的两个类别轴吗?还是我做错了什么?
这是我必须设置图表的内容:
var config = {
type: 'horizontalBar',
data: {
yLabels: ["Individual Thinking", "Individual Feeling", "Individual Doing",
"Partner Thinking", "Partner Feeling", "Partner Doing",
"Team Thinking", "Team Feeling", "Team Doing",
"Cultural Thinking", "Cultural Feeling", "Cultural Doing"],
xLabels: ["","No Complexity","","Below Average","","","Average","Above Average","Highly Focused", "", "", "", "", "Extraordinarily Focused"],
datasets: [{
data: ["No Complexity","No Complexity","No Complexity","No Complexity",
"No Complexity","No Complexity","No Complexity","No Complexity",
"No Complexity","No Complexity","No Complexity","No Complexity"]
}]
},
options: {
responsive: true,
title: {
display: false,
},
scales: {
xAxes: [{
type: 'category',
display: true,
scaleLabel: {
display: true,
labelString: 'Complexity'
}
}],
yAxes: [{
type: 'category',
position: 'left',
display: true,
scaleLabel: {
display: false
}
}]
}
}
};
这里的结果是什么样子。
梦里花落0921
相关分类