Dygraph注释

时间:2015-01-10 12:45:44

标签: javascript annotations dygraphs

我会更新我的注释,我成为Javascript字符串的数据。 我从MYSQL数据库中读取了注释,但是我在更新期间传输了将新数据作为javastring进行Chart。

为什么不运行?

var dat = "[{series: 'AKKU [V]', x: Date.parse('2014/07/06 12:58:12'), shortText: 'A', text: 'Akku geladen'}]";  

graphdiv2.setAnnotations(DAT);

此操作。

graphdiv2.setAnnotations([{series: 'AKKU [V]', x: Date.parse('2014/07/06 12:58:12'), shortText: 'A', text: 'Akku geladen'}]);

可以帮助我吗?

这可以用php字符串运行,但我不能使用php字符串。

graphdiv2.setAnnotations([<?php echo $aaa ?>]);  

1 个答案:

答案 0 :(得分:0)

我读取和写入mysql数据库的注释。 这是代码。 我的问题在第一篇博客中。

<?php

包括( “xxx.php”); $ aaa =“[”;

$ annotation_data = mysql_query(“SELECT DATE_FORMAT(xval,'%Y /%m /%d%H:%i:%s')AS xval1,xval,series,shortText,text                         FROM“。$ database_anno。” ORDER BY xval“)或die(mysql_error());

while($ row = mysql_fetch_array($ annotation_data))   {   $ text = str_replace(“\ r \ n”,“
”,$ row ['text']); //eingebauteUmbrücheausbessern

$ aaa =“”。$ aaa。 “{series:'”。$ row [series]。“',x:Date.parse('”。$ row [xval1]。“'),shortText:'”。$ row [shortText]。“',text :'“。$ text。”'},“;

}
$aaa = "" .$aaa. "]";
//echo $aaa; 

&GT;

var dataphp =;