@devmm/puredocs-excel-charts 1.0.0
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/LICENSE +21 -0
- package/README.md +226 -0
- package/dist/index.cjs +364 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +148 -0
- package/dist/index.d.ts +148 -0
- package/dist/index.js +359 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TVE
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# @devmm/puredocs-excel-charts
|
|
2
|
+
|
|
3
|
+
> Chart support for [`@devmm/puredocs-excel`](../core). Generates valid OOXML chart
|
|
4
|
+
> parts (column, bar, line, area, pie, doughnut, radar, scatter, bubble) and embeds
|
|
5
|
+
> them into a workbook — no dependency other than the core package.
|
|
6
|
+
|
|
7
|
+
[](../../LICENSE)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @devmm/puredocs-excel @devmm/puredocs-excel-charts
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`@devmm/puredocs-excel` is a peer dependency.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { Workbook } from '@devmm/puredocs-excel';
|
|
25
|
+
import { ExcelChart, ExcelChartType, ChartLegendPosition } from '@devmm/puredocs-excel-charts';
|
|
26
|
+
|
|
27
|
+
const wb = Workbook.create();
|
|
28
|
+
const sheet = wb.addWorksheet('Sales');
|
|
29
|
+
|
|
30
|
+
sheet.getRange('A1:B5').setValues([
|
|
31
|
+
['Month', 'Revenue'],
|
|
32
|
+
['Jan', 120], ['Feb', 150], ['Mar', 130], ['Apr', 180],
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
ExcelChart.create(ExcelChartType.ColumnClustered)
|
|
36
|
+
.setAnchor({ from: 'D2', to: 'K20' })
|
|
37
|
+
.setTitle('Monthly Revenue')
|
|
38
|
+
.addSeries({ name: 'Sales!$B$1', values: 'Sales!$B$2:$B$5', categories: 'Sales!$A$2:$A$5' })
|
|
39
|
+
.configureValueAxis(a => { a.numberFormat = '#,##0'; a.title = 'VND'; })
|
|
40
|
+
.configureLegend(l => { l.position = ChartLegendPosition.Bottom; })
|
|
41
|
+
.showDataLabels({ value: true })
|
|
42
|
+
.addTo(sheet);
|
|
43
|
+
|
|
44
|
+
await wb.saveToFile('./report.xlsx');
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
> **Ranges must be absolute and sheet-qualified**, e.g. `Sheet1!$B$2:$B$5`.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Chart types
|
|
52
|
+
|
|
53
|
+
`ExcelChart.create(type)` accepts any [`ExcelChartType`](./src/chart-enums.ts):
|
|
54
|
+
|
|
55
|
+
| Family | Types |
|
|
56
|
+
|---|---|
|
|
57
|
+
| Column / Bar | `ColumnClustered`, `ColumnStacked`, `BarClustered`, `BarStacked` |
|
|
58
|
+
| Line | `Line`, `LineMarkers` |
|
|
59
|
+
| Area | `Area` |
|
|
60
|
+
| Pie | `Pie`, `Doughnut` |
|
|
61
|
+
| Radar | `Radar`, `RadarMarkers`, `RadarFilled` |
|
|
62
|
+
| XY | `Scatter`, `ScatterLines`, `ScatterSmooth`, `Bubble` |
|
|
63
|
+
|
|
64
|
+
**Series data by family:**
|
|
65
|
+
|
|
66
|
+
| Family | `categories` | `values` | `bubbleSize` |
|
|
67
|
+
|---|---|---|---|
|
|
68
|
+
| Column/Bar/Line/Area/Pie/Doughnut/Radar | X labels | Y values | — |
|
|
69
|
+
| Scatter | X values | Y values | — |
|
|
70
|
+
| Bubble | X values | Y values | bubble sizes |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## API
|
|
75
|
+
|
|
76
|
+
### `ExcelChart.create(type): ExcelChart`
|
|
77
|
+
|
|
78
|
+
Static factory. All configuration methods are fluent (return `this`).
|
|
79
|
+
|
|
80
|
+
| Method | Description |
|
|
81
|
+
|---|---|
|
|
82
|
+
| `setAnchor(anchor)` | Position: `{ from: 'D2', to: 'K20' }` or `{ fromRow, fromCol, toRow, toCol }` (0-based) |
|
|
83
|
+
| `setTitle(text)` | Chart title |
|
|
84
|
+
| `addSeries(series)` | Add a data series (see [`ChartSeries`](#chartseries)) |
|
|
85
|
+
| `configureLegend(fn)` | `fn(legend)` → set `legend.position` ([`ChartLegendPosition`](./src/chart-enums.ts)) |
|
|
86
|
+
| `configureCategoryAxis(fn)` | `fn(axis)` → set title / numberFormat / min / max / majorGridlines |
|
|
87
|
+
| `configureValueAxis(fn)` | Same, for the primary value axis |
|
|
88
|
+
| `configureSecondaryValueAxis(fn)` | Same, for the secondary value axis (combo charts) |
|
|
89
|
+
| `setSecondaryType(type)` | Chart type for `secondaryAxis` series (default `Line`) |
|
|
90
|
+
| `showDataLabels(config?)` | Toggle labels: `{ value?, category?, series?, percent? }` (default `{ value: true }`) |
|
|
91
|
+
| `setGapWidth(n)` | Bar/column gap width (%) |
|
|
92
|
+
| `setHoleSize(pct)` | Doughnut hole size (10–90) |
|
|
93
|
+
| `addTo(sheet)` | Attach to a `Worksheet` |
|
|
94
|
+
|
|
95
|
+
### `ChartSeries`
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
interface ChartSeries {
|
|
99
|
+
name?: string; // ref (contains '!') or literal
|
|
100
|
+
values: string; // Y range (absolute, sheet-qualified)
|
|
101
|
+
categories?: string; // X range / labels
|
|
102
|
+
bubbleSize?: string; // bubble charts only
|
|
103
|
+
color?: ExcelColor | string; // '#RRGGBB' or ExcelColor
|
|
104
|
+
secondaryAxis?: boolean; // plot on the secondary axis (combo)
|
|
105
|
+
trendline?: ChartTrendline; // regression line
|
|
106
|
+
pointColors?: (ExcelColor | string)[]; // per-data-point colours
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### `ChartTrendline`
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
interface ChartTrendline {
|
|
114
|
+
type: TrendlineType; // Linear | Exponential | Logarithmic | MovingAverage | Polynomial | Power
|
|
115
|
+
order?: number; // Polynomial order (2–6)
|
|
116
|
+
period?: number; // MovingAverage period
|
|
117
|
+
displayEquation?: boolean;
|
|
118
|
+
displayRSquared?: boolean;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Examples
|
|
125
|
+
|
|
126
|
+
### Multi-series column with data labels
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
ExcelChart.create(ExcelChartType.ColumnClustered)
|
|
130
|
+
.setTitle('Revenue vs Cost')
|
|
131
|
+
.addSeries({ name: 'Sales!$B$1', values: 'Sales!$B$2:$B$5', categories: 'Sales!$A$2:$A$5' })
|
|
132
|
+
.addSeries({ name: 'Sales!$C$1', values: 'Sales!$C$2:$C$5', categories: 'Sales!$A$2:$A$5' })
|
|
133
|
+
.showDataLabels({ value: true })
|
|
134
|
+
.addTo(sheet);
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Pie with per-slice colours and percentages
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
ExcelChart.create(ExcelChartType.Pie)
|
|
141
|
+
.setTitle('Revenue share')
|
|
142
|
+
.addSeries({
|
|
143
|
+
values: 'Sales!$B$2:$B$5',
|
|
144
|
+
categories: 'Sales!$A$2:$A$5',
|
|
145
|
+
pointColors: ['#4472C4', '#ED7D31', '#A5A5A5', '#FFC000'],
|
|
146
|
+
})
|
|
147
|
+
.showDataLabels({ percent: true })
|
|
148
|
+
.addTo(sheet);
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Doughnut
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
ExcelChart.create(ExcelChartType.Doughnut)
|
|
155
|
+
.setHoleSize(60)
|
|
156
|
+
.addSeries({ values: 'Sales!$B$2:$B$5', categories: 'Sales!$A$2:$A$5' })
|
|
157
|
+
.addTo(sheet);
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Scatter with a linear trendline
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
import { TrendlineType } from '@devmm/puredocs-excel-charts';
|
|
164
|
+
|
|
165
|
+
ExcelChart.create(ExcelChartType.Scatter)
|
|
166
|
+
.setTitle('Cost vs Revenue')
|
|
167
|
+
.addSeries({
|
|
168
|
+
name: 'corr',
|
|
169
|
+
categories: 'Sales!$C$2:$C$5', // X
|
|
170
|
+
values: 'Sales!$B$2:$B$5', // Y
|
|
171
|
+
trendline: { type: TrendlineType.Linear, displayEquation: true, displayRSquared: true },
|
|
172
|
+
})
|
|
173
|
+
.configureCategoryAxis(a => { a.title = 'Cost'; })
|
|
174
|
+
.configureValueAxis(a => { a.title = 'Revenue'; })
|
|
175
|
+
.addTo(sheet);
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Bubble
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
ExcelChart.create(ExcelChartType.Bubble)
|
|
182
|
+
.addSeries({
|
|
183
|
+
categories: 'Data!$A$2:$A$6', // X
|
|
184
|
+
values: 'Data!$B$2:$B$6', // Y
|
|
185
|
+
bubbleSize: 'Data!$C$2:$C$6',
|
|
186
|
+
})
|
|
187
|
+
.addTo(sheet);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Combo chart (column + line on a secondary axis)
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
ExcelChart.create(ExcelChartType.ColumnClustered)
|
|
194
|
+
.setTitle('Revenue vs Margin')
|
|
195
|
+
.addSeries({ name: 'Data!$B$1', values: 'Data!$B$2:$B$6', categories: 'Data!$A$2:$A$6' })
|
|
196
|
+
.addSeries({ name: 'Data!$D$1', values: 'Data!$D$2:$D$6', categories: 'Data!$A$2:$A$6',
|
|
197
|
+
secondaryAxis: true, color: '#ED7D31' })
|
|
198
|
+
.setSecondaryType(ExcelChartType.LineMarkers)
|
|
199
|
+
.configureValueAxis(a => { a.title = 'VND'; a.numberFormat = '#,##0'; })
|
|
200
|
+
.configureSecondaryValueAxis(a => { a.title = 'Margin %'; a.numberFormat = '0"%"'; })
|
|
201
|
+
.addTo(sheet);
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Multiple charts on one sheet
|
|
205
|
+
|
|
206
|
+
Call `.addTo(sheet)` several times — all charts are aggregated into a single drawing
|
|
207
|
+
part automatically:
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
ExcelChart.create(ExcelChartType.ColumnClustered).setAnchor({ from: 'E1', to: 'L16' })
|
|
211
|
+
.addSeries({ values: 'S!$B$2:$B$5', categories: 'S!$A$2:$A$5' }).addTo(sheet);
|
|
212
|
+
ExcelChart.create(ExcelChartType.Line).setAnchor({ from: 'E18', to: 'L33' })
|
|
213
|
+
.addSeries({ values: 'S!$B$2:$B$5', categories: 'S!$A$2:$A$5' }).addTo(sheet);
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Notes & limitations
|
|
219
|
+
|
|
220
|
+
- Ranges are **not** validated against the worksheet; pass correct absolute refs.
|
|
221
|
+
- Charts are **write-only** in this version — they are not read back when loading a file.
|
|
222
|
+
- Not yet supported: error bars, 3D views. See [`DESIGN.md`](./DESIGN.md) for the roadmap.
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
MIT © TVE
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var puredocsExcel = require('@devmm/puredocs-excel');
|
|
4
|
+
|
|
5
|
+
var __typeError = (msg) => {
|
|
6
|
+
throw TypeError(msg);
|
|
7
|
+
};
|
|
8
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
9
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
10
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
11
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
12
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
13
|
+
|
|
14
|
+
// src/chart-enums.ts
|
|
15
|
+
var ExcelChartType = /* @__PURE__ */ ((ExcelChartType2) => {
|
|
16
|
+
ExcelChartType2["ColumnClustered"] = "columnClustered";
|
|
17
|
+
ExcelChartType2["ColumnStacked"] = "columnStacked";
|
|
18
|
+
ExcelChartType2["BarClustered"] = "barClustered";
|
|
19
|
+
ExcelChartType2["BarStacked"] = "barStacked";
|
|
20
|
+
ExcelChartType2["Line"] = "line";
|
|
21
|
+
ExcelChartType2["LineMarkers"] = "lineMarkers";
|
|
22
|
+
ExcelChartType2["Area"] = "area";
|
|
23
|
+
ExcelChartType2["Pie"] = "pie";
|
|
24
|
+
ExcelChartType2["Doughnut"] = "doughnut";
|
|
25
|
+
ExcelChartType2["Radar"] = "radar";
|
|
26
|
+
ExcelChartType2["RadarMarkers"] = "radarMarkers";
|
|
27
|
+
ExcelChartType2["RadarFilled"] = "radarFilled";
|
|
28
|
+
ExcelChartType2["Scatter"] = "scatter";
|
|
29
|
+
ExcelChartType2["ScatterLines"] = "scatterLines";
|
|
30
|
+
ExcelChartType2["ScatterSmooth"] = "scatterSmooth";
|
|
31
|
+
ExcelChartType2["Bubble"] = "bubble";
|
|
32
|
+
return ExcelChartType2;
|
|
33
|
+
})(ExcelChartType || {});
|
|
34
|
+
var TrendlineType = /* @__PURE__ */ ((TrendlineType2) => {
|
|
35
|
+
TrendlineType2["Linear"] = "linear";
|
|
36
|
+
TrendlineType2["Exponential"] = "exp";
|
|
37
|
+
TrendlineType2["Logarithmic"] = "log";
|
|
38
|
+
TrendlineType2["MovingAverage"] = "movingAvg";
|
|
39
|
+
TrendlineType2["Polynomial"] = "poly";
|
|
40
|
+
TrendlineType2["Power"] = "power";
|
|
41
|
+
return TrendlineType2;
|
|
42
|
+
})(TrendlineType || {});
|
|
43
|
+
var ChartLegendPosition = /* @__PURE__ */ ((ChartLegendPosition2) => {
|
|
44
|
+
ChartLegendPosition2["Right"] = "r";
|
|
45
|
+
ChartLegendPosition2["Left"] = "l";
|
|
46
|
+
ChartLegendPosition2["Top"] = "t";
|
|
47
|
+
ChartLegendPosition2["Bottom"] = "b";
|
|
48
|
+
ChartLegendPosition2["TopRight"] = "tr";
|
|
49
|
+
ChartLegendPosition2["None"] = "none";
|
|
50
|
+
return ChartLegendPosition2;
|
|
51
|
+
})(ChartLegendPosition || {});
|
|
52
|
+
|
|
53
|
+
// src/excel-chart.ts
|
|
54
|
+
var CHART_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
55
|
+
var CAT_AX_ID = 111111111;
|
|
56
|
+
var VAL_AX_ID = 222222222;
|
|
57
|
+
var SEC_VAL_AX_ID = 333333333;
|
|
58
|
+
var SEC_CAT_AX_ID = 444444444;
|
|
59
|
+
var CARTESIAN = /* @__PURE__ */ new Set(["barChart", "lineChart", "areaChart"]);
|
|
60
|
+
function resolveFamily(type) {
|
|
61
|
+
const base = {
|
|
62
|
+
seriesKind: "category",
|
|
63
|
+
isPieLike: false,
|
|
64
|
+
hasAxes: true,
|
|
65
|
+
markers: false,
|
|
66
|
+
smooth: false,
|
|
67
|
+
colorAsLine: false,
|
|
68
|
+
catAxPos: "b",
|
|
69
|
+
valAxPos: "l"
|
|
70
|
+
};
|
|
71
|
+
switch (type) {
|
|
72
|
+
case "columnClustered" /* ColumnClustered */:
|
|
73
|
+
return { ...base, element: "barChart", barDir: "col", grouping: "clustered", overlap: -27 };
|
|
74
|
+
case "columnStacked" /* ColumnStacked */:
|
|
75
|
+
return { ...base, element: "barChart", barDir: "col", grouping: "stacked", overlap: 100 };
|
|
76
|
+
case "barClustered" /* BarClustered */:
|
|
77
|
+
return { ...base, element: "barChart", barDir: "bar", grouping: "clustered", overlap: -27, catAxPos: "l", valAxPos: "b" };
|
|
78
|
+
case "barStacked" /* BarStacked */:
|
|
79
|
+
return { ...base, element: "barChart", barDir: "bar", grouping: "stacked", overlap: 100, catAxPos: "l", valAxPos: "b" };
|
|
80
|
+
case "line" /* Line */:
|
|
81
|
+
return { ...base, element: "lineChart", grouping: "standard", colorAsLine: true };
|
|
82
|
+
case "lineMarkers" /* LineMarkers */:
|
|
83
|
+
return { ...base, element: "lineChart", grouping: "standard", markers: true, colorAsLine: true };
|
|
84
|
+
case "area" /* Area */:
|
|
85
|
+
return { ...base, element: "areaChart", grouping: "standard" };
|
|
86
|
+
case "pie" /* Pie */:
|
|
87
|
+
return { ...base, element: "pieChart", isPieLike: true, hasAxes: false };
|
|
88
|
+
case "doughnut" /* Doughnut */:
|
|
89
|
+
return { ...base, element: "doughnutChart", isPieLike: true, hasAxes: false, holeSize: 50 };
|
|
90
|
+
case "radar" /* Radar */:
|
|
91
|
+
return { ...base, element: "radarChart", radarStyle: "standard", colorAsLine: true };
|
|
92
|
+
case "radarMarkers" /* RadarMarkers */:
|
|
93
|
+
return { ...base, element: "radarChart", radarStyle: "marker", markers: true, colorAsLine: true };
|
|
94
|
+
case "radarFilled" /* RadarFilled */:
|
|
95
|
+
return { ...base, element: "radarChart", radarStyle: "filled" };
|
|
96
|
+
case "scatter" /* Scatter */:
|
|
97
|
+
return { ...base, element: "scatterChart", seriesKind: "xy", scatterStyle: "marker", markers: true, colorAsLine: true };
|
|
98
|
+
case "scatterLines" /* ScatterLines */:
|
|
99
|
+
return { ...base, element: "scatterChart", seriesKind: "xy", scatterStyle: "lineMarker", markers: true, colorAsLine: true };
|
|
100
|
+
case "scatterSmooth" /* ScatterSmooth */:
|
|
101
|
+
return { ...base, element: "scatterChart", seriesKind: "xy", scatterStyle: "smoothMarker", markers: true, smooth: true, colorAsLine: true };
|
|
102
|
+
case "bubble" /* Bubble */:
|
|
103
|
+
return { ...base, element: "bubbleChart", seriesKind: "bubble" };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function toSrgb(color) {
|
|
107
|
+
const raw = typeof color === "string" ? color : color.toXmlAttrs().rgb ?? "FF000000";
|
|
108
|
+
const hex = raw.replace(/[^0-9a-fA-F]/g, "");
|
|
109
|
+
return (hex.length >= 6 ? hex.slice(-6) : hex.padStart(6, "0")).toUpperCase();
|
|
110
|
+
}
|
|
111
|
+
function numRef(ref) {
|
|
112
|
+
return `<c:numRef><c:f>${puredocsExcel.escapeXml(ref)}</c:f></c:numRef>`;
|
|
113
|
+
}
|
|
114
|
+
function strRef(ref) {
|
|
115
|
+
return `<c:strRef><c:f>${puredocsExcel.escapeXml(ref)}</c:f></c:strRef>`;
|
|
116
|
+
}
|
|
117
|
+
var _type, _family, _secondaryType, _anchor, _title, _series, _legend, _categoryAxis, _valueAxis, _secondaryValueAxis, _dataLabels, _gapWidth, _holeSize, _ExcelChart_instances, hasSecondary_fn, buildPlotElement_fn, cartesianGroupXml_fn, seriesGroupXml_fn, buildSeriesXml_fn, buildDataPointsXml_fn, buildTrendlineXml_fn, seriesColorXml_fn, refOrLiteral_fn, buildDataLabelsXml_fn, buildAxesXml_fn, buildCatAx_fn, buildValAx_fn, buildTitleXml_fn;
|
|
118
|
+
var _ExcelChart = class _ExcelChart {
|
|
119
|
+
constructor(type) {
|
|
120
|
+
__privateAdd(this, _ExcelChart_instances);
|
|
121
|
+
__privateAdd(this, _type);
|
|
122
|
+
__privateAdd(this, _family);
|
|
123
|
+
__privateAdd(this, _secondaryType, "line" /* Line */);
|
|
124
|
+
__privateAdd(this, _anchor, { fromCol: 0, fromRow: 0, toCol: 8, toRow: 15 });
|
|
125
|
+
__privateAdd(this, _title);
|
|
126
|
+
__privateAdd(this, _series, []);
|
|
127
|
+
__privateAdd(this, _legend, { position: "r" /* Right */ });
|
|
128
|
+
__privateAdd(this, _categoryAxis, {});
|
|
129
|
+
__privateAdd(this, _valueAxis, { majorGridlines: true });
|
|
130
|
+
__privateAdd(this, _secondaryValueAxis, {});
|
|
131
|
+
__privateAdd(this, _dataLabels);
|
|
132
|
+
__privateAdd(this, _gapWidth, 150);
|
|
133
|
+
__privateAdd(this, _holeSize);
|
|
134
|
+
__privateSet(this, _type, type);
|
|
135
|
+
__privateSet(this, _family, resolveFamily(type));
|
|
136
|
+
__privateSet(this, _holeSize, __privateGet(this, _family).holeSize);
|
|
137
|
+
}
|
|
138
|
+
/** Creates a chart of the given type. */
|
|
139
|
+
static create(type) {
|
|
140
|
+
return new _ExcelChart(type);
|
|
141
|
+
}
|
|
142
|
+
/** The chart type. */
|
|
143
|
+
get type() {
|
|
144
|
+
return __privateGet(this, _type);
|
|
145
|
+
}
|
|
146
|
+
// ── Fluent configuration ──────────────────────────────────────────────────
|
|
147
|
+
setAnchor(anchor) {
|
|
148
|
+
if ("from" in anchor) {
|
|
149
|
+
const f = puredocsExcel.parseCellRef(anchor.from);
|
|
150
|
+
const t = puredocsExcel.parseCellRef(anchor.to);
|
|
151
|
+
__privateSet(this, _anchor, { fromCol: f.column - 1, fromRow: f.row - 1, toCol: t.column - 1, toRow: t.row - 1 });
|
|
152
|
+
} else {
|
|
153
|
+
__privateSet(this, _anchor, { fromCol: anchor.fromCol, fromRow: anchor.fromRow, toCol: anchor.toCol, toRow: anchor.toRow });
|
|
154
|
+
}
|
|
155
|
+
return this;
|
|
156
|
+
}
|
|
157
|
+
setTitle(title) {
|
|
158
|
+
__privateSet(this, _title, title);
|
|
159
|
+
return this;
|
|
160
|
+
}
|
|
161
|
+
addSeries(series) {
|
|
162
|
+
__privateGet(this, _series).push(series);
|
|
163
|
+
return this;
|
|
164
|
+
}
|
|
165
|
+
configureLegend(fn) {
|
|
166
|
+
fn(__privateGet(this, _legend));
|
|
167
|
+
return this;
|
|
168
|
+
}
|
|
169
|
+
configureCategoryAxis(fn) {
|
|
170
|
+
fn(__privateGet(this, _categoryAxis));
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
configureValueAxis(fn) {
|
|
174
|
+
fn(__privateGet(this, _valueAxis));
|
|
175
|
+
return this;
|
|
176
|
+
}
|
|
177
|
+
configureSecondaryValueAxis(fn) {
|
|
178
|
+
fn(__privateGet(this, _secondaryValueAxis));
|
|
179
|
+
return this;
|
|
180
|
+
}
|
|
181
|
+
/** Chart type used for series flagged `secondaryAxis` (default `Line`). */
|
|
182
|
+
setSecondaryType(type) {
|
|
183
|
+
__privateSet(this, _secondaryType, type);
|
|
184
|
+
return this;
|
|
185
|
+
}
|
|
186
|
+
showDataLabels(config = { value: true }) {
|
|
187
|
+
__privateSet(this, _dataLabels, config);
|
|
188
|
+
return this;
|
|
189
|
+
}
|
|
190
|
+
setGapWidth(gapWidth) {
|
|
191
|
+
__privateSet(this, _gapWidth, gapWidth);
|
|
192
|
+
return this;
|
|
193
|
+
}
|
|
194
|
+
/** Doughnut hole size as a percentage (10–90). Ignored by non-doughnut charts. */
|
|
195
|
+
setHoleSize(percent) {
|
|
196
|
+
__privateSet(this, _holeSize, percent);
|
|
197
|
+
return this;
|
|
198
|
+
}
|
|
199
|
+
/** Attaches this chart to a worksheet. */
|
|
200
|
+
addTo(sheet) {
|
|
201
|
+
sheet.addDrawingProvider(this);
|
|
202
|
+
return this;
|
|
203
|
+
}
|
|
204
|
+
// ── DrawingProvider contract ──────────────────────────────────────────────
|
|
205
|
+
buildAnchorXml(relationshipId) {
|
|
206
|
+
const a = __privateGet(this, _anchor);
|
|
207
|
+
const frameId = parseInt(relationshipId.slice(3), 10) + 1;
|
|
208
|
+
return `<xdr:twoCellAnchor><xdr:from><xdr:col>${a.fromCol}</xdr:col><xdr:colOff>0</xdr:colOff><xdr:row>${a.fromRow}</xdr:row><xdr:rowOff>0</xdr:rowOff></xdr:from><xdr:to><xdr:col>${a.toCol}</xdr:col><xdr:colOff>0</xdr:colOff><xdr:row>${a.toRow}</xdr:row><xdr:rowOff>0</xdr:rowOff></xdr:to><xdr:graphicFrame macro=""><xdr:nvGraphicFramePr><xdr:cNvPr id="${frameId}" name="Chart ${frameId}"/><xdr:cNvGraphicFramePr/></xdr:nvGraphicFramePr><xdr:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/></xdr:xfrm><a:graphic><a:graphicData uri="${CHART_NS}"><c:chart xmlns:c="${CHART_NS}" xmlns:r="${puredocsExcel.NS.relationships}" r:id="${relationshipId}"/></a:graphicData></a:graphic></xdr:graphicFrame><xdr:clientData/></xdr:twoCellAnchor>`;
|
|
209
|
+
}
|
|
210
|
+
buildPart(partIndex) {
|
|
211
|
+
return {
|
|
212
|
+
path: `xl/charts/chart${partIndex}.xml`,
|
|
213
|
+
content: this.toChartXml(),
|
|
214
|
+
contentType: puredocsExcel.CONTENT_TYPES.chart,
|
|
215
|
+
relType: puredocsExcel.REL_TYPES.chart
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/** Builds the full `xl/charts/chartN.xml` content. */
|
|
219
|
+
toChartXml() {
|
|
220
|
+
const titleXml = __privateGet(this, _title) ? `${__privateMethod(this, _ExcelChart_instances, buildTitleXml_fn).call(this, __privateGet(this, _title))}<c:autoTitleDeleted val="0"/>` : `<c:autoTitleDeleted val="1"/>`;
|
|
221
|
+
const plot = __privateMethod(this, _ExcelChart_instances, buildPlotElement_fn).call(this);
|
|
222
|
+
const axes = __privateGet(this, _family).hasAxes ? __privateMethod(this, _ExcelChart_instances, buildAxesXml_fn).call(this) : "";
|
|
223
|
+
const legend = __privateGet(this, _legend).position === "none" /* None */ ? "" : `<c:legend><c:legendPos val="${__privateGet(this, _legend).position}"/><c:overlay val="0"/></c:legend>`;
|
|
224
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><c:chartSpace xmlns:c="${CHART_NS}" xmlns:a="${puredocsExcel.NS.drawingml}" xmlns:r="${puredocsExcel.NS.relationships}"><c:chart>` + titleXml + `<c:plotArea><c:layout/>` + plot + axes + `</c:plotArea>` + legend + `<c:plotVisOnly val="1"/><c:dispBlanksAs val="gap"/></c:chart></c:chartSpace>`;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
_type = new WeakMap();
|
|
228
|
+
_family = new WeakMap();
|
|
229
|
+
_secondaryType = new WeakMap();
|
|
230
|
+
_anchor = new WeakMap();
|
|
231
|
+
_title = new WeakMap();
|
|
232
|
+
_series = new WeakMap();
|
|
233
|
+
_legend = new WeakMap();
|
|
234
|
+
_categoryAxis = new WeakMap();
|
|
235
|
+
_valueAxis = new WeakMap();
|
|
236
|
+
_secondaryValueAxis = new WeakMap();
|
|
237
|
+
_dataLabels = new WeakMap();
|
|
238
|
+
_gapWidth = new WeakMap();
|
|
239
|
+
_holeSize = new WeakMap();
|
|
240
|
+
_ExcelChart_instances = new WeakSet();
|
|
241
|
+
// ── Chart XML ─────────────────────────────────────────────────────────────
|
|
242
|
+
/** True when a secondary-axis combo should be emitted. */
|
|
243
|
+
hasSecondary_fn = function() {
|
|
244
|
+
return CARTESIAN.has(__privateGet(this, _family).element) && __privateGet(this, _series).some((s) => s.secondaryAxis);
|
|
245
|
+
};
|
|
246
|
+
buildPlotElement_fn = function() {
|
|
247
|
+
const fam = __privateGet(this, _family);
|
|
248
|
+
const el = fam.element;
|
|
249
|
+
const indexed = __privateGet(this, _series).map((s, idx) => ({ s, idx }));
|
|
250
|
+
const dLbls = __privateMethod(this, _ExcelChart_instances, buildDataLabelsXml_fn).call(this);
|
|
251
|
+
if (el === "pieChart") {
|
|
252
|
+
return `<c:pieChart><c:varyColors val="1"/>${__privateMethod(this, _ExcelChart_instances, seriesGroupXml_fn).call(this, indexed, fam)}${dLbls}<c:firstSliceAng val="0"/></c:pieChart>`;
|
|
253
|
+
}
|
|
254
|
+
if (el === "doughnutChart") {
|
|
255
|
+
return `<c:doughnutChart><c:varyColors val="1"/>${__privateMethod(this, _ExcelChart_instances, seriesGroupXml_fn).call(this, indexed, fam)}${dLbls}<c:firstSliceAng val="0"/><c:holeSize val="${__privateGet(this, _holeSize) ?? 50}"/></c:doughnutChart>`;
|
|
256
|
+
}
|
|
257
|
+
if (el === "radarChart") {
|
|
258
|
+
return `<c:radarChart><c:radarStyle val="${fam.radarStyle}"/><c:varyColors val="0"/>${__privateMethod(this, _ExcelChart_instances, seriesGroupXml_fn).call(this, indexed, fam)}${dLbls}<c:axId val="${CAT_AX_ID}"/><c:axId val="${VAL_AX_ID}"/></c:radarChart>`;
|
|
259
|
+
}
|
|
260
|
+
if (el === "scatterChart") {
|
|
261
|
+
return `<c:scatterChart><c:scatterStyle val="${fam.scatterStyle}"/><c:varyColors val="0"/>${__privateMethod(this, _ExcelChart_instances, seriesGroupXml_fn).call(this, indexed, fam)}${dLbls}<c:axId val="${CAT_AX_ID}"/><c:axId val="${VAL_AX_ID}"/></c:scatterChart>`;
|
|
262
|
+
}
|
|
263
|
+
if (el === "bubbleChart") {
|
|
264
|
+
return `<c:bubbleChart><c:varyColors val="0"/>${__privateMethod(this, _ExcelChart_instances, seriesGroupXml_fn).call(this, indexed, fam)}${dLbls}<c:bubbleScale val="100"/><c:showNegBubbles val="0"/><c:axId val="${CAT_AX_ID}"/><c:axId val="${VAL_AX_ID}"/></c:bubbleChart>`;
|
|
265
|
+
}
|
|
266
|
+
if (!__privateMethod(this, _ExcelChart_instances, hasSecondary_fn).call(this)) {
|
|
267
|
+
return __privateMethod(this, _ExcelChart_instances, cartesianGroupXml_fn).call(this, indexed, fam, CAT_AX_ID, VAL_AX_ID);
|
|
268
|
+
}
|
|
269
|
+
const primary = indexed.filter((e) => !e.s.secondaryAxis);
|
|
270
|
+
const secondary = indexed.filter((e) => e.s.secondaryAxis);
|
|
271
|
+
const secFam = resolveFamily(__privateGet(this, _secondaryType));
|
|
272
|
+
return __privateMethod(this, _ExcelChart_instances, cartesianGroupXml_fn).call(this, primary, fam, CAT_AX_ID, VAL_AX_ID) + __privateMethod(this, _ExcelChart_instances, cartesianGroupXml_fn).call(this, secondary, secFam, SEC_CAT_AX_ID, SEC_VAL_AX_ID);
|
|
273
|
+
};
|
|
274
|
+
cartesianGroupXml_fn = function(entries, fam, catId, valId) {
|
|
275
|
+
const el = fam.element;
|
|
276
|
+
const barDir = fam.barDir ? `<c:barDir val="${fam.barDir}"/>` : "";
|
|
277
|
+
const grouping = fam.grouping ? `<c:grouping val="${fam.grouping}"/>` : "";
|
|
278
|
+
const marker = el === "lineChart" ? `<c:marker val="${fam.markers ? 1 : 0}"/>` : "";
|
|
279
|
+
const barExtras = el === "barChart" ? `<c:gapWidth val="${__privateGet(this, _gapWidth)}"/>${fam.overlap !== void 0 ? `<c:overlap val="${fam.overlap}"/>` : ""}` : "";
|
|
280
|
+
return `<c:${el}>${barDir}${grouping}<c:varyColors val="0"/>${__privateMethod(this, _ExcelChart_instances, seriesGroupXml_fn).call(this, entries, fam)}${__privateMethod(this, _ExcelChart_instances, buildDataLabelsXml_fn).call(this)}${barExtras}${marker}<c:axId val="${catId}"/><c:axId val="${valId}"/></c:${el}>`;
|
|
281
|
+
};
|
|
282
|
+
seriesGroupXml_fn = function(entries, fam) {
|
|
283
|
+
return entries.map((e) => __privateMethod(this, _ExcelChart_instances, buildSeriesXml_fn).call(this, e.s, e.idx, fam)).join("");
|
|
284
|
+
};
|
|
285
|
+
buildSeriesXml_fn = function(s, idx, fam) {
|
|
286
|
+
const tx = s.name ? `<c:tx>${__privateMethod(this, _ExcelChart_instances, refOrLiteral_fn).call(this, s.name)}</c:tx>` : "";
|
|
287
|
+
const spPr = s.color ? __privateMethod(this, _ExcelChart_instances, seriesColorXml_fn).call(this, s.color, fam) : "";
|
|
288
|
+
const dPt = s.pointColors && s.pointColors.length ? __privateMethod(this, _ExcelChart_instances, buildDataPointsXml_fn).call(this, s.pointColors, fam) : "";
|
|
289
|
+
const trend = s.trendline ? __privateMethod(this, _ExcelChart_instances, buildTrendlineXml_fn).call(this, s.trendline) : "";
|
|
290
|
+
const marker = fam.markers ? `<c:marker><c:symbol val="circle"/><c:size val="5"/></c:marker>` : "";
|
|
291
|
+
if (fam.seriesKind === "xy") {
|
|
292
|
+
const xVal = s.categories ? `<c:xVal>${numRef(s.categories)}</c:xVal>` : "";
|
|
293
|
+
const yVal = `<c:yVal>${numRef(s.values)}</c:yVal>`;
|
|
294
|
+
const smooth2 = `<c:smooth val="${fam.smooth ? 1 : 0}"/>`;
|
|
295
|
+
return `<c:ser><c:idx val="${idx}"/><c:order val="${idx}"/>${tx}${spPr}${marker}${dPt}${trend}${xVal}${yVal}${smooth2}</c:ser>`;
|
|
296
|
+
}
|
|
297
|
+
if (fam.seriesKind === "bubble") {
|
|
298
|
+
const xVal = s.categories ? `<c:xVal>${numRef(s.categories)}</c:xVal>` : "";
|
|
299
|
+
const yVal = `<c:yVal>${numRef(s.values)}</c:yVal>`;
|
|
300
|
+
const bub = s.bubbleSize ? `<c:bubbleSize>${numRef(s.bubbleSize)}</c:bubbleSize>` : `<c:bubbleSize><c:numLit><c:formatCode>General</c:formatCode><c:ptCount val="0"/></c:numLit></c:bubbleSize>`;
|
|
301
|
+
return `<c:ser><c:idx val="${idx}"/><c:order val="${idx}"/>${tx}${spPr}${dPt}${trend}${xVal}${yVal}${bub}<c:bubble3D val="0"/></c:ser>`;
|
|
302
|
+
}
|
|
303
|
+
const catMarker = fam.element === "lineChart" || fam.element === "radarChart" ? marker : "";
|
|
304
|
+
const cat = s.categories ? `<c:cat>${strRef(s.categories)}</c:cat>` : "";
|
|
305
|
+
const val = `<c:val>${numRef(s.values)}</c:val>`;
|
|
306
|
+
const smooth = fam.element === "lineChart" ? `<c:smooth val="0"/>` : "";
|
|
307
|
+
return `<c:ser><c:idx val="${idx}"/><c:order val="${idx}"/>${tx}${spPr}${catMarker}${dPt}${trend}${cat}${val}${smooth}</c:ser>`;
|
|
308
|
+
};
|
|
309
|
+
buildDataPointsXml_fn = function(colors, fam) {
|
|
310
|
+
return colors.map((c, i) => `<c:dPt><c:idx val="${i}"/><c:bubble3D val="0"/>${__privateMethod(this, _ExcelChart_instances, seriesColorXml_fn).call(this, c, fam)}</c:dPt>`).join("");
|
|
311
|
+
};
|
|
312
|
+
buildTrendlineXml_fn = function(t) {
|
|
313
|
+
const order = t.type === "poly" /* Polynomial */ ? `<c:order val="${t.order ?? 2}"/>` : "";
|
|
314
|
+
const period = t.type === "movingAvg" /* MovingAverage */ ? `<c:period val="${t.period ?? 2}"/>` : "";
|
|
315
|
+
return `<c:trendline><c:trendlineType val="${t.type}"/>` + order + period + `<c:dispRSqr val="${t.displayRSquared ? 1 : 0}"/><c:dispEq val="${t.displayEquation ? 1 : 0}"/></c:trendline>`;
|
|
316
|
+
};
|
|
317
|
+
seriesColorXml_fn = function(color, fam) {
|
|
318
|
+
const fill = `<a:solidFill><a:srgbClr val="${toSrgb(color)}"/></a:solidFill>`;
|
|
319
|
+
return fam.colorAsLine ? `<c:spPr><a:ln w="28575">${fill}</a:ln></c:spPr>` : `<c:spPr>${fill}</c:spPr>`;
|
|
320
|
+
};
|
|
321
|
+
refOrLiteral_fn = function(name) {
|
|
322
|
+
return name.includes("!") ? strRef(name) : `<c:v>${puredocsExcel.escapeXml(name)}</c:v>`;
|
|
323
|
+
};
|
|
324
|
+
buildDataLabelsXml_fn = function() {
|
|
325
|
+
const d = __privateGet(this, _dataLabels);
|
|
326
|
+
if (!d) return "";
|
|
327
|
+
const flag = (b) => b ? 1 : 0;
|
|
328
|
+
return `<c:dLbls><c:showLegendKey val="0"/><c:showVal val="${flag(d.value)}"/><c:showCatName val="${flag(d.category)}"/><c:showSerName val="${flag(d.series)}"/><c:showPercent val="${flag(d.percent)}"/><c:showBubbleSize val="0"/></c:dLbls>`;
|
|
329
|
+
};
|
|
330
|
+
buildAxesXml_fn = function() {
|
|
331
|
+
const fam = __privateGet(this, _family);
|
|
332
|
+
if (fam.seriesKind !== "category") {
|
|
333
|
+
return __privateMethod(this, _ExcelChart_instances, buildValAx_fn).call(this, CAT_AX_ID, "b", VAL_AX_ID, __privateGet(this, _categoryAxis), {}) + __privateMethod(this, _ExcelChart_instances, buildValAx_fn).call(this, VAL_AX_ID, "l", CAT_AX_ID, __privateGet(this, _valueAxis), {});
|
|
334
|
+
}
|
|
335
|
+
let out = __privateMethod(this, _ExcelChart_instances, buildCatAx_fn).call(this, CAT_AX_ID, fam.catAxPos, VAL_AX_ID, __privateGet(this, _categoryAxis), {}) + __privateMethod(this, _ExcelChart_instances, buildValAx_fn).call(this, VAL_AX_ID, fam.valAxPos, CAT_AX_ID, __privateGet(this, _valueAxis), { crossBetween: "between" });
|
|
336
|
+
if (__privateMethod(this, _ExcelChart_instances, hasSecondary_fn).call(this)) {
|
|
337
|
+
out += __privateMethod(this, _ExcelChart_instances, buildValAx_fn).call(this, SEC_VAL_AX_ID, "r", SEC_CAT_AX_ID, __privateGet(this, _secondaryValueAxis), { crossBetween: "between", crosses: "max" }) + __privateMethod(this, _ExcelChart_instances, buildCatAx_fn).call(this, SEC_CAT_AX_ID, fam.catAxPos, SEC_VAL_AX_ID, {}, { deleted: true });
|
|
338
|
+
}
|
|
339
|
+
return out;
|
|
340
|
+
};
|
|
341
|
+
buildCatAx_fn = function(id, pos, crossId, cfg, opts) {
|
|
342
|
+
const title = cfg.title ? __privateMethod(this, _ExcelChart_instances, buildTitleXml_fn).call(this, cfg.title) : "";
|
|
343
|
+
const numFmt = cfg.numberFormat ? `<c:numFmt formatCode="${puredocsExcel.escapeXml(cfg.numberFormat)}" sourceLinked="0"/>` : "";
|
|
344
|
+
return `<c:catAx><c:axId val="${id}"/><c:scaling><c:orientation val="minMax"/></c:scaling><c:delete val="${opts.deleted ? 1 : 0}"/><c:axPos val="${pos}"/>` + title + numFmt + `<c:majorTickMark val="out"/><c:minorTickMark val="none"/><c:tickLblPos val="nextTo"/><c:crossAx val="${crossId}"/><c:crosses val="autoZero"/><c:auto val="1"/><c:lblAlgn val="ctr"/><c:lblOffset val="100"/><c:noMultiLvlLbl val="0"/></c:catAx>`;
|
|
345
|
+
};
|
|
346
|
+
buildValAx_fn = function(id, pos, crossId, cfg, opts) {
|
|
347
|
+
const grid = cfg.majorGridlines ? `<c:majorGridlines/>` : "";
|
|
348
|
+
const title = cfg.title ? __privateMethod(this, _ExcelChart_instances, buildTitleXml_fn).call(this, cfg.title) : "";
|
|
349
|
+
const numFmt = cfg.numberFormat ? `<c:numFmt formatCode="${puredocsExcel.escapeXml(cfg.numberFormat)}" sourceLinked="0"/>` : "";
|
|
350
|
+
const scaling = `<c:scaling><c:orientation val="minMax"/>${cfg.max !== void 0 ? `<c:max val="${cfg.max}"/>` : ""}${cfg.min !== void 0 ? `<c:min val="${cfg.min}"/>` : ""}</c:scaling>`;
|
|
351
|
+
const cb = opts.crossBetween ? `<c:crossBetween val="${opts.crossBetween}"/>` : "";
|
|
352
|
+
return `<c:valAx><c:axId val="${id}"/>` + scaling + `<c:delete val="0"/><c:axPos val="${pos}"/>` + grid + title + numFmt + `<c:majorTickMark val="out"/><c:minorTickMark val="none"/><c:tickLblPos val="nextTo"/><c:crossAx val="${crossId}"/><c:crosses val="${opts.crosses ?? "autoZero"}"/>` + cb + `</c:valAx>`;
|
|
353
|
+
};
|
|
354
|
+
buildTitleXml_fn = function(text) {
|
|
355
|
+
return `<c:title><c:tx><c:rich><a:bodyPr rot="0" spcFirstLastPara="1" vertOverflow="ellipsis" vert="horz" wrap="square" anchor="ctr" anchorCtr="1"/><a:lstStyle/><a:p><a:r><a:t>${puredocsExcel.escapeXml(text)}</a:t></a:r></a:p></c:rich></c:tx><c:overlay val="0"/></c:title>`;
|
|
356
|
+
};
|
|
357
|
+
var ExcelChart = _ExcelChart;
|
|
358
|
+
|
|
359
|
+
exports.ChartLegendPosition = ChartLegendPosition;
|
|
360
|
+
exports.ExcelChart = ExcelChart;
|
|
361
|
+
exports.ExcelChartType = ExcelChartType;
|
|
362
|
+
exports.TrendlineType = TrendlineType;
|
|
363
|
+
//# sourceMappingURL=index.cjs.map
|
|
364
|
+
//# sourceMappingURL=index.cjs.map
|