Sorry it's taken me so long to get back to you on this. The attached code adds the ability to automatically generate y-axis labels for bar charts based on the data (it may work for line charts too.)
Here's an example of how the new code is used:
PHP Code:
$chartData = new GChart_Data_Generic($data, '', $layer->getFieldPresNames($fields), array(),
'336699', $layerData[$layerAppName]->numYAxisDigits);
$chart = new GChart();
$chart->setSize('auto',200)
->setType(GChart::TYPE_BAR_VGROUPED)
->setTitle($layerData[$layerAppName]->title, '336699', 14)
->setDataEncoding(GChart_Data_Encoder_Factory::TEXT_W_SCALING_ENCODING)
->setBackgroundFill(new GChart_Fill_Solid('B1BBC5'))
->setMaxValue($chartData->getMaxValue())
->addAxis(new GChart_Axis('x,y'))
->setAutoBarWidth(true)
->addData($chartData);
//error_log($chart->render());
echo '<img onload="graphImageLoaded();" src="' .
$chart->render() . '" alt="'.$layerData[$layer]->title.'"/>';
I couldn't figure how how to make the y-axis labels be consistent with how google scales the data using simple encoding, so I switched to Text encoding with scaling and added a new class to GChart/Data/Encoder to support that (the existing Text class didn't support scaling).
Please be aware that I only added what I needed to get my project done.
On another note, I think I found a bug in GChart.php on line 148. It's setting $this->m_szDataEncoding; I think it should be $this->m_szEncoding.
Let me know if you have any questions.
Witt