2014-11-18 1 views
0

하이 차트로 실시간 데이터를 만들려고하는데 다음 문서에 익숙하지 않고 이해할 수 없습니다. 해결책으로 ajax refresh를 사용하고 있습니다. 페이지 처음으로 다시 내 차트는 을 렌더링 아약스/2000 밀리 초를 새로 고침 할 때, 내 차트는 항상 검은 색 렌더링하이 차트를 아약스 새로 고침시 검은 색으로 표시합니다.

index.php를

 <script type="text/javascript"> 
    var auto_refresh = setInterval(
     function() { 

      $('#src2').load('monitor.php').fadeIn("slow"); 

     }, 2000); // refresh setiap 00000 milliseconds 

</script> 

<div id="container" style="min-width: 120px; height: 220px; margin: 0 auto"></div> 


</head> 
<body> 
<div id="src2"></div> 

Monitor.php

<script > 
$(function() { 
    $('#container').highcharts({ 
     title: { 
      text: 'Interval Chart', 
      x: -20 //center 
     }, 
     subtitle: { 
      text: 'Cisco Wallboard', 
      x: -20 
     }, 
     xAxis: { 
      categories: ['1', '2', '3', '4', '5', '6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24'] 
     }, 
     yAxis: { 
      title: { 
       text: 'Percentage (%)' 
      }, 
      plotLines: [{ 
       value: 0, 
       width: 1, 
       color: '#808080' 
      }] 
     }, 
     tooltip: { 
      valueSuffix: '%' 
     }, 
     legend: { 
      layout: 'vertical', 
      align: 'right', 
      verticalAlign: 'middle', 
      borderWidth: 0 
     }, 
     series: [{ 
      name: 'SCR', 
      data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6,7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 100] 
     }, { 
      name: 'SL', 
      data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5] 
     }] 
    }); 
}); 
    </script> 

firebug로 확인하십시오, 이 오류를 알지 못했습니다 : TypeError : ha가 함수가 아닙니다

+1

이 오류를 일으키는 라인은 무엇입니까? 또한 [이 튜토리얼] (http://www.highcharts.com/docs/working-with-data/preprocessing-live-data)을 따르지 않는 것이 어떻습니까? –

답변

1

하이 차트 동적 데이터 업데이트를 위해 전체 페이지를 새로 고칠 필요가 없으므로 하이 차트 구성 객체의 참조를 가져 와서 시리즈 데이터를 업데이트하십시오.

+0

데이터베이스 mysql과 함께 자습서 링크가 있습니까? – Yovhi

관련 문제