TSService.addWbkSeries

Syntax

addWbkSeries (wbk, hie, dataObjs, period, callback);

Parameters

wbk. Sets workbook value.

hie. Sets series hierarchy.

dataObjs. Sets object that contains information on added series.

period. Sets period.

callback. Sets handler for operation execution end.

Description

The addWbkSeries method adds series to a workbook.

Example

To execute the example, the [age must contain the WorkbookBox component named workbookBox, and service for working with time series tsService (see Example of Creating the WorkbookBox Component), and also add the following code in the handler, that processes document opening event:

var addSerieButton = new PP.Ui.Button({
	ParentNode: document.body, //DOM parent node
	Content: "Add a Series", //Text
	Click: PP.Delegate(onClickAddSerie)
});
function onClickAddSerie()
	{
		//return instance of the PP.TS.Workbook class
		var source = workbookBox.getSource().getActiveSheet();
		//Get element for displaying workbook table
		var gridView = workbookBox.getDataView().getGridView();	
		var index = wbk.getSeries().length;
		//Add series to workbook.
		tsService.addWbkSeries(source, source.getHier(), undefined, {"Index": index, "PeriodLvl": "Month"});
		//Refresh element for displaying workbook table
		gridView.getInstance().reset();
	}

After executing the example the Add Series button is placed in the HTML page. Clicking this button adds a new series named New Series 1 to workbook table.

See also:

TSService