This will make all bars int he chart red.  I am looking for a way to
make each bar in the bar chart a specific color... is there a way to
do this?

Thank you!



On Jun 18, 2:04 am, VizWiz <[email protected]> wrote:
> Hi Zhengwei,
>
> Here is a code sample that changes the color from blue to red. Note that the
> "colors" option accepts an array of strings.
>
> <html>
>   <head>
>     <script type="text/javascript" src="http://www.google.com/jsapi";></
> script>
>     <script type="text/javascript">
>       google.load("visualization", "1", {packages:["columnchart"]});
>       google.setOnLoadCallback(drawChart);
>       function drawChart() {
>         var data = new google.visualization.DataTable();
>         data.addColumn('string', 'Year');
>         data.addColumn('number', 'Sales');
>         data.addRows(4);
>         data.setValue(0, 0, '2004');
>         data.setValue(0, 1, 1000);
>         data.setValue(1, 0, '2005');
>         data.setValue(1, 1, 1170);
>         data.setValue(2, 0, '2006');
>         data.setValue(2, 1, 660);
>         data.setValue(3, 0, '2007');
>         data.setValue(3, 1, 1030);
>
>         var chart = new google.visualization.ColumnChart(document.
> getElementById('chart_div'));
>         chart.draw(data, {width: 400, height: 240, is3D: true, title: 'Company
> Performance', colors: ['red']});
>       }
>     </script>
>   </head>
>
>   <body>
>     <div id="chart_div"></div>
>   </body>
> </html>
>
> Cheers,
> VizWiz
>
> On Wed, Jun 17, 2009 at 2:57 AM, Zhengwei <[email protected]> wrote:
>
> > Thank you,
> > But I have tried that before I post this, it seems not working.
> > can you so kind as to give me a sample ?
>
> > On Jun 17, 5:01 am, warpandas <[email protected]> wrote:
> > > Under the Configuration Options - there is one for "Colors"
>
> > > colors          Array of strings        Default colors          The
> > colors to use for the
> > > chart elements. An array of strings. Each element is a string that is
> > > a color supported by HTML, for example 'red' or '#00cc00'.
>
> > > Hope this helps.
>
> > > On Jun 16, 1:41 am, Zhengwei <[email protected]> wrote:
>
> > > > I tried to change the color of the column bar from default color
> > > > (BLUE) to red, it does not work, nor can i find any infomation or
> > > > sample online indicating how to do it?
>
> > > >http://code.google.com/intl/en-au/apis/visualization/documentation/ga.
> > ..
>
> > > > Please help!
> > > > Thanks in advance
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to