@mcpher/gas-fakes 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +1 -1
- package/src/index.js +1 -0
- package/src/services/chartsapp/app.js +8 -0
- package/src/services/chartsapp/fakechartsapp.js +64 -0
- package/src/services/enums/chartsenums.js +24 -0
- package/src/services/enums/sheetsenums.js +1 -1
- package/src/services/spreadsheetapp/fakeembeddedchart.js +87 -0
- package/src/services/spreadsheetapp/fakeembeddedchartbuilder.js +154 -0
- package/src/services/spreadsheetapp/fakesheet.js +59 -4
package/README.md
CHANGED
|
@@ -181,6 +181,7 @@ As I mentioned earlier, to take this further, I'm going to need a lot of help to
|
|
|
181
181
|
- [oddities](oddities.md) - a collection of oddities uncovered during this project
|
|
182
182
|
- [named colors](named-colors.md)
|
|
183
183
|
- [sandbox](sandbox.md)
|
|
184
|
+
- [senstive scopes](senstive_scopes.md)
|
|
184
185
|
- [using apps script libraries with gas-fakes](libraries.md)
|
|
185
186
|
- [how libhandler works](libhandler.md)
|
|
186
187
|
- [article:using apps script libraries with gas-fakes](https://ramblings.mcpher.com/how-to-use-apps-script-libraries-directly-from-node/)
|
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"name": "@mcpher/gas-fakes",
|
|
35
35
|
"author": "bruce mcpherson",
|
|
36
|
-
"version": "2.0.
|
|
36
|
+
"version": "2.0.6",
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"main": "main.js",
|
|
39
39
|
"description": "An implementation of the Google Workspace Apps Script runtime: Run native App Script Code on Node and Cloud Run",
|
package/src/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import './services/utilities/app.js'
|
|
|
8
8
|
import './services/spreadsheetapp/app.js'
|
|
9
9
|
import './services/gmailapp/app.js'
|
|
10
10
|
import './services/calendarapp/app.js'
|
|
11
|
+
import './services/chartsapp/app.js'
|
|
11
12
|
import './services/session/app.js'
|
|
12
13
|
import './services/advdrive/app.js'
|
|
13
14
|
import './services/advsheets/app.js'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* the idea here is to create an empty global entry for the singleton
|
|
3
|
+
* but only load it when it is actually used.
|
|
4
|
+
*/
|
|
5
|
+
import { lazyLoaderApp } from '../common/lazyloader.js'
|
|
6
|
+
import { newFakeChartsApp as maker } from './fakechartsapp.js'
|
|
7
|
+
let _app = null;
|
|
8
|
+
_app = lazyLoaderApp(_app, 'Charts', maker)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Proxies } from "../../support/proxies.js";
|
|
2
|
+
import { notYetImplemented } from "../../support/helpers.js";
|
|
3
|
+
import * as Enums from "../enums/chartsenums.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* create a new FakeChartsApp instance
|
|
7
|
+
* @param {...any} args
|
|
8
|
+
* @returns {FakeChartsApp}
|
|
9
|
+
*/
|
|
10
|
+
export const newFakeChartsApp = (...args) => {
|
|
11
|
+
return Proxies.guard(new FakeChartsApp(...args));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* basic fake FakeChartsApp
|
|
16
|
+
* @class FakeChartsApp
|
|
17
|
+
* @returns {FakeChartsApp}
|
|
18
|
+
*/
|
|
19
|
+
export class FakeChartsApp {
|
|
20
|
+
constructor() {
|
|
21
|
+
const enumProps = [
|
|
22
|
+
"ChartType", // ChartType An enumeration of the possible chart types.
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
// import all known enums as props of chartsapp
|
|
26
|
+
enumProps.forEach((f) => {
|
|
27
|
+
this[f] = Enums[f];
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const props = [
|
|
31
|
+
"newAreaChart",
|
|
32
|
+
"newBarChart",
|
|
33
|
+
"newColumnChart",
|
|
34
|
+
"newComboChart",
|
|
35
|
+
"newHistogramChart",
|
|
36
|
+
"newLineChart",
|
|
37
|
+
"newPieChart",
|
|
38
|
+
"newScatterChart",
|
|
39
|
+
"newSteppedAreaChart",
|
|
40
|
+
"newWaterfallChart",
|
|
41
|
+
"newScorecardChart",
|
|
42
|
+
"newRadarChart",
|
|
43
|
+
"newGaugeChart",
|
|
44
|
+
"newOrgChart",
|
|
45
|
+
"newTimelineChart",
|
|
46
|
+
"newTreeMapChart",
|
|
47
|
+
"newTableChart",
|
|
48
|
+
"newCandlestickChart",
|
|
49
|
+
"newGeoMapChart",
|
|
50
|
+
"newBubbleChart",
|
|
51
|
+
"newDataTable",
|
|
52
|
+
"newTextStyle",
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
props.forEach((f) => {
|
|
56
|
+
this[f] = () => {
|
|
57
|
+
return notYetImplemented(f);
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
toString() {
|
|
62
|
+
return "Charts";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { newFakeGasenum } from "@mcpher/fake-gasenum";
|
|
2
|
+
|
|
3
|
+
export const ChartType = newFakeGasenum([
|
|
4
|
+
"AREA", // Enum Area chart.
|
|
5
|
+
"BAR", // Enum Bar chart.
|
|
6
|
+
"COLUMN", // Enum Column chart.
|
|
7
|
+
"COMBO", // Enum Combo chart.
|
|
8
|
+
"HISTOGRAM", // Enum Histogram chart.
|
|
9
|
+
"LINE", // Enum Line chart.
|
|
10
|
+
"PIE", // Enum Pie chart.
|
|
11
|
+
"SCATTER", // Enum Scatter chart.
|
|
12
|
+
"STEPPED_AREA", // Enum Stepped area chart.
|
|
13
|
+
"WATERFALL", // Enum Waterfall chart.
|
|
14
|
+
"SCORECARD", // Enum Scorecard chart.
|
|
15
|
+
"RADAR", // Enum Radar chart.
|
|
16
|
+
"GAUGE", // Enum Gauge chart.
|
|
17
|
+
"ORG", // Enum Org chart.
|
|
18
|
+
"TIMELINE", // Enum Timeline chart.
|
|
19
|
+
"TREE_MAP", // Enum Tree map chart.
|
|
20
|
+
"TABLE", // Enum Table chart.
|
|
21
|
+
"CANDLESTICK", // Enum Candlestick chart.
|
|
22
|
+
"GEOMAP", // Enum Geo map chart.
|
|
23
|
+
"BUBBLE", // Enum Bubble chart.
|
|
24
|
+
]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { newFakeGasenum} from "@mcpher/fake-gasenum";
|
|
2
|
+
import { newFakeGasenum } from "@mcpher/fake-gasenum";
|
|
3
3
|
export const AutoFillSeries = newFakeGasenum(["DEFAULT_SERIES", "ALTERNATE_SERIES"])
|
|
4
4
|
export const BandingTheme = newFakeGasenum([
|
|
5
5
|
"LIGHT_GREY", // Enum A light grey banding theme.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Proxies } from "../../support/proxies.js";
|
|
2
|
+
import { notYetImplemented, signatureArgs } from "../../support/helpers.js";
|
|
3
|
+
import { batchUpdate } from "./sheetrangehelpers.js";
|
|
4
|
+
import { newFakeEmbeddedChartBuilder } from "./fakeembeddedchartbuilder.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @returns {FakeEmbeddedChart}
|
|
8
|
+
*/
|
|
9
|
+
export const newFakeEmbeddedChart = (apiChart, sheet) => {
|
|
10
|
+
return Proxies.guard(new FakeEmbeddedChart(apiChart, sheet));
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents a chart that has been embedded into a spreadsheet.
|
|
15
|
+
*/
|
|
16
|
+
export class FakeEmbeddedChart {
|
|
17
|
+
/**
|
|
18
|
+
* @param {object} apiChart The EmbeddedChart object from Sheets API
|
|
19
|
+
* @param {FakeSheet} sheet The parent sheet
|
|
20
|
+
*/
|
|
21
|
+
constructor(apiChart, sheet) {
|
|
22
|
+
this.__apiChart = apiChart;
|
|
23
|
+
this.__sheet = sheet;
|
|
24
|
+
|
|
25
|
+
const props = [
|
|
26
|
+
"getAs",
|
|
27
|
+
"getBlob",
|
|
28
|
+
"getContainerInfo",
|
|
29
|
+
];
|
|
30
|
+
props.forEach((f) => {
|
|
31
|
+
this[f] = () => notYetImplemented(f);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns the ID of this chart.
|
|
37
|
+
* @returns {number}
|
|
38
|
+
*/
|
|
39
|
+
getChartId() {
|
|
40
|
+
return this.__apiChart.chartId;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns the ID of this chart (alias for getChartId).
|
|
45
|
+
* @returns {string}
|
|
46
|
+
*/
|
|
47
|
+
getId() {
|
|
48
|
+
return this.getChartId().toString();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Returns the options of this chart.
|
|
53
|
+
* @returns {object}
|
|
54
|
+
*/
|
|
55
|
+
getOptions() {
|
|
56
|
+
return {
|
|
57
|
+
get: (key) => {
|
|
58
|
+
if (key === "title") return this.__apiChart.spec.title;
|
|
59
|
+
return this.__apiChart.spec.basicChart?.options?.[key];
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns a builder to modify this chart.
|
|
66
|
+
* @returns {FakeEmbeddedChartBuilder}
|
|
67
|
+
*/
|
|
68
|
+
modify() {
|
|
69
|
+
return newFakeEmbeddedChartBuilder(this.__sheet).setChartId(this.getChartId()).setApiChart(this.__apiChart);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Deletes the chart from the sheet.
|
|
74
|
+
*/
|
|
75
|
+
remove() {
|
|
76
|
+
const request = {
|
|
77
|
+
deleteEmbeddedObject: {
|
|
78
|
+
objectId: this.getChartId(),
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
batchUpdate({ spreadsheet: this.__sheet.getParent(), requests: [request] });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
toString() {
|
|
85
|
+
return "EmbeddedChart";
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Proxies } from "../../support/proxies.js";
|
|
2
|
+
import { signatureArgs } from "../../support/helpers.js";
|
|
3
|
+
import { Utils } from "../../support/utils.js";
|
|
4
|
+
import { makeSheetsGridRange } from "./sheetrangehelpers.js";
|
|
5
|
+
import { newFakeEmbeddedChart } from "./fakeembeddedchart.js";
|
|
6
|
+
|
|
7
|
+
const { is } = Utils;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @returns {FakeEmbeddedChartBuilder}
|
|
11
|
+
*/
|
|
12
|
+
export const newFakeEmbeddedChartBuilder = (sheet) => {
|
|
13
|
+
return Proxies.guard(new FakeEmbeddedChartBuilder(sheet));
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Builder for embedded charts.
|
|
18
|
+
*/
|
|
19
|
+
export class FakeEmbeddedChartBuilder {
|
|
20
|
+
constructor(sheet) {
|
|
21
|
+
this.__sheet = sheet;
|
|
22
|
+
this.__apiChart = {
|
|
23
|
+
spec: {
|
|
24
|
+
title: "",
|
|
25
|
+
basicChart: {
|
|
26
|
+
chartType: "COLUMN", // Default
|
|
27
|
+
legendPosition: "RIGHT_LEGEND",
|
|
28
|
+
axis: [],
|
|
29
|
+
domains: [],
|
|
30
|
+
series: [],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
position: {
|
|
34
|
+
overlayPosition: {
|
|
35
|
+
anchorCell: {
|
|
36
|
+
sheetId: sheet.getSheetId(),
|
|
37
|
+
rowIndex: 0,
|
|
38
|
+
columnIndex: 0,
|
|
39
|
+
},
|
|
40
|
+
offsetXPixels: 0,
|
|
41
|
+
offsetYPixels: 0,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
setChartId(id) {
|
|
48
|
+
this.__apiChart.chartId = id;
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
setApiChart(apiChart) {
|
|
53
|
+
this.__apiChart = JSON.parse(JSON.stringify(apiChart));
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
addRange(range) {
|
|
58
|
+
const { nargs, matchThrow } = signatureArgs(arguments, "EmbeddedChartBuilder.addRange");
|
|
59
|
+
if (nargs !== 1) matchThrow();
|
|
60
|
+
|
|
61
|
+
const gridRange = makeSheetsGridRange(range);
|
|
62
|
+
|
|
63
|
+
// In Sheets API, ranges are usually mapped to domains or series.
|
|
64
|
+
// Simplifying: if the range has multiple columns, split it into separate sources if it's a series.
|
|
65
|
+
// But for this fake, we'll just encourage the user to use single-column ranges or handle it simply.
|
|
66
|
+
|
|
67
|
+
if (this.__apiChart.spec.basicChart.domains.length === 0) {
|
|
68
|
+
this.__apiChart.spec.basicChart.domains.push({
|
|
69
|
+
domain: { sourceRange: { sources: [gridRange] } },
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
// Check if gridRange has multiple columns/rows and split if necessary?
|
|
73
|
+
// For now, just add it. The test will be updated to use single column ranges.
|
|
74
|
+
this.__apiChart.spec.basicChart.series.push({
|
|
75
|
+
series: { sourceRange: { sources: [gridRange] } },
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
setChartType(type) {
|
|
82
|
+
const { nargs, matchThrow } = signatureArgs(arguments, "EmbeddedChartBuilder.setChartType");
|
|
83
|
+
if (nargs !== 1) matchThrow();
|
|
84
|
+
|
|
85
|
+
// type is Charts.ChartType enum (which should match API strings in our fakes)
|
|
86
|
+
this.__apiChart.spec.basicChart.chartType = type.toString();
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Returns the chart type.
|
|
92
|
+
* @returns {ChartType}
|
|
93
|
+
*/
|
|
94
|
+
getChartType() {
|
|
95
|
+
const spec = this.__apiChart.spec;
|
|
96
|
+
const chartType = Charts.ChartType;
|
|
97
|
+
if (spec.basicChart) return chartType[spec.basicChart.chartType];
|
|
98
|
+
if (spec.pieChart) return chartType.PIE;
|
|
99
|
+
if (spec.bubbleChart) return chartType.BUBBLE;
|
|
100
|
+
if (spec.candlestickChart) return chartType.CANDLESTICK;
|
|
101
|
+
if (spec.orgChart) return chartType.ORG;
|
|
102
|
+
if (spec.waterfallChart) return chartType.WATERFALL;
|
|
103
|
+
if (spec.treemapChart) return chartType.TREE_MAP;
|
|
104
|
+
if (spec.scorecardChart) return chartType.SCORECARD;
|
|
105
|
+
if (spec.histogramChart) return chartType.HISTOGRAM;
|
|
106
|
+
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
setPosition(anchorRowPos, anchorColPos, offsetX, offsetY) {
|
|
111
|
+
const { nargs, matchThrow } = signatureArgs(arguments, "EmbeddedChartBuilder.setPosition");
|
|
112
|
+
if (nargs !== 4) matchThrow();
|
|
113
|
+
|
|
114
|
+
this.__apiChart.position.overlayPosition.anchorCell.rowIndex = anchorRowPos - 1;
|
|
115
|
+
this.__apiChart.position.overlayPosition.anchorCell.columnIndex = anchorColPos - 1;
|
|
116
|
+
this.__apiChart.position.overlayPosition.offsetXPixels = offsetX;
|
|
117
|
+
this.__apiChart.position.overlayPosition.offsetYPixels = offsetY;
|
|
118
|
+
return this;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
setOption(option, value) {
|
|
122
|
+
const { nargs, matchThrow } = signatureArgs(arguments, "EmbeddedChartBuilder.setOption");
|
|
123
|
+
if (nargs !== 2) matchThrow();
|
|
124
|
+
|
|
125
|
+
if (option === "title") {
|
|
126
|
+
this.__apiChart.spec.title = value;
|
|
127
|
+
} else {
|
|
128
|
+
// For other options, we might want to store them in a general options object if needed,
|
|
129
|
+
// but for now, we'll just focus on "title" as requested.
|
|
130
|
+
// SpreadsheetApp.EmbeddedChartBuilder.setOption(option, value)
|
|
131
|
+
if (!this.__apiChart.spec.basicChart.options) {
|
|
132
|
+
this.__apiChart.spec.basicChart.options = {};
|
|
133
|
+
}
|
|
134
|
+
this.__apiChart.spec.basicChart.options[option] = value;
|
|
135
|
+
}
|
|
136
|
+
return this;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
build() {
|
|
140
|
+
const { nargs, matchThrow } = signatureArgs(arguments, "EmbeddedChartBuilder.build");
|
|
141
|
+
if (nargs !== 0) matchThrow();
|
|
142
|
+
|
|
143
|
+
// In a real GAS, build() returns an EmbeddedChart that is NOT yet inserted.
|
|
144
|
+
// Here we return the api object wrapped in a FakeEmbeddedChart if needed,
|
|
145
|
+
// or just the raw object that insertChart will use.
|
|
146
|
+
// Actually, gas.Sheet.insertChart expects an EmbeddedChart object.
|
|
147
|
+
return newFakeEmbeddedChart(this.__apiChart, this.__sheet);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
toString() {
|
|
151
|
+
const hex = Math.floor(Math.random() * 0xffffffff).toString(16).padStart(8, "0");
|
|
152
|
+
return `com.google.apps.maestro.server.beans.trix.impl.ChartPropertyApiEmbeddedChartBuilder@${hex}`;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -14,6 +14,8 @@ import { FakeTextFinder, newFakeTextFinder } from "./faketextfinder.js";
|
|
|
14
14
|
import { newFakeNamedRange } from "./fakenamedrange.js";
|
|
15
15
|
import { newFakeProtection } from "./fakeprotection.js";
|
|
16
16
|
import { newFakeOverGridImage } from "./fakeovergridimage.js";
|
|
17
|
+
import { newFakeEmbeddedChart } from "./fakeembeddedchart.js";
|
|
18
|
+
import { newFakeEmbeddedChartBuilder } from "./fakeembeddedchartbuilder.js";
|
|
17
19
|
|
|
18
20
|
import { XMLParser } from "fast-xml-parser";
|
|
19
21
|
import { slogger } from "../../support/slogger.js";
|
|
@@ -34,10 +36,6 @@ export class FakeSheet {
|
|
|
34
36
|
this.__parent = parent;
|
|
35
37
|
|
|
36
38
|
const props = [
|
|
37
|
-
"getCharts",
|
|
38
|
-
"insertChart",
|
|
39
|
-
"removeChart",
|
|
40
|
-
"updateChart",
|
|
41
39
|
// "getImages",
|
|
42
40
|
"insertImage",
|
|
43
41
|
"removeImage",
|
|
@@ -399,6 +397,63 @@ export class FakeSheet {
|
|
|
399
397
|
return pivotTables;
|
|
400
398
|
}
|
|
401
399
|
|
|
400
|
+
getCharts() {
|
|
401
|
+
const { nargs, matchThrow } = signatureArgs(arguments, "Sheet.getCharts");
|
|
402
|
+
if (nargs !== 0) matchThrow();
|
|
403
|
+
|
|
404
|
+
const meta = this.getParent().__getMetaProps(
|
|
405
|
+
`sheets(charts,properties.sheetId)`
|
|
406
|
+
);
|
|
407
|
+
const sheetMeta = meta.sheets.find(
|
|
408
|
+
(s) => s.properties.sheetId === this.getSheetId()
|
|
409
|
+
);
|
|
410
|
+
|
|
411
|
+
return (sheetMeta?.charts || []).map((c) => newFakeEmbeddedChart(c, this));
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
insertChart(chart) {
|
|
415
|
+
const { nargs, matchThrow } = signatureArgs(arguments, "Sheet.insertChart");
|
|
416
|
+
if (nargs !== 1 || !is.object(chart)) matchThrow();
|
|
417
|
+
|
|
418
|
+
const request = {
|
|
419
|
+
addChart: {
|
|
420
|
+
chart: chart.__apiChart,
|
|
421
|
+
},
|
|
422
|
+
};
|
|
423
|
+
batchUpdate({ spreadsheet: this.getParent(), requests: [request] });
|
|
424
|
+
return this;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
newChart() {
|
|
428
|
+
const { nargs, matchThrow } = signatureArgs(arguments, "Sheet.newChart");
|
|
429
|
+
if (nargs !== 0) matchThrow();
|
|
430
|
+
|
|
431
|
+
return newFakeEmbeddedChartBuilder(this);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
removeChart(chart) {
|
|
435
|
+
const { nargs, matchThrow } = signatureArgs(arguments, "Sheet.removeChart");
|
|
436
|
+
if (nargs !== 1 || !is.object(chart)) matchThrow();
|
|
437
|
+
|
|
438
|
+
chart.remove();
|
|
439
|
+
return this;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
updateChart(chart) {
|
|
443
|
+
const { nargs, matchThrow } = signatureArgs(arguments, "Sheet.updateChart");
|
|
444
|
+
if (nargs !== 1 || !is.object(chart)) matchThrow();
|
|
445
|
+
|
|
446
|
+
const request = {
|
|
447
|
+
updateEmbeddedObjectPosition: {
|
|
448
|
+
objectId: chart.getChartId(),
|
|
449
|
+
newPosition: chart.__apiChart.position,
|
|
450
|
+
fields: "*",
|
|
451
|
+
},
|
|
452
|
+
};
|
|
453
|
+
batchUpdate({ spreadsheet: this.getParent(), requests: [request] });
|
|
454
|
+
return this;
|
|
455
|
+
}
|
|
456
|
+
|
|
402
457
|
getBandings() {
|
|
403
458
|
const meta = this.getParent().__getMetaProps(
|
|
404
459
|
`sheets(bandedRanges,properties.sheetId)`
|