Workbook.StatCoeffTabSheetSource

Syntax

StatCoeffTabSheetSource: PP.TS.StatTabSheetSource;

Description

The StatCoeffTabSheetSource property sets data source for a sheet in the Equation tab of statistics panel.

Example

To execute the example, the page must contain the WorkbookBox component named workbookBox (see Example of Creating the WorkbookBox Component), and also add the following code in the handler, that processes document opening event:

	//Add the handler to the metabase connection end event that
	//sets whether the Remove Selected Series button is available
	metabase.EndRequest.add(PP.Delegate(function(){									
					
	function isButtonEnabled(series)
	{
		for (var i = 0; i < series.length; i++)
		{
			if (series[i].kind == PP.TS.Ui.LnSerieKind.Derived)
			{
				var parentK = series[i].parent.k;
				var parentFound = False;
				for (var j = 0; j < series.length; j++)
				{
					if (series[j].k == parentK)
					{
						parentFound = True;
						break;
					}
				}
				if (!parentFound)
					return False;
			}
		}
		return series.length > 0;
	};					
					
	var series = wbk.getActiveSheet().getSelectedSeries();					
	if(isButtonEnabled(series))
	{
		removeSerieButt.setEnabled(True);
	}
	else
	{
		removeSerieButt.setEnabled(False);
	}
	}));		
				
	var removeSerieButt = new PP.Ui.Button({
		ParentNode: document.body, //DOM parent node
		Content: 'Remove Selected Series', //Text
		Click: PP.Delegate(onClickRemoveSerie)
	});
	function onClickRemoveSerie()
	{	
		//Get selected workbook series
		var series = wbk.getActiveSheet().getSelectedSeries();
		//Create a body of server request for removing the selected series
		var body =
				{
					SetWbkMd:
					{
						tWbk: wbk.getOdId(),
						tArg:
						{
							meta:
							{
							 series:
							 {
							  its:
							  {
							   it: series
							  }
							 }
							},
							pattern:
							{
								series: "Remove"
							},
							metaGet: tsService._getGeneralSeriesPattern()
						}
					}
				};
	//It is required to get tabsheet structure to set correct width and height of the remained series
	body.SetWbkMd.tArg.metaGet.getTabSheet = {
		pattern: {
				DHTML: True,
				structure: True
				}
	};
	//Get changed data
	var tcd = wbk.getTableChangedData();
	if (tcd)
	{
		var newtcd = { c: [] };
		for (var i = 0; i < series.length; i++)
		{
			var index = wbk.getRealIndex(undefined, series[i]);
			for (var j = 0; j < tcd.c.length; j++)
			{
				if (tcd.c[j]["@row"] != index)
				{
					if (tcd.c[j]["@row"] > index)
					{
						tcd.c[j]["@row"]--;
					}
					newtcd.c.push(tcd.c[j]);
				}
			}
		}
		//set changed data of express report title.
		wbk.setTableChangedData(newtcd);
	}
	//Set number of workbook series
	wbk.setSeriesCount(wbk.getSeriesCount() - series.length);
	//Refresh list of series
	wbk.updateSeriesList(series, true);
	//Check if the number of workbook series is not equal to 0
	if (wbk.getSeriesCount() == 0)
	{
		wbk.setSelectedSeries([]);
	}
	//Add information about parent series into body of server query
	if (series[0].parent)
	{
		var parentSerie = wbk.getSerie(series[0].parent.k);
		body.SetWbkMd.tArg.metaGet.seriesFilter = {
		range: {
			start: wbk.getRealIndex(undefined, parentSerie),
			count: wbk.getLoadedChildrenCount(parentSerie) + 1
			}
		};
	}
	else
	{
		body.SetWbkMd.tArg.metaGet.seriesFilter = {
		range: {
			start: -1,
			count: 0
			}
		};
	}
	//Set whether workbook is changed
	wbk.setIsChanged(true);
	//Set whether update is required
	wbk.setNeedUpdateSelection(true);
	//Set data source for sheet on the Correlation Matrix tab on statistics panel
	wbk.setStatCorrTabSheetSource(undefined);
	//Set data source for sheet on the Equation tab on statistics panel
	wbk.setStatCoeffTabSheetSource(undefined);
	//Set data source for sheet on the Weight Matrix on statistics panel
	wbk.setStatWeightsTabSheetSource(undefined);				
	tsService._addViewSettings(wbk, body.SetWbkMd);
	//Send query to server
	tsService._invokeRemoteProc(wbk, body, PP.Delegate(onResponse));
	}				
	function onResponse(sender, args)
	{
		//Refresh the workbookBox component
		workbookBox.refreshAll();
	}

After executing the example a button named Remove Selected Series is placed in the HTML page. Clicking this button removes selected series. To ensure that the button is available, selected series must not include child series whose parent is not selected.

See also:

Workbook