In the demo, the value’s aggregates only have Sum Min Max Count

What about Averages?

In the demo, the value’s aggregates only have Sum Min Max Count

What about Averages?

Please check the Defining Operation on Data article in docs:

For example:

```
...
view:"pivot-chart",
groupMethods:{
average: function(template, data){
data = data || this;
var sum = 0;
for (var i = 0; i < data.length; i++)
sum+= template(data[i])*1;
return data.length?sum/data.length:0;
}
},
...
```

I emailed support and they gave me an answer by looking at this example

http://docs.webix.com/samples/61_pivot/01_init/04_define_function.html

so I am trying to write my own but its not working. Can you help?

```
grida.operations.avg = function(args) {
var sum = 0;
var avg = 0;
for (var i = 0; i < args.length; i++) {
var arg = window.parseFloat(args[i], 10);
if (!window.isNaN(arg))
sum += arg;
}
for (var j = 0; j < args.length; j++) {
var arg = window.parseFloat(args[j], 10);
if (!window.isNaN(arg))
avg += arg;
}
return avg/sum;
};
```

You can try the similar solution as I posted for Pivot Chart:

```
grida.operations.avg = function(args) {
var sum = 0;
for (var i = 0; i < args.length; i++)
sum+= args[i]*1;
return args.length?sum/args.length:0;
};
```