2

Am trying to design a candlestick chart with java script,but have an error,can any one help me? and my error is:

Uncaught Error: "candlestick" is not a chart type.

I was watching a video and did all steps but still have the error the video link: 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" />
mplungjan
  • 169,008
  • 28
  • 173
  • 236

0 Answers0