I hope I do not drive you nuts Asgallant or anyone else who helps me out!
I tried to implement your column bar color change to a bar chart. I got to work the way I wanted but I can not use isStacked:'true' because I do not want them to stack but to go side by side like it is now. The problem I am having is the bars are way to small for the size I need it to be in width and height. Did I do something wrong?
here is the code I am using:
google.load('visualization', '1', {packages: ['corechart']});
function drawVisualization() {
var query = new google.visualization.Query('
http://spreadsheets.google.com/tq?key=0AjlSK7_zXoNHdFZ6NmJTaU1vNjNxWFZMQ3AxcWVHRVE&pub=1');
// Apply query language statement.
// Send the query with a callback function.
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}
var data = response.getDataTable();
// set the 3rd column to the "tooltip" role
data.setColumnProperty(3, 'role', 'tooltip');
data.setColumnProperty(4, 'role', 'tooltip');
var view = new google.visualization.DataView(data);
view.setColumns([0, {
type: 'number',
label: 'Value',
calc: function (dt, row) {
console.log(dt.getValue(row, 0));
return (dt.getValue(row, 0) == 'NOx') ? dt.getValue(row, 1) : null;
}
}, 3, {
type: 'number',
label: 'Value',
calc: function (dt, row) {
return (dt.getValue(row, 0) == 'NOx') ? dt.getValue(row, 2) : null;
}
}, 4, {
type: 'number',
label: 'Value',
calc: function (dt, row) {
return (dt.getValue(row, 0) == 'CO') ? dt.getValue(row, 1) : null;
}
}, 3, {
type: 'number',
label: 'Value',
calc: function (dt, row) {
return (dt.getValue(row, 0) == 'CO') ? dt.getValue(row, 2) : null;
}
}, 4, {
type: 'number',
label: 'Value',
calc: function (dt, row) {
return (dt.getValue(row, 0) == 'PM') ? dt.getValue(row, 1) : null;
}
}, 3, {
type: 'number',
label: 'Value',
calc: function (dt, row) {
return (dt.getValue(row, 0) == 'PM') ? dt.getValue(row, 2) : null;
}
}, 4, {
type: 'number',
label: 'Value',
calc: function (dt, row) {
return (dt.getValue(row, 0) == 'PM10') ? dt.getValue(row, 1) : null;
}
}, 3, {
type: 'number',
label: 'Value',
calc: function (dt, row) {
return (dt.getValue(row, 0) == 'PM10') ? dt.getValue(row, 2) : null;
}
}, 4,{
type: 'number',
label: 'Value',
calc: function (dt, row) {
return (dt.getValue(row, 0) == 'PM2.5') ? dt.getValue(row, 1) : null;
}
}, 3,{
type: 'number',
label: 'Value',
calc: function (dt, row) {
return (dt.getValue(row, 0) == 'PM2.5') ? dt.getValue(row, 2) : null;
}
}, 4, {
type: 'number',
label: 'Value',
calc: function (dt, row) {
return (dt.getValue(row, 0) == 'SO2') ? dt.getValue(row, 1) : null;
}
}, 3, {
type: 'number',
label: 'Value',
calc: function (dt, row) {
return (dt.getValue(row, 0) == 'SO2') ? dt.getValue(row, 2) : null;
}
}, 4]);
var visualization = new google.visualization.BarChart(document.getElementById('visualization'));
visualization.draw(view, {
backgroundColor: '#F7F7F7',
legend: 'none',
//colors: ['#336699'], // with only one entry here, you will never get more than 1 color
is3D: 'True',
});
}
google.setOnLoadCallback(drawVisualization);
Thanks for the help in advance.
justawebbie in learning