I have the following sort of gantt chart coded up using Google Charts, but I would like to assign different color to each bar. Now in my case since I am assigning a transparent color to spacer , I dont understand how I can assign a different color to each remaining bar.
This probably comes down to assigning the same series in different bars different colors.
Can someone help me out with fixing this?
http://jsfiddle.net/bootkick/hp2yr/
google.load('visualization', '1', { packages: ['corechart'] }); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Name'); data.addColumn('timeofday', 'spacer'); data.addColumn('timeofday', 'Runtume'); data.addRows([ ['PIPE', [5, 0, 0, 0], [7, 30, 0, 0] ], ['CNI', [6, 0, 0, 0], [12, 30, 0, 0] ], ['PEVC', [11, 0, 0, 0], [17, 30, 0, 0] ] ]); var chart = new google.visualization.BarChart(document.getElementById('chart_div')); chart.draw(data, { isStacked: true, width: 900, height: data.getNumberOfRows() * 80, title: 'Host Runtimes', vAxis: { title: 'Content', titleTextStyle: { color: 'black' } }, series: { 0: { visibleInLegend: false, color: 'transparent' } } }); /*chart.draw(data, {isStacked: true, series: [ {color: 'blue', visibleInLegend: false}, {color: 'red', visibleInLegend: false} ] });*/ }
Thanks