1) to keep nulls the same, you have to set it up to return null if the original is null:
return (dt.getValue(row, 0) == null) ? null : Math.round(dt.getValue(row, 0) * 3.78541178 * 100) / 100;
2) to change the hAxis values, you need to make column 0 into a calculated column in the view, which your code will do, but you left the unmodified column 0 in the array. Take out the leading 0 in the #setColumns call and you should be good.
3) to include the unit labels for the base data set in the tooltip, you need to format the original DataTable using
NumberFormatters, like this:
// format column 0 as GPM
var GPMformatter = new google.visualization.NumberFormat({suffix: ' GPM'});
GPMformatter.format(data, 0);
To include the units for the other systems, you need to return both the value and formatted value in the column calculation:
var value = dt.getValue(row, 0) * 3.78541178;
return (dt.getValue(row, 0) == null) ? null : {
v: value,
f: Math.round(value * 100) / 100 + ' LPM'
};
Rounding only the formatted value keeps the tooltip the way you want but allows for more accurate rendering of the chart.
If you want to use more than two systems of measurement, you can certainly do so. You can use pretty much any method you want to change between systems (links, buttons, radio buttons, checkboxes, dropdowns, etc). Create something which allows you to track which system the user wants, adjust the value based on the user's choice, and draw the chart with the corresponding data. Here's one way of doing it with a dropdown:
HTML:
<select id="selectMe">
<option value="0" selected="selected">System 1</option>
<option value="1">System 2</option>
<option value="2">System 3</option>
</select>
Javascript:
var system = 0;
document.getElementById('selectMe').onchange = function () {
// change from metric to imperial and vice-versa
system = this[this.selectedIndex].value;
if (system == 0) {
// set up as system 0
}
else if (system == 1) {
// set up as system 1
}
else {
// set up as system 2
}
// redraw the chart with the new options and data
chart.draw();
}