我正在开发javascript高级图表..
现在我想分页以避免拥挤的显示...
请有人帮我分页吧......
我正在制作cakephp 1.3 ..
下面是我在高图栏中显示数据的脚本..
<script type="text/javascript">
$(function() {
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: ''
},
subtitle: {
text: ''
},
xAxis: {
categories: [
<?php if($this->Session->read("SAVING_TYPE")=='Transport'){ ?>
<?php foreach($content as $result) { ?>
'<?php echo $result['origin_city']['origin_pcode']; ?> - <?php echo $result['dest_city']['dest_pcode']; ?>',
<?php } ?>
<?php } elseif ($this->Session->read("SAVING_TYPE")=='CO2') { ?>
<?php foreach($co2cont as $co2result) { ?>
'<?php echo $co2result['origin_city']['origin_pcode']; ?> - <?php echo $co2result['dest_city']['dest_pcode']; ?>',
<?php } } elseif ($this->Session->read("SAVING_TYPE")=='Traveltime') { ?>
<?php foreach($travel as $travelresult) { ?>
'<?php echo $travelresult['origin_city']['origin_pcode']; ?> - <?php echo $travelresult['dest_city']['dest_pcode']; ?>',
<?php } } ?>
],
crosshair: true
},
yAxis: {
min: 0,
title: {
text: null
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y} mm</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
legend: {
layout: 'vertical',
align: 'center',
verticalAlign: 'top',
floating: true,
borderWidth: 1,
width: 100,
height: 100
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true,
format: '{point.y}'
}
}
},
labels:
{
enabled: false
},
series: [{
name: '<?php if($this->Session->read("SAVING_TYPE")=='Transport'){ ?>
<?php echo $result['u_data']['Mode']; } elseif ($this->Session->read("SAVING_TYPE")=='CO2') { ?>
<?php echo $co2result['u_data']['Mode']; } elseif ($this->Session->read("SAVING_TYPE")=='Traveltime') { ?>
<?php echo $travelresult['u_data']['Mode']; } ?> Cost',
data: [
<?php if($this->Session->read("SAVING_TYPE")=='Transport'){ ?>
<?php foreach($content as $result) { ?>
<?php echo $result['u_data']['TotalCost']; ?>, <?php } ?>
<?php } elseif ($this->Session->read("SAVING_TYPE")=='CO2') { ?>
<?php foreach($co2cont as $co2result) { ?>
<?php echo $co2result['u_data']['totalco2_emmission']; ?>,
<?php } } elseif ($this->Session->read("SAVING_TYPE")=='Traveltime') { ?>
<?php foreach($travel as $travelresult) { ?>
<?php echo $travelresult['u_data']['Days']; ?>,
<?php } } ?>
]
}, {
name: 'Road cost',
data: [<?php if($this->Session->read("SAVING_TYPE")=='Transport'){ ?>
<?php foreach($modecost as $charge) { ?>
<?php echo $charge['u_data']['totalcharge']; ?>, <?php } ?>
<?php } elseif ($this->Session->read("SAVING_TYPE")=='CO2') { ?>
<?php foreach($co2modecost as $co2mode) { ?>
<?php echo $co2mode['u_data']['CO2totalcharge']; ?>,
<?php } } elseif ($this->Session->read("SAVING_TYPE")=='Traveltime') { ?>
<?php foreach($travelmodecost as $travelmoderesult) { ?>
<?php echo $travelmoderesult['u_data']['traveldays']; ?>,
<?php } } ?>
]
}]
});
});
</script>
<div id="container" style="min-width:310px; height: 210px; margin: 0 auto"></div>