2
Hello. I have a chart highcharts and need to enable caption with quantity so that facilitate the visualization at the time of printing because the quantity is only appearing when I hover the mouse over and the quantity does not come out in print.
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src='http://code.highcharts.com/highcharts.js' type='text/javascript'> </script>
<script src='http://code.highcharts.com/modules/exporting.js' type='text/javascript'></script>
</head>
<body>
<?php
require 'conecta.php';
mysql_select_db("asteriskcdrdb", $conLigacoes);
$sql = "select distinct case when (dstchannel like '%claro%') then 'Claro' when (dstchannel like '%Tim%') then 'Tim' when (dstchannel like '%Vivo%') then 'Vivo' when (dstchannel like '%Tim%') then 'Tim' when (dstchannel like '%Oi%') then 'Oi' when (dstchannel like '%Nextel%') then 'Nextel' else 'Outras' end as 'Operadora', count(dstchannel) as Quantidade from cdr where (dstchannel regexp 'claro|Tim|vivo|oi|nextel') and calldate between '".$_POST['DataInicial']."' and '".$_POST['DataFinal']."' group by Operadora";
$result1 = mysql_query($sql);
$data1 = array();
$data2 = array();
while ($row = mysql_fetch_array($result1)) {
$data1 = $row['Operadora'];
$data2 = $row['Quantidade'];
$DadosGrafico[] = "['".$data1."',".$data2."]";
}
?>
<script type="text/javascript">
$(function () {
$('#container').highcharts({
chart: {
type: 'pie',
options3d: {
enabled: true,
alpha: 45,
beta: 0
}
},
title: {
text: 'Relatório de Ligações'
},
subtitle: {
text: ''
},
xAxis: {
categories: ['<?php echo join("','", $data1) ?>'],},
yAxis: {
min: 0,
title: {
text: 'Quantidade'
}
},
legend: {
layout: 'vertical',
backgroundColor: '#FFFFFF',
align: 'left',
verticalAlign: 'top',
x: 50,
y: 35,
floating: true,
shadow: true
},
plotOptions: { column: { pointPadding: 0.2, borderWidth: 0 }},
series: [{ name: 'Quantidade', data: [<?php echo join(',',$DadosGrafico ) ?>],
// pointStart: 0
//pointInterval
}
//
]
});
});
</script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</body>
</html>
Can you post how you are building the chart? Not knowing how you structured your code, it is difficult to provide help.
– bupereira
I’m sorry, but yesterday I stayed know access on a few pages for an internal company problem then. I ended up not posting the code.
– fabricio_wm
@fabricio_wm http://jsfiddle.net/3ea7tbou/ follow the fiddle link from my example.
– William Borba