Hi,
Can u try below Colors options to give custom colors to the bars.
var options = {
chart: {
title: 'Total Sales',
subtitle: 'By Sales Rep'
},
bars: 'horizontal',
*colors:['#F3BF31','#31B2F3','orange'],*
};
On Tuesday, 11 September 2018 18:26:47 UTC+5:30, Zavman wrote:
>
> Hello, Hoping someone here can please assist me; I am really struggling to
> change colors of bars in this code from the Google default colors. I've
> read the Google Charts Instructions, but it doesn't seem to fit my example
> below or I am just not clear on implementing. Please help me. Code below
> has no color changes made to it. Could someone please give me an example
> of where I would modify this code to change color of bars?
>
> Thank you!
> Zav
>
>
>
> <html>
>
> <head>
>
> <script type="text/javascript" src="
> https://www.gstatic.com/charts/loader.js"></script>
>
> <script type="text/javascript">
>
> google.charts.load('current', {'packages':['bar']});
>
> google.charts.setOnLoadCallback(drawChart);
>
> function drawChart() {
>
> var data = google.visualization.arrayToDataTable([
>
> ['Sales Rep', 'Last Year', 'This Year', 'Current Goal'],
>
> ['ALI', 236846, 394469, 29090.9090909090909091],
>
> ['BRANDON', 372545, 398229, 49090.9090909090909091],
>
> ['Charlie', 108150, 106701, 14545.4545454545454545],
>
> ['Dan', 395879, 254291, 40909.0909090909090909],
>
> ['Jake', 234991, 336385, 36363.6363636363636364],
>
> ['JJ', 142626, 88781, 49090.9090909090909091],
>
> ['JOE', 82765, 96633, 12727.2727272727272727],
>
> ['Lauren', 259511, 182041, 28181.8181818181818182],
>
> ['Ziggy', 148210, 126760, 18181.8181818181818182],
>
>
>
> ]);
>
>
> var options = {
>
> chart: {
>
> title: 'Total Sales',
>
> subtitle: 'By Sales Rep'
>
> },
>
> bars: 'horizontal'
>
> };
>
>
> var chart = new
> google.charts.Bar(document.getElementById('barchart_material'));
>
>
> chart.draw(data, options);
>
> }
>
> </script>
>
> </head>
>
> <body>
>
> <div id="barchart_material" style="width: 650px; height: 500px;"></div>
>
> </body>
>
> </html>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/307853c3-794b-4641-989b-93ca9988d994%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.