Sorry, my mistake.  The string-formatted date doesn't work with addRows()
(though I believe we should make all the various ways of constructing
datatables consistent, so this will probably be fixed in the future).  It
only works with arrayToDataTable or with the DataTable constructor, so you
should either switch to using arrayToDataTable or the DataTable constructor.

Also note, again, that you need to make your month numbers start with 0,
not 1.  November is month number 10.  This is consistent with JavaScript
and several other languages.

On Tue, Oct 31, 2017 at 9:26 AM, rocky <[email protected]> wrote:

> Ok Daniel, I got now:
>
> [[6,"Date(2017, 11, 05)"],[6,"Date(2017, 10, 30)"],[7,"Date(2017, 10, 
> 29)"],[9,"Date(2017, 10, 28)"],[5,"Date(2017, 10, 27)"]]
>
>
> Now is error
>
> Uncaught (in promise) Error: Type mismatch. Value date(2017, 11, 05) does
> not match type date in column index 1.
>
> In html I have:
> function drawChart() {
>
>       var data = new google.visualization.DataTable();
>       data.addColumn('number', 'ph');
>       data.addColumn('date', 'date');  // maybe is here mistake???
>
>        var jsonData = $.ajax({
>         url: "getData2.php",
>         dataType: "json",
>         async: false
>     }).responseText;
>
>     var obj = JSON.parse(jsonData);
>     data.addRows(obj);
>
>
>         var options = {
>           title:'pH vrijednost zadnjih 5 mjerenja',
>
>         width: 1000, height: 300,
>
>         hAxis: {
>           title:'datum'
>         },
>         vAxis: {
>             title: 'pH'
>         },
>         };
>
>
>       var chart = new google.visualization.LineChart(document.
> getElementById('chart_div'));
>       chart.draw(data, options);
>     }
>
> Do I need some hAxis { format:'some rule like Y/mm/dd' ....
>
> --
> 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 [email protected].
> To post to this group, send email to google-visualization-api@
> googlegroups.com.
> Visit this group at https://groups.google.com/
> group/google-visualization-api.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-visualization-api/34918671-8507-415c-95bc-
> e6e290026287%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/34918671-8507-415c-95bc-e6e290026287%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
[email protected] <[email protected]>   5CC, Cambridge MA

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJO9Ya-7KsiT5-5s5NSBeoRyDF5CGB8bCDVzgPH9ew-nZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to