使用Vue.js 和Chart.js制作绚丽多彩的图表

2020-06-14 06:02:07易采站长站整理

pointBackgroundColor: 'white',
borderWidth: 1,
pointBorderColor: 'white',
backgroundColor: this.gradient,
data: [40, 39, 10, 40, 39, 80, 40]},{
label: 'Data Two',
borderColor: '#05CBE1',
pointBackgroundColor: 'white',
pointBorderColor: 'white',
borderWidth: 1,
backgroundColor: this.gradient2,
data: [60, 55, 32, 10, 2, 12, 53]}
]}, {responsive: true, maintainAspectRatio: false})
}
})

最后一步

最后一步是给 App.vue 的容器添加一些样式。


.Chart {
background: #212733;
border-radius: 15px;
box-shadow: 0px 2px 15px rgba(25, 25, 25, 0.27);
margin: 25px 0;
}
.Chart h2 {
margin-top: 0;
padding: 15px 0;
color: rgba(255, 0,0, 0.5);
border-bottom: 1px solid #323d54;
}

最终结果

最终结果如图:

英文连接:Creating stunning charts with Vue.js and Chart.js