嗨我正在尝试从mysql数据库中检索数据来创建flot图可以任何人带我完成这个程序或者让我知道该怎么做谢谢
Tom*_*igh 22
你可能想要这样的东西.我没有使用过flot,但我在这里看了一下这个例子.
<?php
//create array of pairs of x and y values
$dataset1 = array();
while ($row = mysql_fetch_assoc()) { //or whatever
$dataset1[] = array( $row['xvalue'], $row['yvalue'] );
}
?>
<script type="text/javascript">
//put array into javascript variable
var dataset1 = <?php echo json_encode($dataset1); ?>;
//plot
$(function () {
$.plot($("#placeholder"), [ dataset1 ]);
});
</script>
Run Code Online (Sandbox Code Playgroud)