Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- /**
- * Request data from the server, add it to the graph and set a timeout
- * to request again
- */
- var chart; // global
- function requestData() { //Atualizacao a cada 30 segundos
- $.ajax({
- url: 'simultaneas.php',
- success: function(point) {
- var series = chart.series[0],
- shift = series.data.length > 30; // shift if the series is
- // longer than 20
- // add the point
- var values = eval(point);
- chart.series[0].addPoint(point, true, shift);
- // call it again after one second
- setTimeout(requestData, 30000);
- },
- cache: false
- });
- }
- $(document).ready(function() {
- Highcharts.setOptions({
- global: {
- useUTC: false
- }
- });
- var auto_refresh;
- window.onload = function() {
- funcaoAutoRefresh();
- }
- function funcaoAutoRefresh() { // Atualiza a cada 30 segundos
- $("#telefonia").load("faturamento_dia.php");
- auto_refresh = setTimeout(funcaoAutoRefresh(), 30000);
- }
- chart = new Highcharts.Chart({
- chart: {
- renderTo: 'simultaneas',
- defaultSeriesType: 'spline',
- events: {
- load: requestData
- }
- },
- title: {
- text: 'Chamadas Simultaneas Servidores'
- },
- xAxis: {
- type: 'datetime',
- tickPixelInterval: 150,
- maxZoom: 20 * 1000
- },
- yAxis: {
- minPadding: 0.2,
- maxPadding: 0.2,
- title: {
- text: '',
- margin: 0
- }
- },
- plotOptions: {
- spline: {
- dataLabels: {
- enabled: true
- },
- enableMouseTracking: false
- }
- },
- series: [{
- name: 'Atendidas',
- data: []
- }]
- });
- });
- $(function () { // NAO ATUALIA .. só quando carrega a pagina.
- // Create the first chart
- $('#fatultimosdias').highcharts({
- chart: {
- type: 'column'
- },
- title: {
- text: 'Faturamento Ultimos Dias'
- },
- xAxis: {
- categories: <?php echo json_encode($datetimefatdias, JSON_NUMERIC_CHECK) ?>,
- labels: {
- style: {
- color: 'black',
- fontSize:'19px'
- }
- }
- },
- yAxis: {
- min: 0,
- title: {
- text: 'Venda'
- },
- labels: {
- overflow: 'justify'
- }
- },
- legend: {
- reversed: true
- },
- plotOptions: {
- column: {
- dataLabels: {
- enabled: true
- }
- }
- },
- series: [{
- name: 'Venda ( em R$ )',
- data: <?php echo json_encode($datavenda, JSON_NUMERIC_CHECK) ?>
- },
- {
- name: 'Custo ( em R$ )',
- data: <?php echo json_encode($datacusto, JSON_NUMERIC_CHECK) ?>
- },
- {
- name: 'Revendas ( em R$ )',
- data: <?php echo json_encode($datarevenda, JSON_NUMERIC_CHECK) ?>
- }]
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement