Customize the bar colors in Google Gantt Charts -


this should simple. how can assign own colors bars in google gantt charts? gantt ignoring colors , automatically assigning blue, red , yellow colors (in order) bars , can't seem figure out problem. can please point out if missing here or not supported @ @ time?

here have:

function drawchart() {        var data = new google.visualization.datatable();       data.addcolumn({ type: 'string', id: 'task_id' }, 'task id');       data.addcolumn({ type: 'string', id: 'task_name' }, 'task name');       data.addcolumn({ type: 'string', id: 'resource' }, 'resource');       data.addcolumn({ type: 'date', id: 'start_date' }, 'start date');       data.addcolumn({ type: 'date', id: 'end_date' }, 'end date');       data.addcolumn({ type: 'number', id: 'duration' }, 'duration');       data.addcolumn({ type: 'number', id: 'percent_complete' }, 'percent complete');       data.addcolumn({ type: 'string', id: 'dependencies' }, 'dependencies');        data.addrows([         ['research', 'find sources', null,          new date(2015, 0, 1), new date(2015, 0, 5), null,  100,  null],         ['write', 'write paper', 'write',          null, new date(2015, 0, 9), daystomilliseconds(3), 25, 'research,outline'],         ['cite', 'create bibliography', 'write',          null, new date(2015, 0, 7), daystomilliseconds(1), 20, 'research'],         ['complete', 'hand in paper', 'complete',          null, new date(2015, 0, 10), daystomilliseconds(1), 0, 'cite,write'],         ['outline', 'outline paper', 'write',          null, new date(2015, 0, 6), daystomilliseconds(1), 100, 'research']       ]);         var colors = [];       var colormap = {           write: '#e63b6f',           complete: '#19c362'       }       (var = 0; < data.getnumberofrows(); i++) {           colors.push(colormap[data.getvalue(i, 2)]);       }          var options = {           height: 275,           gantt: {             criticalpathenabled: true,             criticalpathstyle: {               stroke: '#e64a19',               strokewidth: 5             }           },           colors: colors         };          var chart = new google.visualization.gantt(document.getelementbyid('chart_div'));         chart.draw(data, options);       } 

i figured out hacky way of doing it. have listen every single event fired chart , override them function colors chart.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -