标记注释

Dygraph Annotations

本文关键字:注释      更新时间:2023-09-26

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

为什么这不运行?

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'}]);

能帮我吗?

这运行althoug,带有PHP字符串,但我不能使用PHP字符串。

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

我读取注释并将其写入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 来自".$database_anno"。按 xval 排序")或 die(mysql_error());

while($row = mysql_fetch_array($annotation_data)) { $text = str_replace("''r'", "
", $row['text']); eingebaute Umbrüche ausbessern

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

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

?>

var dataphp = ;