Thx a lot for your help but i'm stupid as hell. I tried to find out my
problems with a lot of tests / variables. and i used 2 times the same name
for 2 things different :
var ventes = eval('('+jsonData+')');
AND
function ventes(dt, rowNum) {
return dataTable.getValue(rowNum,0) * dataTable.getValue(rowNum,1);
}
but anyway you right asgallant i should be carreful with variable names /
object passedto the function.
Le vendredi 15 mars 2013 19:31:13 UTC+1, asgallant a écrit :
>
> Here's a potential problem:
>
> function ventes (joinTables, row) {
> console.log(joinTables);
> console.log('hello');
> return joinTables.getValue(row,2) *joinTables.getValue(row,3);
> }
>
> You could be having some scope issues there, as it isn't exactly clear
> whether "joinTables" should refer to your joinTables object or the
> DataTable being passed to the function. Since you are using the view on
> the "groupData" object, you definitely don't want to be referencing
> joinTables here. The safe way to handle these is to use a unique variable
> that you don't use elsewhere:
>
> function ventes (dt, row) {
> return dt.getValue(row, 2) * dt.getValue(row, 3);
> }
>
> On Friday, March 15, 2013 12:07:00 PM UTC-4, Tangred wrote:
>>
>> sorry i forgot the line right after :
>>
>> table.draw(viewJoinTables);
>>
>> but i will try to cleanse a bit my code, maybe there are some mistakes
>>
>>
>>
>> Le vendredi 15 mars 2013 16:40:03 UTC+1, Daniel LaLiberte a écrit :
>>>
>>> This much looks fine. I'm actually not sure about the join and group
>>> operations, and how many columns result.
>>> But you didn't include your table.draw() call, so I can see which data
>>> object you are referencing.
>>>
>>> In your ventes function, you should store the result of the computation
>>> in a variable, and do console.log('result', result), so you can see that
>>> you are getting the right values.
>>>
>>> dan
>>>
>>>
>>> On Fri, Mar 15, 2013 at 11:27 AM, Tangred <[email protected]> wrote:
>>>
>>>> here it is :
>>>>
>>>> data and magasinsTable are datatables directly load from 2 diffetent
>>>> Json file.
>>>>
>>>> var joinTables= new google.visualization.data.join(data,
>>>> magasinsTable, 'left', [[2,0]], [1,5,7,8],[1]);
>>>> var groupedValue = google.visualization.data.group(joinTables,
>>>> [1,0],[{'column': 4, 'aggregation': google.visualization.data.sum, 'type':
>>>> 'number'},{'column': 3, 'aggregation': google.visualization.data.sum,
>>>> 'type': 'number'}]);
>>>> var viewJoinTables = new google.visualization.DataView(groupedValue);
>>>> var table = new
>>>> google.visualization.Table(document.getElementById('test_dataview'));
>>>> //viewJoinTables.setRows(viewJoinTables.getFilteredRows([{column: 1,
>>>> maxValue: 907}]));
>>>> viewJoinTables.setColumns([0,1,2,3, {type:'number', label:'total',
>>>> calc:ventes} ]);
>>>>
>>>>
>>>> function ventes (joinTables, row) {
>>>> console.log(joinTables);
>>>> console.log('hello');
>>>> return joinTables.getValue(row,2) *joinTables.getValue(row,3);
>>>>
>>>>
>>>> I'm wondering if it's the size of data. I have more than 44 000 lines
>>>>
>>>> Le vendredi 15 mars 2013 15:52:39 UTC+1, Daniel LaLiberte a écrit :
>>>>>
>>>>> I think you will need to give more of your example. From what you
>>>>> provide, which looks OK, we can't tell where groupedValue comes from, or
>>>>> when you draw your table, what data you are giving it. I would guess you
>>>>> should be giving the table your viewJoinTables.
>>>>>
>>>>> dan
>>>>>
>>>>>
>>>>> On Fri, Mar 15, 2013 at 10:46 AM, Tangred <[email protected]> wrote:
>>>>>
>>>>>>
>>>>>> var viewJoinTables = new google.visualization.DataView(**
>>>>>> groupedValue);
>>>>>> var table = new google.visualization.Table(**
>>>>>> document.getElementById('test_**dataview'));
>>>>>> viewJoinTables.setColumns([0,**1,2,3, {type:'number', label:'Total',
>>>>>> calc: ventes} ]);
>>>>>> function ventes (groupedValue, row) {
>>>>>> return 2;
>>>>>>
>>>>>> }
>>>>>> my column is still empty ...
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Daniel LaLiberte<https://plus.google.com/100631381223468223275?prsrc=2>
>>>>>>> - 978-394-1058
>>>>>>> [email protected] 562D 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 google-visualization-api+**
>>>>>> [email protected].
>>>>>> To post to this group, send email to google-visua...@**
>>>>>> googlegroups.com.
>>>>>>
>>>>>> Visit this group at http://groups.google.com/**
>>>>>> group/google-visualization-**api?hl=en<http://groups.google.com/group/google-visualization-api?hl=en>
>>>>>> .
>>>>>> For more options, visit
>>>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>>>> .
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Daniel LaLiberte<https://plus.google.com/100631381223468223275?prsrc=2>
>>>>> - 978-394-1058
>>>>> [email protected] 562D 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?hl=en.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
>>> - 978-394-1058
>>> [email protected] 562D 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.