2013-12-16 2 views
0

Google Chart를 사용 중입니다. 나는 Google에서 검색 중이었고 일부 API 옵션을 사용하여 막대의 색상을 기본 파란색에서 흰색으로 설정했습니다. 이것은 내가 옵션 매개 변수로 추가 한 것입니다 :Google Chart Bar Blue to White

사람이 단지 당신이 내가 뭘하려도 바

colors: '#FFF' 

의 두 개 이상의 색상을 원하는 경우 작동 할 것이라고 말했다. 이것을 어딘가에 보았으니 적용 할 생각이었습니다.

color: '#FFF' 

무엇인가의 이유로 원한대로 작동하지 않습니다. 내 자바 스크립트 코드가 여기에 있습니다.

<script type="text/javascript" src="https://www.google.com/jsapi"></script> 
    <script type="text/javascript"> 
     google.load("visualization", "1", {packages:["corechart"]}); 
     google.setOnLoadCallback(drawChart); 
     function drawChart() { 
     var data = google.visualization.arrayToDataTable([ 
      ['', 'Current Demand'], 
      <?php echo $data; ?> 
     ]); 

     var options = { 
       width: 350, 
       height: 261, 
       isStacked: true, 
       legend: 'none', 
       backgroundColor: { 
         fill:'transparent' 
        }, 
       hAxis: { 
         title: '', 
         titleTextStyle: {color: 'white' 
        }, 
       colors: '#FFF' 
      } 
     }; 

     var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); 
     chart.draw(data, options); 
     } 
    </script> 

내가 누락 된 것이 있습니까?

답변

0

색상을 자바 스크립트 배열에 입력해야합니다.

colors: ['#fff'] 
+0

오 고마워. 나는 틀린 장소에 색을 넣고 싶다. 고마워! –