Good afternoon!
I'm creating a pie chart, the data I'm looking for from the database.
But I do not know how to change the colors of the sectors of the pie chart, to make it clear I will show here what I want.
Home
The code is as follows:
include "../classif/BD/ligabd.php";
...
'
google.charts.load("current", {packages:["corechart"]});;
google.charts.setOnLoadCallback(drawChart);
function drawChart()
{
var data = google.visualization.arrayToDataTable([
['classificacao','Number'],
<?php
while ($row=mysqli_fetch_array($result))
{
echo "['".$row["classificacao"]."', ".$row["number"]."],";
}
?>
]);
var options = {
title:'Classificações do refeitório',
is3D:true
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data,options);
}
Home
Graph of cafeteria classifications
'
Home
The output is as follows:
WhatIintendedwasinsteadof"yellow" being the color blue, the color was yellow, where it says green, instead of being red it was green, and so on ...