getEditSeriesSettings (wbk, series);
wbk. Sets workbook value.
series. Sets series value.
The getEditSeriesSettings method returns body of a request to edit workbook series.
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:
var editSerieButton = new PP.Ui.Button({ ParentNode: document.body, //DOM parent node Content: "Display as Growth Rate for Year Start", //Text Click: PP.Delegate(onClickEditSerie) }); function onClickEditSerie() { //Get selected series var selseries = wbk.getActiveSheet().getSelectedSeries(); var series = []; var i; //Select non-group and non-dependent series for (i = 0; i < selseries.length; i++) { if (!PP.TS.isGroupSerie(selseries[i]) && !PP.TS.isDerivedSerie(selseries[i])) series.push(selseries[i]); } //Create a parameter to be passed to the getEditSeriesSettings method if (series && series.length > 0) { for (i = 0; i < series.length; i++) { var selserie = series[i]; selserie.atts.its.it = []; delete selserie.calc; //Set the Growth Rate for Year Start transformation type selserie.displayParams.inversion = "RateOfChange"; selserie.displayParams.inversionLag = "EndOfPrecedingYear"; selserie.displayParams.previousInversionLag = 1; } } //Get body of server request var body = tsService.getEditSeriesSettings(wbk, series); //Change series wbk.setIsChanged(True); callback = tsService._visitCallback(onRowsEdited, new PP.Delegate(tsService._OnOpened, tsService, { Workbook: wbk })); tsService._send(body, callback); function onRowsEdited(){ //Refresh the workbookBox component workbookBox.refreshAll(); } }
After executing the example the HTML page contains the Show as Growth Rate to the Beginning of the Year button. After clicking this button data in the selected series is converted to the Growth Rate to the Beginning of the Year type. In the Series tab of the side panel, the Growth Rate to the Beginning of the Year item will be selected in the Apply Transformations box of the Primary panel.
See also: