我升级到了最新的Chart.JS版本3.0.2。我在试着绘制一张时间序列图。下面是我的配置:
{
type: 'line',
data: {
datasets: [{
data: dataForChart
}]
},
options: {
scales: {
x: {
type: 'time'
}
}
}
}
我已经像这样导入了模块:
import ChartJS from 'chart.js/auto';
我得到的错误是:
Error: This method is not implemented: either no adapter can be found or an incomplete integration was provided.
对我可能犯的错误有什么建议吗?
下面是一个有问题代码沙箱:https://codesandbox.io/s/throbbing-cdn-j6q2u?file=/src/App.js
发布于 2021-04-09 17:30:55
正如您的错误和文档中所述,您需要使用适配器将日期转换为日期对象,请参阅文档:https://www.chartjs.org/docs/latest/axes/cartesian/time.html#date-adapters
https://stackoverflow.com/questions/67017539
复制相似问题