Hi,
I'm sorry but it doesn't work.
it runs (while in the past it didin't) but still doens't work: I mean the
colour is still blue and doesn't change according to the value,


2014-03-17 16:45 GMT+01:00 asgallant <[email protected]>:

> There's an error in the code I pasted.  Try this:
>
>
> var viewTot = new google.visualization.DataView(dataTot);
> viewTot.setColumns([0, 1, {
>     calc: "stringify",
>     sourceColumn: 1,
>     type: "string",
>     role: "annotation"
> }, 2]);
>
> var viewDisp = new google.visualization.DataView(dataDisp);
> viewDisp.setColumns([0, 1, {
>
>     type: 'string',
>     role: 'style',
>     calc: function (dt, row) {
>         return (dt.getValue(row, 1) < 0) ? 'red' : 'green';
>     }
> }]);
>
>
> You need to draw the charts using the views inside the AJAX call that
> fetches your data (the initial draw call with the zeroed out data doesn't
> matter).
>
>
> On Saturday, March 15, 2014 4:29:18 AM UTC-4, Floriano Sabatini wrote:
>
>> The fanny think is that if I use viewDisp (for the column chart)
>> and viewTot (for the bar chart) I cannot see anything.
>> If I rename viewTot in just view it works but still without the right
>> color of the column (red/green)
>>
>> http://solarflor.dyndns.org/123solar/monitor_lite2.html
>>
>> I'm lost now
>>
>>
>> 2014-03-15 9:07 GMT+01:00 Floriano Sabatini <[email protected]>:
>>
>>> Done. but there should me some mistakes somewhere. I cannot see anything
>>> now.
>>> Thanks for your help
>>>
>>>
>>> 2014-03-14 22:54 GMT+01:00 asgallant <[email protected]>:
>>>
>>> There are a few problems with your code.  First, you need to draw a
>>>> chart using the DataView instead of the DataTable if you want to see the
>>>> effects of the calculated column.  Second, you create two views based on
>>>> different DataTables, but give them the same variable name, so the second
>>>> overwrites the first.  Give the two views different names:
>>>>
>>>> var viewTot = new google.visualization.DataView(dataTot);
>>>> view.setColumns([0, 1, {
>>>>     calc: "stringify",
>>>>     sourceColumn: 1,
>>>>     type: "string",
>>>>     role: "annotation"
>>>> }, 2]);
>>>>
>>>> var viewDisp = new google.visualization.DataView(dataDisp);
>>>> view.setColumns([0, 1, {
>>>>     type: 'string',
>>>>     role: 'style',
>>>>     calc: function (dt, row) {
>>>>     return (dt.getValue(row, 1) < 0) ? 'red' : 'green';
>>>>     }
>>>> }]);
>>>>
>>>> Then use the views to draw the charts:
>>>>
>>>> chartDisp.draw(viewDisp, optionsDisp);
>>>> chartTot.draw(viewTot, optionsTot);
>>>>
>>>> On Friday, March 14, 2014 4:23:18 PM UTC-4, Floriano Sabatini wrote:
>>>>
>>>>> Ciao Asgallant,
>>>>> why it does,t work here. see the column graph
>>>>> http://solarflor.dyndns.org/123solar/monitor_lite2.html
>>>>>
>>>>> what is wrong.
>>>>> Thanks
>>>>> Floriano
>>>>>
>>>>>
>>>>> 2014-03-14 0:00 GMT+01:00 Floriano Sabatini <[email protected]>:
>>>>>
>>>>>> YES. This is the solution I was looking for.
>>>>>> grazie 1000
>>>>>>
>>>>>> Floriano
>>>>>>
>>>>>>
>>>>>> Il giorno giovedì 13 marzo 2014 22:49:20 UTC+1, asgallant ha scritto:
>>>>>>
>>>>>>> Use a "style" role column to set the color of each bar.  Here's an
>>>>>>> example: http://jsfiddle.net/asgallant/aFs9x/3/
>>>>>>>
>>>>>>>
>>>>>>> On Thursday, March 13, 2014 5:46:00 PM UTC-4, Floriano Sabatini
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Dear all,
>>>>>>>> I would like to use the column chart gouge with just one column
>>>>>>>> that will represent the difference between Produced and Consumed 
>>>>>>>> energy. To
>>>>>>>> be effective I need to have the colour of the column that change from 
>>>>>>>> green
>>>>>>>> (if the value is positive) to red if it is negative.
>>>>>>>>
>>>>>>>> Is this something feasible?
>>>>>>>> Many thanks
>>>>>>>> Floriano
>>>>>>>>
>>>>>>>  --
>>>>>> You received this message because you are subscribed to a topic in
>>>>>> the Google Groups "Google Visualization API" group.
>>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>>>>> pic/google-visualization-api/Zd9B1gKrE2w/unsubscribe.
>>>>>> To unsubscribe from this group and all its topics, 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.
>>>>>>
>>>>>
>>>>>  --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "Google Visualization API" group.
>>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>>> topic/google-visualization-api/Zd9B1gKrE2w/unsubscribe.
>>>> To unsubscribe from this group and all its topics, 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.
>>>>
>>>
>>>
>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Google Visualization API" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-visualization-api/Zd9B1gKrE2w/unsubscribe
> .
> To unsubscribe from this group and all its topics, 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.
>

-- 
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