我正在尝试使用具有收集到的3个数据列表的chartjs构建气泡图。
使用以下html代码
var ctx = document.getElementById('chart').getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'bubble',
// The data for our dataset
data: {
datasets: [{
label: 'list1-list2-list3',
backgroundColor: 'rgb(255, 99, 132)',
pointStyle:'circle'
borderColor: 'rgb(255, 99, 132)',
data: {
x: {{list1|safe}},
y: {{list2|safe}},
r: {{list3|safe}}
}
}]
},
// Configuration options go here
options: {}
});
我尝试将这些列表转换为数组,然后使用它,但没有成功。 我得到这个 enter image description here
我想要实现类似enter image description here的目标。请指导,非常感谢。