我正在尝试检索Flot图表的数据,但我不知道这个过程是怎么回事。我创建了一个查询,对数据进行分组但不知道如何显示它们。
以下是代码!
<h3 class="box-title">Area Chart</h3>
<div class="box-body">
<div class="chart">
<canvas id="areaChart" style="height:300px"></canvas>
</div>
</div>
<?php
$dataset1 = array();
$sqlbar = mysql_query("SELECT level_apply AS level, COUNT(id) AS 'count' FROM application GROUP BY level");
while($row = mysql_fetch_assoc($sqlbar))
{
$dataset1[] = array (intval($row['level']),intval($row['count']));
}
?>
{{ HTML::script('/admin/assets/js/jquery-2.2.3.min.js') }}
<script>
$(function () {
var dataset1 = <?php echo json_encode($dataset1); ?>;
$.plot($("#areaChart"), [dataset1]); });
</script>
答案 0 :(得分:0)
如果您使用AJAX或将错误附加到问题中会更好,请参阅此https://www.w3schools.com/jquery/jquery_ajax_get_post.asp