Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

325
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!