我正在尝试将库图表-图表-错误条(https://github.com/sgratzl/chartjs-chart-error-bars)包含在我在Vue中构建的应用程序中(Clean,只为测试库而创建),但是当我尝试添加带有"barWithErrorBars“类型的图形时,我会得到提到的错误。
该项目是通过以下方式创建的:
npm install -g @vue/cli-init
vue init webpack my-project我的package.json中有以下几个版本:
这是我的组成部分:
<template>
<canvas id="canvas"></canvas>
</template>
<script>
import Chart from 'chart.js'
export default {
name: 'ErrorBar',
mounted () {
let chart = new Chart(document.getElementById('canvas').getContext('2d'), {
type: 'barWithErrorBars',
data: {
labels: ['A', 'B'],
datasets: [
{
data: [
{
y: 4,
yMin: 1,
yMax: 6
},
{
y: 2,
yMin: 1,
yMax: 4
}
]
}
]
},
options: {
scales: {
yAxes: [
{
ticks: {
beginAtZero: true
}
}
]
}
}
})
return chart
}
}
</script>
<style scoped>
canvas {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
</style>发布于 2020-11-18 02:32:53
https://stackoverflow.com/questions/64885472
复制相似问题