Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

332
Visualizações
Google charts, I can't change bars color

I need to change the colors of the bars to red and blue. Red for the limit, blue for mining. An array with data is connected to the script. I was able to customize everything except the color

function drawChart() {
  var data = google.visualization.arrayToDataTable(regiondata);
  
  var options = {
    chart: {
      title: 'Реализация по годам',
      subtitle: 'График реализации и добычи',
      width: 100,
    },

    bars: 'vertical',
    vAxis: {format: 'decimal'},
    height: 280,
    width: 610,
    colors: ['red', 'blue'],
    backgroundColor: '#F9F6F0',
    
  };

  var chart = new google.charts.Bar(document.getElementById('content-graf'));

  chart.draw(data, google.charts.Bar.convertOptions(options));
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

According to the documentation, you can do it this way :

var data = google.visualization.arrayToDataTable([
  ['Element', 'Density', { role: 'style' }],
  ['Copper', 8.94, '#b87333'],            // RGB value
  ['Silver', 10.49, 'silver'],            // English color name
  ['Gold', 19.30, 'gold'],
  ['Platinum', 21.45, 'color: #e5e4e2' ], // CSS-style declaration
]);
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda