Even in the case where 'a' is defined, you're passing it in the wrong way to
setCell.
You are passing an object with a 'className' property whose value is a
string representation of a JavaScript object (containing a 'style' key). I'm
not sure that makes sense. The documentation (
http://code.google.com/apis/chart/interactive/docs/gallery/table.html#customproperties)
suggests you should use a JavaScript object with a style key directly. That
is:

rel.setCell(k, 0, val.database_id ,null ,{'style':
'background-color:#aabbcc'});

/R.
On Jun 25, 2011 7:49 AM, "ChartALot" <[email protected]> wrote:
> I'm not sure your question is relevant to our API.
> Anyway, what do you expect to happen when 'days' is <=0? Your variable 'a'
> is not defined in that case and you still use it...
> HTH
> On Jun 23, 2011 1:03 AM, "scott5616" <[email protected]> wrote:
>> Hi everyone,
>>
>> I have been working on a dashboard using the Google visualization
>> where I am presenting data into a google table from a database query.
>> So far, I have the table created and the data being presented
>> perfectly, but now I want to add some conditional formatting based on
>> specific values in the table.
>>
>> I am trying for add some formatting to the table using the following
>> code:
>>
>> $(function(table){
>> $.getJSON('src/getReleases.php', function(releaseData) {
>> var rel = new google.visualization.DataTable();
>> rel.addRows(releaseData.length);
>> rel.addColumn('string','DatabaseID');
>> rel.addColumn('string','Release ID');
>> rel.addColumn('string','days_to_freeze');
>> $.each(releaseData, function(k, val){
>> var days = parseInt(val.days_to_freeze);
>> if(days > 0){
>> var a = "{'style':'background-color:#F8D0D8;'}";
>> }
>>
>> rel.setCell(k, 0, val.database_id ,null ,{'className':a});
>> rel.setCell(k, 1, val.release_id ,null ,{'className':a});
>> ...
>> The problem is that the javascript variable does not seem to be
>> expanded Testing indicates that 'a' is being set to the correct value,
>> but not being displayed the the page is reloaded.
>>
>> Probably a really simple problem, but I cannot seem to understand what
>> I am doing wrong - someone help!
>>
>> Thanks.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
>> To post to this group, send email to
> [email protected].
>> To unsubscribe from this group, send email to
> [email protected].
>> For more options, visit this group at
> http://groups.google.com/group/google-visualization-api?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
> To post to this group, send email to
[email protected].
> To unsubscribe from this group, send email to
[email protected].
> For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to