Getting Unknown type of value in 0,0 while using Google Visuilation Charts

350 views
Skip to first unread message

Kiran Kumar

unread,
Nov 4, 2015, 4:24:38 AM11/4/15
to Google Visualization API
I am using Google charts for the first time so please excuse if this is a dumb question .
I have got this  issue .

I am trying to display OHLC values in Google Visualization candle Stick charts and this is my code

var data_value = [
    {
        "date": "2011-08-01",
        "open": "136.65",
        "high": "136.96",
        "low": "134.15",
        "close": "136.49"
    },
    {
        "date": "2011-08-02",
        "open": "135.26",
        "high": "135.95",
        "low": "131.50",
        "close": "131.85"
    },
    {
        "date": "2011-08-05",
        "open": "132.90",
        "high": "135.27",
        "low": "128.30",
        "close": "135.25"
    }
];

 google.setOnLoadCallback(drawChart);
  function drawChart() {
    var data = google.visualization.arrayToDataTable([
     data_value
    ], true);

    var options = {
      legend:'none'
    };

    var chart = new google.visualization.CandlestickChart(document.getElementById('chart_div'));

    chart.draw(data, options);
  }

I am trying to draw Candlestick Charts using Google Charting API .

I have got OHLC data in an array format as shown

But when i am trying to draw the chart , i am getting the following exception in browser console

Unknown type of value in 0,0

Could you please let me know how to resolve this issue ??

and this is my fiddle

http://jsfiddle.net/8gcr0xe9/4/ 

Daniel LaLiberte

unread,
Nov 4, 2015, 8:22:56 AM11/4/15
to Google Visualization API
Hi Kiran,

You have a couple problems with your data.  First the arrayToDataTable function expects an array of arrays, not an array of objects.   Here is the documentation for this function:  https://developers.google.com/chart/interactive/docs/reference#arraytodatatable

Second, the values are not formatted properly.  Your numbers need to be not in quotes, and your dates need to be either constructed with JavaScript new Date(), or use the string notation in this form: "Date(year, month, day)".  Note the month index is 0-based.  See more about dates and times here: https://developers.google.com/chart/interactive/docs/datesandtimes

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/6da2315d-390a-4d11-af6f-f4847f4e1a7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA
Reply all
Reply to author
Forward
0 new messages