Pivot chart - abssum fails

Hi,

I am trying to add abssum function to the pivot chart sample as:

<!DOCTYPE html>
<html>
<head>
	<title>Init with inline data</title>
	<link rel="stylesheet" href="../../codebase/webix.css" type="text/css" charset="utf-8">
    <link rel="stylesheet" href="../../codebase/pivotchart.css" type="text/css" charset="utf-8">
	<script src="../../codebase/webix.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../codebase/pivotchart.js" type="text/javascript" charset="utf-8"></script>

	<link rel="stylesheet" href="../common/samples.css" type="text/css" charset="utf-8">
	<script src="../common/testdata.js" type="text/javascript" charset="utf-8"></script>
	<style type="text/css">
		html, body {
			width: 100%;
			height: 100%;
			padding: 0;
			margin: 0;
		}
	</style>
</head>
<body>
	<div class='header_comment'>Loading from inline datasource</div>
	<div id="testA"></div>

	<script type="text/javascript" charset="utf-8">

	webix.ready(function(){
		webix.ui({
			container:"testA",
			id:"pivot",
			view:"pivot-chart",
			height:350,
			width:1000,

			structure:{
				groupBy: "year",
				values: [{name:"balance", operation:"max"},{name:"oil", operation:"max"}],
				filters:[{name:"name", type:"select"}]
			},
			data:pivot_dataset


		});

$$('pivot').operations.abssum = function(data) {
//data - array of values which need to be processed
var sum = 0;
for (var i = 0; i < data.length; i++) {
   var num = window.parseFloat(data[i], 10);
   if (!window.isNaN(num))
      sum += Math.abs(num);
   }
return sum;
};

	});

	</script>
</body>
</html>

After changing settings from sum to abssum (http://snag.gy/04vKL.jpg) the chart becomes empty and debug console contains message

 TypeError: r is undefined (webix.js:11)

How can I fix that?

Thank you

Hello Mika,

Sorry for the misleading information in our documentation.
Please use groupMethod property in pivot configuration to add group method. Here is the demo in pivot package related this functionality:

webix_pivot/samples/04_chart_api/01_group_methods.html

Hello, Maria,

It works, thank you.