2013-03-26 5 views
0

Highcharts를 처음 접했고 이미 좋아합니다. 필자는 json, php en mysql (예제 사용)을 사용하여 기둥 형 차트를 만들었습니다. 이제 json을 사용하여 열과 행이있는 차트를 만들고 싶습니다. 아무도 내가 할 수있는 방법을 말해 줄 수 있습니까 ?? PHP에서로 json_encode()를 사용하여 http://docs.highcharts.com/#preprocessing-data-from-a-database json을 사용하여 열과 행이있는 하이 차트 차트

  • 반환 배열 JSON으로 다음 Highcharts에서 사용 :

    $(function() { 
    var chart; 
    $(document).ready(function() { 
        $.getJSON("DataKwhDagCum.php", function(json) {  
         chart = new Highcharts.Chart({ 
          chart: { 
           renderTo: 'container', 
           type: 'column', 
           marginRight: 130, 
           marginBottom: 25 
          }, 
          title: { 
           text: 'In (Enexis) vs Out (Zonnestroom)', 
           x: -20 //center 
          }, 
          subtitle: { 
           text: '', 
           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', '25', '26', '27', '28', '29', '30', '31'] 
          }, 
          yAxis: { 
           title: { 
            text: 'Amount' 
           }, 
           plotLines: [{ 
            value: 0, 
            width: 1, 
            color: '#808080' 
           }] 
          }, 
          tooltip: { 
           formatter: function() { 
             return '<b>'+ this.series.name +'</b><br/>'+ 
             this.x +': '+ this.y; 
           } 
          }, 
          legend: { 
           layout: 'vertical', 
           align: 'right', 
           verticalAlign: 'top', 
           x: -10, 
           y: 100, 
           borderWidth: 0 
          }, 
          series: json 
         }); 
        }); 
    
    }); 
    
    }); 
    
  • +1

    먼저 코딩을 시작해야합니다. 그러면 붙어있을 때마다 구출하겠습니다. D – fedorqui

    +0

    어디서 붙어 있습니까? 원하는 결과를 얻기 위해 어디에서 실패했는지 설명해 주시겠습니까? – Shog9

    답변

    0

    동일한 파일에 두 가지 방법

    • 사용 PHP와 스크립트를 사용할 수 있습니다.
    관련 문제