You are setting the formatted value of the cell when you call 
formatter.format(data, 
1); and the formatted value is not overwritten when you change the actual 
value of the cell.  You need to reformat your data after calling #setCell:

chart.draw(data, options);
data.setValue(0,1, sales);
formatter.format(data, 1);
chart.draw(data, options);

On Thursday, October 9, 2014 8:07:10 PM UTC-4, Bevan wrote:
>
> OK, I've got that working bar one thing: the value shown in the gauge 
>>> changes, but the label does not. So the pointer climbs to [value] but the 
>>> big letters say the value is 0. 
>>
>> Here's my code:
>
> <!--  ------------------------  make Code for Today graph 
>>  -------------------------------  -->
>>       google.setOnLoadCallback(drawChart);
>>       function drawChart() {
>> var sales = @todaySales;
>> var dayTarget = @dailyTarget;
>> var apdTarget = 22500;
>> var green = 0;
>> if (sales < 0) {green = 0} else {green = sales};
>>         var data = google.visualization.arrayToDataTable([
>>           ['Label', 'Value'],
>>           ['Today', 0],           
>>         ]);
>>
> // format column 1 of DataTable data
>  
>
>> var formatter = new google.visualization.NumberFormat({pattern: 
>> '$#,###.00'});
>> formatter.format(data, 1);
>>
>  
>
>>         var options = {
>>           width: 400, height: 400,
>>   greenFrom: 0, greenTo: green,
>>           minorTicks: 5, max: dayTarget,
>>   animation: {duration: 5000, easing: 'inAndOut'}
>>         };
>>         var chart = new 
>> google.visualization.Gauge(document.getElementById('daily_Sales'));
>>         chart.draw(data, options);
>>   data.setValue(0,1, sales);
>>         chart.draw(data, options);
>>
>>       }; 
>
>
> The variables prefixed with an @ are declared higher up in the CSHTML 
> page. If i substitute them for a fixed value, i still get 0. See attached 
> image. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to