21,882
社区成员
发帖
与我相关
我的任务
分享
$result = array('date' => array(), 'area' => array(), 'taoshu' => array());
$q2 = "SELECT fang_time, area, taoshu FROM f_chengjiao WHERE city_name='东湖区' ORDER BY fang_time DESC LIMIT 14";
$r2 = mysqli_query ($conn, $q2) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($conn));
while ($row2 = mysqli_fetch_array ($r2, MYSQLI_NUM)) {
$result['date'][] = $row2[0];
$result['area'][] = (float)$row2[1];
$result['taoshu'][] = (int)$row2[2];
<script type="text/javascript">
Highcharts.chart('container', {
chart: {
zoomType: 'xy'
},
title: {
text: '销售统计'
},
subtitle: {
text: '来源:房管局'
},
xAxis: [{
categories:<?php echo json_encode($result['date']) ?>,
crosshair: true
}],
yAxis: [{ // Primary yAxis
labels: {
format: '{value}套',
style: {
color: Highcharts.getOptions().colors[1]
}
},
title: {
text: '成交套数(套)',
style: {
color: Highcharts.getOptions().colors[1]
}
}
}, { // Secondary yAxis
title: {
text: '成交面积',
style: {
color: Highcharts.getOptions().colors[0]
}
},
labels: {
formatter: function() {
return (this.value/10000)+'万' ;
},
style: {
color: Highcharts.getOptions().colors[0]
}
},
opposite: true
}],
credits: {//关闭版权链接
enabled: false
},
tooltip: {
shared: true
},
series: [{
name: '成交面积(m²)',
color: '#4572A7',
type: 'column',
yAxis: 1,
data: <?php echo json_encode($result['area']) ?>,
tooltip: {
valueSuffix: ' 平米'
}
}, {
name: '成交套数(套)',
color: '#e02222',
type: 'spline',
data: <?php echo json_encode($result['taoshu']) ?>,
tooltip: {
valueSuffix: ' 套'
}
}]
});
</script>