- Joined
- Dec 10, 2022
- Messages
- 17
- Reaction score
- 2
Dear all
Could someone please help me to find a way for using the above function for showing 4 bars in distinct colours?
Using simple code no chart.js or any other library
Thank you in advance
Could someone please help me to find a way for using the above function for showing 4 bars in distinct colours?
Using simple code no chart.js or any other library
Thank you in advance
JavaScript:
function barIt(tem) {
tem.length=4;
var tab = '<table><tr><td colspan="'+tem.length+'" align="center">Table</td></tr>';
toggle=true;
for(var k=0;k<tem.length;k++) {
diff = largest-tem[k][0];
tab += '<tr><td colspan="'+
tem[k][0]+
'" bgcolor="'+((toggle)?'lightblue':'yellow')+'">'+
tem[k][0]+
'</td><td colspan="'+
diff+
'">'+tem[k][1]+'</td></tr>'
toggle=!toggle;
}
tab+='</table>';
document.getElementById('bar').innerHTML=tab;
}
</script>
Last edited: