2

正在尝试用java脚本设计烛台图,但有一个错误,谁能帮助我?我的错误是:

未捕获的错误:“烛台”不是图表类型。

我正在观看视频并执行了所有步骤,但视频链接仍有错误: https ://www.youtube.com/watch?v=Pru1dPE0ubI

// setup
const starting = luxon.DateTime.fromRFC2822('01 Aug 2021 00:00 GMT')
const date2 = luxon.DateTime.fromRFC2822('02 Aug 2021 00:00 GMT')
const data = {
  datasets: [{
    data: [{
        x: starting.valueOf(),
        o: 1,
        h: 1.50,
        l: 0.75,
        c: 1.25,
      },
      {
        x: date2.valueOf(),
        o: 1,
        h: 1.50,
        l: 0.50,
        c: 0.90
      }
    ],
  }]
};

// config
const config = {
  type: 'candlestick',
  data,
  options: {}
};

// render init block
const myChart = new Chart(
  document.getElementById('chartBig2'),
  config
);
<script src="https://cdnjs.cloudflare.com/ajax/libs/luxon/2.0.2/luxon.min.js" integrity="sha512-frUCURIeB0OKMPgmDEwT3rC4NH2a4gn06N3Iw6T1z0WfrQZd7gNfJFbHrNsZP38PVXOp6nUiFtBqVvmCj+ARhw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@1.0.0"></script>
<link href="/static/profile/js/financial.js" />

4

0 回答 0