Skip to content
Advertisement

Pass multi-dimension array into Google.visualization.arrayToDataTable

I want to draw a candlestick chart by using Google Chart , i have a multi-array array call chartdata and i failed to pass the multi-array array into google.visualization.arrayToDataTable([chartdata],true) and give errorLast domain does not have enough data columns (missing 3)

it should look like this var data = google.visualization.arrayToDataTable([ ['2022-05-25 12:00',12,864,889,76], ['2022-05-25 13:00',765,45,97,82] ],true);

html

JavaScript

js

JavaScript

Advertisement

Answer

In your script, how about the following modification?

From:

JavaScript

To:

JavaScript
  • In your script, chartdata is the 2-dimensional array. So, I thought that this might be able to be directly used.

Reference:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement