Search code examples
chartsgoogle-visualization

google charts - Bar color


How can i change color of bar "BLACK"? Now its green


      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['MODEL', 'CYAN', 'MAGENTA', 'YELLOW', 'BLACK'],
          <?php
          while($row = mysqli_fetch_array($exec))
          { 
            echo"['$row[1] - $row[0]', $row[5], $row[4], $row[3], $row[2]],"; 
          } 
          ?>
        
        ]);
        var options = { 
          chart: {
            title: "Stan tonerów z <?php echo $date ?>",
            titleTextStyle:{fontSize:76,},
            subtitle: ''
          },
          bars: 'horizontal' // Required for Material Bar Charts.
       };

i tried {role: 'style'} but it dosent work


Solution

  • try the config option for: colors

        var options = { 
          chart: {
            title: "Stan tonerów z <?php echo $date ?>",
            titleTextStyle:{fontSize:76,},
            subtitle: ''
          },
          colors: ['CYAN', 'MAGENTA', 'YELLOW', 'BLACK'],
          bars: 'horizontal' // Required for Material Bar Charts.
       };