Finally I found a solution here 
<http://stackoverflow.com/questions/12415689/how-to-dynamically-add-rows-columns-to-a-google-column-chart>
 
to create a dynamic chart via "dataTable" without using "arrayToDataTable" 
and it works perfectly !
Anyway, I think there is still a problem where I then misses a trick with 
"arrayToDataTable" because my function is the same to retrieve values, I 
just change their format adjust the values for format "dataTable".
Now I have a good solution and that's enough!
Ok Daniel, thank you again for your help ...

Le vendredi 28 août 2015 15:06:40 UTC+2, Daniel LaLiberte a écrit :
>
> A lot of context was missing, so it helps to see your actual script for 
> your spreadsheet.  Thanks.
>
> In your ChartOutput.html, this doesn't make sense to me:
>
> google.load('visualization', '1.0', {packages: ['controls']})
> google.script.run.withSuccessHandler(onSuccessStore).getData();
> google.setOnLoadCallback(onSuccessStore);
>
> function onSuccessStore(values) {
> ...
> }
>
>
> The google.script.run.withSuccessHandler call is pretty bizarre, but that 
> appears to be the way to do it:  
> https://developers.google.com/apps-script/guides/html/reference/run#withSuccessHandler(Function)
>
> But if you do that, then the next line doesn't make sense: 
> google.setOnLoadCallback(onSuccessStore);
> This would call onSuccessStore yet again, but not pass any argument for 
> the values.
>
> I suspect that what you want is more like this:
>
> google.setOnLoadCallback(onVisualizationLoad);
>
> function onVisualizationLoad() {
>   google.script.run.withSuccessHandler(onSuccessStore).getData();
> }
>
> function onSuccessStore(values) {
> ...
> }
>
> This will wait for the visualization library to be loaded, call 
> onVisualizationLoad, which then calls the withSuccessHandler as before.
>
>
> On Fri, Aug 28, 2015 at 8:39 AM, Jean Gorene <[email protected] 
> <javascript:>> wrote:
>
>> Ok and sorry ...
>> Your suggestion works, but like mine with two columns merged, 
>> unfortunately.
>> So I can not make a jsfiddle because the charts are done on modal Dialog 
>> html output ... activated from the data on the spreadsheet ... in fact, 
>> it's just a test to be used in a support on educational setting. 
>> Nevertheless, I share the spreadsheet with the script, of course ... 
>> It's just a very simple basic configuration for test and you will quickly 
>> see how it is done and where is the problem ... if you'll look at, of 
>> course!
>> https://goo.gl/ynKZuM
>> Anyway, thank you again :)
>>
>> Le jeudi 27 août 2015 20:45:15 UTC+2, Daniel LaLiberte a écrit :
>>>
>>> Could you point us to your web page that shows what you are seeing?  
>>> Either that, or you could create an example in jsfiddle.net.   It is 
>>> difficult to help you more otherwise.
>>>
>>> On Thu, Aug 27, 2015 at 2:19 PM, Jean Gorene <[email protected]> wrote:
>>>
>>>> Hi Daniel,
>>>> Thank so much for your help :)
>>>> I understand the process, by cons it does not work either and there is 
>>>> no chart that appears !
>>>> Bellow the new code
>>>> function onSuccessStore(values) {
>>>>   var header01 = values[0][0];
>>>>   var header02 = values[0][4];
>>>>   
>>>>   var val = [];
>>>>   // var columns = ["'" + header01 + "','" + header02 + "'"];
>>>>   var columns = ["'" + header01 + "'", "'" + header02 + "'"];
>>>>   val.push(columns)
>>>>   for (var i = 1 , nb = values.length; i < nb ; i++) {
>>>>     var rows = values[i];
>>>>     var severity = rows[0];
>>>>     var risk = rows[4]
>>>>     if ( severity != "" && risk  != "") {
>>>>       var value = ["'" + risk + "'," + severity];
>>>>       val.push(value);
>>>>     }    
>>>>   }
>>>>   var data = google.visualization.arrayToDataTable(val, false);
>>>>
>>>> Really, it is to not understanding anything ... I'm above since the 
>>>> beginning of the week ...
>>>> I tested, turned, tried to find a solution ... nothing to do!
>>>> I really do not understand why it works with the copy of the log ... 
>>>> but not with the output value from the function !?!
>>>> Maybe, I do something wrong and I can share the file, no problem ...
>>>> Ok, thank you again :)
>>>>
>>>> Le jeudi 27 août 2015 19:47:28 UTC+2, Daniel LaLiberte a écrit :
>>>>>
>>>>> It looks like your column headers for case 1 are wrong.  You have
>>>>>
>>>>>   columns = ["'" + header01 + "','" + header02 + "'"];
>>>>>
>>>>> The comma is in quotes, so you are getting one string rather than 
>>>>> two.  Should be:
>>>>>
>>>>> columns = ["'" + header01 + "'", "'" + header02 + "'"];
>>>>>
>>>>>
>>>>> On Thu, Aug 27, 2015 at 1:14 PM, Jean Gorene <[email protected]> 
>>>>> wrote:
>>>>>
>>>>>> Hello everyone, I need help ... 
>>>>>> I try to build a dynamic chart from the values of a spreadsheet
>>>>>> So, I get my values from this sheet, no problem
>>>>>> Where it gets complicated is with "arrayToDataTable" ... I chose this 
>>>>>> solution to make it easier ... well it had to be easier :-/
>>>>>> In fact, I'd like to understand why my code works in one case (2) and 
>>>>>> not in case (1) (which is of course the one that interests me) see below
>>>>>> I probably missed something or I'm doing something wrong (!) ... 
>>>>>> anyway I do not find a way out of this impasse ... ... ...
>>>>>> Any ideas welcome, thank you in advance !
>>>>>>
>>>>>> Case (1) - this not work see image ... there is only one merged 
>>>>>> column when it should be two ???
>>>>>> function onSuccessStore(values) { 
>>>>>>   var header01 = values[0][0];
>>>>>>   var header02 = values[0][4];
>>>>>>   
>>>>>>   var val = [];
>>>>>>   var columns = ["'" + header01 + "','" + header02 + "'"];
>>>>>>   val.push(columns)
>>>>>>   for (var i = 1 , nb = values.length; i < nb ; i++) {
>>>>>>     var rows = values[i];
>>>>>>     var severity = rows[0];
>>>>>>     var risk = rows[4]
>>>>>>     if ( severity != "" && risk  != "") {
>>>>>>       var value = ["'" + risk + "'," + severity];
>>>>>>       val.push(value);
>>>>>>     }    
>>>>>>   }
>>>>>>   var data = google.visualization.arrayToDataTable(val, false);
>>>>>> ... and the next
>>>>>>
>>>>>> Case (2) - This works properly (a priori, there is no reason to the 
>>>>>> contrary)
>>>>>> function onSuccessStore(values) {
>>>>>> // below the exact copy of "val" in output log from case 1
>>>>>>   var val = [ 
>>>>>>     ['Severity 1-4','#'], 
>>>>>>     ['R1',1], 
>>>>>>     ['R2',1], 
>>>>>>     ['R3',1], 
>>>>>>     ['R4',1], 
>>>>>>     ['R5',3.5], 
>>>>>>     ['R6',1.5], 
>>>>>>     ['R7',2.5], 
>>>>>>     ['R8',3]
>>>>>>   ];
>>>>>>   var data = google.visualization.arrayToDataTable(val, false);
>>>>>> ... and the next
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> 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.
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/google-visualization-api/9c5a4509-84a1-4f53-8ca7-cc2a9e0d9570%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/google-visualization-api/9c5a4509-84a1-4f53-8ca7-cc2a9e0d9570%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Daniel LaLiberte 
>>>>> <https://plus.google.com/100631381223468223275?prsrc=2>  - 
>>>>> 978-394-1058
>>>>> [email protected]   5CC, Cambridge MA
>>>>> [email protected] 9 Juniper Ridge Road, Acton MA
>>>>>
>>>> -- 
>>>> 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.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/google-visualization-api/7404a1bf-bbf6-4221-8e60-346d1f74b805%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/google-visualization-api/7404a1bf-bbf6-4221-8e60-346d1f74b805%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> -- 
>>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
>>>   - 978-394-1058
>>> [email protected]   5CC, Cambridge MA
>>> [email protected] 9 Juniper Ridge Road, Acton MA
>>>
>> -- 
>> 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] 
>> <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at 
>> http://groups.google.com/group/google-visualization-api.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-visualization-api/d9f8d272-fecc-475d-adf1-1d035eb1d40c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-visualization-api/d9f8d272-fecc-475d-adf1-1d035eb1d40c%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> 
>  - 978-394-1058
> [email protected] <javascript:>   5CC, Cambridge MA
> [email protected] <javascript:> 9 Juniper Ridge Road, Acton MA
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/faaf7094-4f4f-4c5b-992b-5aae4b189da9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to