@pixerate/editor 0.165.0 → 0.167.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/THIRD_PARTY_NOTICES.md +11 -0
- package/dist/agent/index.cjs +34 -34
- package/dist/agent/index.js +5 -5
- package/dist/canvas/index.cjs +6 -6
- package/dist/canvas/index.js +2 -2
- package/dist/chart/controller.d.cts +29 -0
- package/dist/chart/controller.d.ts +29 -0
- package/dist/chart/index.cjs +352 -179
- package/dist/chart/index.d.cts +2 -0
- package/dist/chart/index.d.ts +2 -0
- package/dist/chart/index.js +183 -10
- package/dist/chart/layout-families.d.cts +15 -0
- package/dist/chart/layout-families.d.ts +15 -0
- package/dist/chart/layout-shared.d.cts +5 -0
- package/dist/chart/layout-shared.d.ts +5 -0
- package/dist/chart/maps.d.cts +43 -0
- package/dist/chart/maps.d.ts +43 -0
- package/dist/chart/race.d.cts +26 -0
- package/dist/chart/race.d.ts +26 -0
- package/dist/chart/schemas.d.cts +2 -0
- package/dist/chart/schemas.d.ts +2 -0
- package/dist/chart/spec.d.cts +1 -1
- package/dist/chart/spec.d.ts +1 -1
- package/dist/chart/types.d.cts +14 -2
- package/dist/chart/types.d.ts +14 -2
- package/dist/chart-maps/europe.d.cts +7 -0
- package/dist/chart-maps/europe.d.ts +7 -0
- package/dist/chart-maps/index.cjs +66 -0
- package/dist/chart-maps/index.d.cts +1 -0
- package/dist/chart-maps/index.d.ts +1 -0
- package/dist/chart-maps/index.js +66 -0
- package/dist/{chunk-IMRXC7OA.cjs → chunk-2F4GAZL5.cjs} +186 -96
- package/dist/{chunk-FEU2XVQH.js → chunk-34UCPHYO.js} +8 -2
- package/dist/{chunk-ODFCS7HF.cjs → chunk-E45AIIWY.cjs} +8 -8
- package/dist/{chunk-N7NBGT2Y.js → chunk-FKYGM35R.js} +2 -2
- package/dist/{chunk-64VWWR5U.cjs → chunk-GD34ICEX.cjs} +16 -16
- package/dist/{chunk-TVQW26AV.cjs → chunk-GTF4RYXJ.cjs} +29 -23
- package/dist/{chunk-V5GSY3NC.js → chunk-M52UCHVZ.js} +203 -3
- package/dist/{chunk-FRBRLKNQ.js → chunk-N3ACT6VJ.js} +92 -2
- package/dist/{chunk-CRFSQWKQ.js → chunk-OLCHKGGO.js} +7 -1
- package/dist/{chunk-2ZRN43IN.js → chunk-ORZF4JOO.js} +32 -4
- package/dist/{chunk-UVXTOZ2B.cjs → chunk-OUO3DSRT.cjs} +32 -4
- package/dist/{chunk-MKXK6E4O.cjs → chunk-SBAPXFPB.cjs} +51 -51
- package/dist/{chunk-2J5VLJHC.js → chunk-T62BRXMS.js} +3 -3
- package/dist/{chunk-Q25WAFTD.cjs → chunk-VKHJJUBK.cjs} +24 -18
- package/dist/{chunk-QO2T6KA5.cjs → chunk-WOIXNDHV.cjs} +247 -47
- package/dist/{chunk-X5W645RI.js → chunk-ZUPP4NKM.js} +3 -3
- package/dist/export/index.cjs +4 -4
- package/dist/export/index.js +3 -3
- package/dist/extensions/index.cjs +7 -7
- package/dist/extensions/index.js +6 -6
- package/dist/index.cjs +13 -13
- package/dist/index.js +7 -7
- package/package.json +11 -1
- package/skills/pixerate-chart/SKILL.md +36 -2
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
CHART_STACKINGS,
|
|
19
19
|
CHART_TRENDLINE_TYPES,
|
|
20
20
|
CHART_TYPES
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-ORZF4JOO.js";
|
|
22
22
|
|
|
23
23
|
// src/chart/schemas.ts
|
|
24
24
|
var VALUE = { type: ["number", "string", "null"], description: 'A number, numeric text ("1,200", "12%", "$40", "(3)") or null for a gap.' };
|
|
@@ -119,6 +119,7 @@ var LINK_PROPS = {
|
|
|
119
119
|
value: { type: "number", exclusiveMinimum: 0, description: "How much flows, above 0 (its width)." },
|
|
120
120
|
color: { type: "string", description: "CSS colour (default: by sankeyLinkColor)." }
|
|
121
121
|
};
|
|
122
|
+
var RACE_TIME = { type: ["string", "number"], description: 'Time point label (a category, e.g. "2023") or index from 0; an index may be fractional, 2.5 being halfway between the third and fourth time points.' };
|
|
122
123
|
var LINK_INDEX = { type: "integer", minimum: 0, description: "Flow index (0 = first), as get_chart lists them in spec.links." };
|
|
123
124
|
var ERROR_BARS = (what) => ({
|
|
124
125
|
type: ["object", "null"],
|
|
@@ -157,7 +158,7 @@ var SERIES_PROPS = {
|
|
|
157
158
|
xErrorBars: ERROR_BARS("Error bars along the x axis (scatter and bubble charts with numeric x values; amounts in x units).")
|
|
158
159
|
};
|
|
159
160
|
var CHART_UPDATE_PROPERTIES = {
|
|
160
|
-
type: { type: "string", enum: [...CHART_TYPES], description: "Chart type. slope joins each category from the first series (before) to the second (after); likert reads each category as a question and the series as answers from most negative to most positive; parliament draws the first series as seats; sunburst draws the grouped data (set_chart_tree) as rings, and a treemap with grouped data nests its groups; sankey draws the flows (set_chart_links)." },
|
|
161
|
+
type: { type: "string", enum: [...CHART_TYPES], description: "Chart type. slope joins each category from the first series (before) to the second (after); likert reads each category as a question and the series as answers from most negative to most positive; parliament draws the first series as seats; sunburst draws the grouped data (set_chart_tree) as rings, and a treemap with grouped data nests its groups; sankey draws the flows (set_chart_links); barrace reads categories as time points and series as names, and animates their ranking; choropleth shades the regions of a map, each category naming a region by code (FRA) or name (France)." },
|
|
161
162
|
title: { type: "string", description: 'Title ("" for none).' },
|
|
162
163
|
subtitle: { type: "string", description: 'Subtitle ("" for none).' },
|
|
163
164
|
xAxis: AXIS("Category axis (or numeric x axis of scatter / bubble charts)."),
|
|
@@ -195,6 +196,10 @@ var CHART_UPDATE_PROPERTIES = {
|
|
|
195
196
|
parliamentLabel: { type: "string", description: 'Parliament: caption under the seat total ("" writes "seats").' },
|
|
196
197
|
sunburstLabel: { type: "string", description: 'Sunburst: caption under the total in the centre ("" for none).' },
|
|
197
198
|
sankeyLinkColor: { type: "string", enum: [...CHART_SANKEY_LINK_COLORS], description: "Sankey: colour each flow by its source node (default), its target node, or grey." },
|
|
199
|
+
map: { type: "string", description: 'Choropleth: the registered map to draw (list_chart_map_regions lists them; "europe" by default).' },
|
|
200
|
+
mapSteps: { type: "integer", minimum: 2, maximum: 9, description: "Choropleth: number of equal colour classes between the smallest and largest value (default 5)." },
|
|
201
|
+
mapThresholds: { type: "array", items: { type: "number" }, maxItems: 8, description: "Choropleth: class breaks in ascending order, e.g. [100, 250, 500], used instead of mapSteps; [] goes back to equal classes." },
|
|
202
|
+
raceTopN: { type: "integer", minimum: 1, maximum: 30, description: "Bar race: how many bars each moment shows (default 10)." },
|
|
198
203
|
sankeyNodes: { type: "array", items: { type: "string" }, description: "Sankey: node names in the order to stack them within their columns (reorder to untangle crossing flows); nodes left out follow in the order the flows name them." }
|
|
199
204
|
};
|
|
200
205
|
|
|
@@ -213,6 +218,7 @@ export {
|
|
|
213
218
|
TREE_DEFS,
|
|
214
219
|
TREE_PATH,
|
|
215
220
|
LINK_PROPS,
|
|
221
|
+
RACE_TIME,
|
|
216
222
|
LINK_INDEX,
|
|
217
223
|
SERIES_PROPS,
|
|
218
224
|
CHART_UPDATE_PROPERTIES
|
|
@@ -11,10 +11,10 @@ var _chunkYN6JKAUEcjs = require('./chunk-YN6JKAUE.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkVKHJJUBKcjs = require('./chunk-VKHJJUBK.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkOUO3DSRTcjs = require('./chunk-OUO3DSRT.cjs');
|
|
18
18
|
|
|
19
19
|
// src/export/images.ts
|
|
20
20
|
var DOCX_IMAGE_TYPES = {
|
|
@@ -1028,12 +1028,12 @@ var DocxBuilder = (_class2 = class {
|
|
|
1028
1028
|
this.drop("node", "chart", "chart has no spec");
|
|
1029
1029
|
return;
|
|
1030
1030
|
}
|
|
1031
|
-
const spec =
|
|
1032
|
-
const written =
|
|
1031
|
+
const spec = _chunkOUO3DSRTcjs.normalizeChartSpec.call(void 0, raw).spec;
|
|
1032
|
+
const written = _chunkVKHJJUBKcjs.chartToOoxml.call(void 0, spec);
|
|
1033
1033
|
for (const issue of written.issues) this.drop("node", "chart", issue);
|
|
1034
1034
|
const name = `chart${this.charts.length + 1}.xml`;
|
|
1035
1035
|
this.charts.push(written.xml);
|
|
1036
|
-
const relId = this.rels.add(
|
|
1036
|
+
const relId = this.rels.add(_chunkVKHJJUBKcjs.CHART_OOXML_RELATIONSHIP, `charts/${name}`);
|
|
1037
1037
|
let width = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _91 => _91.attrs, 'optionalAccess', _92 => _92.width])), () => ( MAX_IMAGE_WIDTH_PX));
|
|
1038
1038
|
let height = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _93 => _93.attrs, 'optionalAccess', _94 => _94.height])), () => ( 320));
|
|
1039
1039
|
if (width > MAX_IMAGE_WIDTH_PX) {
|
|
@@ -1050,8 +1050,8 @@ var DocxBuilder = (_class2 = class {
|
|
|
1050
1050
|
drawing.empty("wp:extent", { cx, cy }).empty("wp:effectExtent", { l: 0, t: 0, r: 0, b: 0 });
|
|
1051
1051
|
drawing.empty("wp:docPr", { id, name: `Chart ${id}`, descr: title || void 0, title: title || void 0 });
|
|
1052
1052
|
drawing.empty("wp:cNvGraphicFramePr");
|
|
1053
|
-
drawing.open("a:graphic").open("a:graphicData", { uri:
|
|
1054
|
-
drawing.empty("c:chart", { "xmlns:c":
|
|
1053
|
+
drawing.open("a:graphic").open("a:graphicData", { uri: _chunkVKHJJUBKcjs.CHART_OOXML_NS });
|
|
1054
|
+
drawing.empty("c:chart", { "xmlns:c": _chunkVKHJJUBKcjs.CHART_OOXML_NS, "r:id": relId });
|
|
1055
1055
|
drawing.close("a:graphicData").close("a:graphic").close("wp:inline").close("w:drawing").close("w:r");
|
|
1056
1056
|
this.report.written.paragraphs++;
|
|
1057
1057
|
w.open("w:p");
|
|
@@ -1384,7 +1384,7 @@ var DocxBuilder = (_class2 = class {
|
|
|
1384
1384
|
if (people) add("word/people.xml", people, `${CT_WML}people+xml`);
|
|
1385
1385
|
parts.push({ name: "word/_rels/document.xml.rels", data: this.rels.xml() });
|
|
1386
1386
|
for (const file of this.media) parts.push({ name: `word/media/${file.name}`, data: file.bytes });
|
|
1387
|
-
this.charts.forEach((xml, i) => add(`word/charts/chart${i + 1}.xml`, xml,
|
|
1387
|
+
this.charts.forEach((xml, i) => add(`word/charts/chart${i + 1}.xml`, xml, _chunkVKHJJUBKcjs.CHART_OOXML_CONTENT_TYPE));
|
|
1388
1388
|
add("docProps/core.xml", this.coreXml(now), "application/vnd.openxmlformats-package.core-properties+xml");
|
|
1389
1389
|
const app = new XmlWriter();
|
|
1390
1390
|
app.open("Properties", { xmlns: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" });
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
CHART_OOXML_NS,
|
|
12
12
|
CHART_OOXML_RELATIONSHIP,
|
|
13
13
|
chartToOoxml
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-OLCHKGGO.js";
|
|
15
15
|
import {
|
|
16
16
|
normalizeChartSpec
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ORZF4JOO.js";
|
|
18
18
|
|
|
19
19
|
// src/export/images.ts
|
|
20
20
|
var DOCX_IMAGE_TYPES = {
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk2F4GAZL5cjs = require('./chunk-2F4GAZL5.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkWOIXNDHVcjs = require('./chunk-WOIXNDHV.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkOUO3DSRTcjs = require('./chunk-OUO3DSRT.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _chunkG43MNQ4Ccjs = require('./chunk-G43MNQ4C.cjs');
|
|
@@ -1211,7 +1211,7 @@ var ChartNodeView = (_class = class {
|
|
|
1211
1211
|
this.dom.contentEditable = "false";
|
|
1212
1212
|
this.syncAttributes();
|
|
1213
1213
|
this.key = specKey(this.node.attrs.spec);
|
|
1214
|
-
this.controller = new (0,
|
|
1214
|
+
this.controller = new (0, _chunk2F4GAZL5cjs.ChartController)({ spec: this.node.attrs.spec });
|
|
1215
1215
|
this.unsubscribe = this.controller.subscribe((state) => {
|
|
1216
1216
|
if (!state.gesture) this.writeBack();
|
|
1217
1217
|
});
|
|
@@ -1444,7 +1444,7 @@ function readSpec(value) {
|
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
1446
|
if (!input || typeof input !== "object" || Array.isArray(input)) return null;
|
|
1447
|
-
return
|
|
1447
|
+
return _chunkOUO3DSRTcjs.normalizeChartSpec.call(void 0, input).spec;
|
|
1448
1448
|
}
|
|
1449
1449
|
var readSize = (value) => {
|
|
1450
1450
|
const n = value === null ? NaN : Number(value);
|
|
@@ -1470,10 +1470,10 @@ function staticChartSvg(node, options) {
|
|
|
1470
1470
|
const spec = node.attrs.spec;
|
|
1471
1471
|
const width = _nullishCoalesce(node.attrs.width, () => ( options.defaultWidth));
|
|
1472
1472
|
const height = _nullishCoalesce(node.attrs.height, () => ( options.defaultHeight));
|
|
1473
|
-
const scene =
|
|
1474
|
-
return
|
|
1473
|
+
const scene = _chunkWOIXNDHVcjs.layoutChart.call(void 0, spec, { width, height, theme: options.theme, selection: null });
|
|
1474
|
+
return _chunk2F4GAZL5cjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1475
1475
|
ariaLabel: spec.title || "Chart",
|
|
1476
|
-
description:
|
|
1476
|
+
description: _chunk2F4GAZL5cjs.describeChart.call(void 0, spec),
|
|
1477
1477
|
attrs: { style: "max-width: 100%; height: auto; display: block" }
|
|
1478
1478
|
});
|
|
1479
1479
|
}
|
|
@@ -1489,7 +1489,7 @@ var Chart = _core.Node.create({
|
|
|
1489
1489
|
return {
|
|
1490
1490
|
HTMLAttributes: {},
|
|
1491
1491
|
nodeView: null,
|
|
1492
|
-
theme:
|
|
1492
|
+
theme: _chunkOUO3DSRTcjs.DEFAULT_CHART_THEME,
|
|
1493
1493
|
defaultWidth: 640,
|
|
1494
1494
|
defaultHeight: 320,
|
|
1495
1495
|
generateId: () => generateStructureId("chart")
|
|
@@ -1503,7 +1503,7 @@ var Chart = _core.Node.create({
|
|
|
1503
1503
|
renderHTML: (attributes) => attributes.id ? { "data-chart-id": attributes.id } : {}
|
|
1504
1504
|
},
|
|
1505
1505
|
spec: {
|
|
1506
|
-
default:
|
|
1506
|
+
default: _chunkOUO3DSRTcjs.normalizeChartSpec.call(void 0, {}).spec,
|
|
1507
1507
|
// null (no `data-chart`) keeps what the parse rule found, e.g. a mermaid block's spec.
|
|
1508
1508
|
parseHTML: (element) => readSpec(element.getAttribute("data-chart")),
|
|
1509
1509
|
renderHTML: (attributes) => ({
|
|
@@ -1541,7 +1541,7 @@ var Chart = _core.Node.create({
|
|
|
1541
1541
|
const code = element.querySelector("code");
|
|
1542
1542
|
const language = _nullishCoalesce(_nullishCoalesce(_optionalChain([code, 'optionalAccess', _34 => _34.getAttribute, 'call', _35 => _35("class")]), () => ( element.getAttribute("data-language"))), () => ( ""));
|
|
1543
1543
|
if (!/(?:^|\s)language-mermaid(?:\s|$)/.test(language) && language !== "mermaid") return false;
|
|
1544
|
-
const result =
|
|
1544
|
+
const result = _chunk2F4GAZL5cjs.chartFromMermaid.call(void 0, _nullishCoalesce((_nullishCoalesce(code, () => ( element))).textContent, () => ( "")));
|
|
1545
1545
|
return result.family ? { spec: result.spec } : false;
|
|
1546
1546
|
}
|
|
1547
1547
|
}
|
|
@@ -1565,7 +1565,7 @@ var Chart = _core.Node.create({
|
|
|
1565
1565
|
return {
|
|
1566
1566
|
markdown: {
|
|
1567
1567
|
serialize(state, node) {
|
|
1568
|
-
const text =
|
|
1568
|
+
const text = _chunk2F4GAZL5cjs.chartToMermaid.call(void 0, node.attrs.spec);
|
|
1569
1569
|
const fence = "`".repeat(Math.max(3, longestBacktickRun(text) + 1));
|
|
1570
1570
|
state.write(`${fence}mermaid
|
|
1571
1571
|
`);
|
|
@@ -1587,7 +1587,7 @@ var Chart = _core.Node.create({
|
|
|
1587
1587
|
type: this.name,
|
|
1588
1588
|
attrs: {
|
|
1589
1589
|
id: _nullishCoalesce(options.id, () => ( this.options.generateId())),
|
|
1590
|
-
spec:
|
|
1590
|
+
spec: _chunkOUO3DSRTcjs.normalizeChartSpec.call(void 0, _nullishCoalesce(options.spec, () => ( {}))).spec,
|
|
1591
1591
|
width: _nullishCoalesce(options.width, () => ( null)),
|
|
1592
1592
|
height: _nullishCoalesce(options.height, () => ( this.options.defaultHeight))
|
|
1593
1593
|
}
|
|
@@ -1598,7 +1598,7 @@ var Chart = _core.Node.create({
|
|
|
1598
1598
|
if (dispatch) {
|
|
1599
1599
|
tr.setNodeMarkup(chart.pos, void 0, {
|
|
1600
1600
|
...chart.node.attrs,
|
|
1601
|
-
...changes.spec !== void 0 ? { spec:
|
|
1601
|
+
...changes.spec !== void 0 ? { spec: _chunkOUO3DSRTcjs.normalizeChartSpec.call(void 0, changes.spec).spec } : {},
|
|
1602
1602
|
...changes.width !== void 0 ? { width: changes.width } : {},
|
|
1603
1603
|
...changes.height !== void 0 ? { height: changes.height } : {}
|
|
1604
1604
|
});
|
|
@@ -1705,14 +1705,14 @@ var Sparkline = _core.Node.create({
|
|
|
1705
1705
|
return [{ tag: 'span[data-type="sparkline"]', priority: 60 }];
|
|
1706
1706
|
},
|
|
1707
1707
|
renderHTML({ node, HTMLAttributes }) {
|
|
1708
|
-
const scene =
|
|
1708
|
+
const scene = _chunk2F4GAZL5cjs.layoutSparkline.call(void 0, node.attrs.values, {
|
|
1709
1709
|
kind: node.attrs.kind,
|
|
1710
1710
|
width: node.attrs.width,
|
|
1711
1711
|
height: node.attrs.height,
|
|
1712
1712
|
color: _nullishCoalesce(node.attrs.color, () => ( this.options.color)),
|
|
1713
1713
|
negativeColor: this.options.negativeColor
|
|
1714
1714
|
});
|
|
1715
|
-
const svg =
|
|
1715
|
+
const svg = _chunk2F4GAZL5cjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1716
1716
|
ariaLabel: sparklineLabel(node),
|
|
1717
1717
|
attrs: { style: "display: inline-block; vertical-align: middle" }
|
|
1718
1718
|
});
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkOUO3DSRTcjs = require('./chunk-OUO3DSRT.cjs');
|
|
22
22
|
|
|
23
23
|
// src/chart/schemas.ts
|
|
24
24
|
var VALUE = { type: ["number", "string", "null"], description: 'A number, numeric text ("1,200", "12%", "$40", "(3)") or null for a gap.' };
|
|
@@ -30,7 +30,7 @@ var FORMAT = {
|
|
|
30
30
|
type: "object",
|
|
31
31
|
description: "How numbers are written on this axis or series.",
|
|
32
32
|
properties: {
|
|
33
|
-
style: { type: "string", enum: [...
|
|
33
|
+
style: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_NUMBER_STYLES], description: "number (default), percent (0.25 \u2192 25%), currency or compact (1.2K)." },
|
|
34
34
|
decimals: { type: "integer", minimum: 0, maximum: 10, description: "Fixed decimals (default: what the ticks need)." },
|
|
35
35
|
currency: { type: "string", description: 'ISO currency code for style "currency", e.g. "EUR" (default USD).' },
|
|
36
36
|
prefix: { type: "string", description: "Text before every number." },
|
|
@@ -50,10 +50,10 @@ var AXIS = (what) => ({
|
|
|
50
50
|
step: { type: ["number", "null"], exclusiveMinimum: 0, description: "Fixed distance between ticks, or null for automatic." },
|
|
51
51
|
gridlines: { type: "boolean", description: "Grid lines at each tick." },
|
|
52
52
|
format: FORMAT,
|
|
53
|
-
kind: { type: ["string", "null"], enum: [...
|
|
53
|
+
kind: { type: ["string", "null"], enum: [..._chunkOUO3DSRTcjs.CHART_AXIS_KINDS, null], description: 'Category axis only: "date" reads categories as dates and labels them by calendar steps.' },
|
|
54
54
|
scale: {
|
|
55
55
|
type: ["string", "null"],
|
|
56
|
-
enum: [...
|
|
56
|
+
enum: [..._chunkOUO3DSRTcjs.CHART_AXIS_SCALES, null],
|
|
57
57
|
description: 'Value axes and the numeric x axis of scatter / bubble charts: "log" spaces ticks by powers of logBase (values of 0 or less are skipped; min and max must be above 0; not with percent stacking). "linear" or null is the default. Ignored on a category axis.'
|
|
58
58
|
},
|
|
59
59
|
logBase: { type: ["number", "null"], minimum: 2, maximum: 1e3, description: "Base of a log axis, 2 to 1000 (default 10; null resets)." },
|
|
@@ -62,7 +62,7 @@ var AXIS = (what) => ({
|
|
|
62
62
|
additionalProperties: false
|
|
63
63
|
});
|
|
64
64
|
var TRENDLINE_PROPS = {
|
|
65
|
-
type: { type: "string", enum: [...
|
|
65
|
+
type: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_TRENDLINE_TYPES], description: "Fit: linear, exponential, logarithmic, power, polynomial or moving-average." },
|
|
66
66
|
order: { type: "integer", minimum: 2, maximum: 6, description: "Polynomial order (default 2)." },
|
|
67
67
|
period: { type: "integer", minimum: 2, description: "Moving-average period in points (default 2)." },
|
|
68
68
|
forward: { type: "number", minimum: 0, description: "Extend the line this many x units past the last point (default 0)." },
|
|
@@ -77,7 +77,7 @@ var REFERENCE_COMMON = {
|
|
|
77
77
|
label: { type: "string", description: 'Text written on it, e.g. "Target" (default none).' },
|
|
78
78
|
axis: {
|
|
79
79
|
type: "string",
|
|
80
|
-
enum: [...
|
|
80
|
+
enum: [..._chunkOUO3DSRTcjs.CHART_REFERENCE_AXES],
|
|
81
81
|
description: "Axis it is measured on: y (default) is the value axis, y2 the secondary value axis (needs a series there), x the numeric x axis of a scatter or bubble chart."
|
|
82
82
|
},
|
|
83
83
|
color: { type: "string", description: "CSS colour (default: the text colour)." }
|
|
@@ -93,7 +93,7 @@ var REFERENCE_BAND_PROPS = {
|
|
|
93
93
|
};
|
|
94
94
|
var REFERENCE_COMMON_PATCH = {
|
|
95
95
|
label: { type: ["string", "null"], description: "Text written on it; null removes it." },
|
|
96
|
-
axis: { type: ["string", "null"], enum: [...
|
|
96
|
+
axis: { type: ["string", "null"], enum: [..._chunkOUO3DSRTcjs.CHART_REFERENCE_AXES, null], description: "Axis it is measured on (y, y2 or x); null goes back to y." },
|
|
97
97
|
color: { type: ["string", "null"], description: "CSS colour; null goes back to the text colour." }
|
|
98
98
|
};
|
|
99
99
|
var REFERENCE_LINE_PATCH = { value: REFERENCE_LINE_PROPS.value, ...REFERENCE_COMMON_PATCH };
|
|
@@ -119,6 +119,7 @@ var LINK_PROPS = {
|
|
|
119
119
|
value: { type: "number", exclusiveMinimum: 0, description: "How much flows, above 0 (its width)." },
|
|
120
120
|
color: { type: "string", description: "CSS colour (default: by sankeyLinkColor)." }
|
|
121
121
|
};
|
|
122
|
+
var RACE_TIME = { type: ["string", "number"], description: 'Time point label (a category, e.g. "2023") or index from 0; an index may be fractional, 2.5 being halfway between the third and fourth time points.' };
|
|
122
123
|
var LINK_INDEX = { type: "integer", minimum: 0, description: "Flow index (0 = first), as get_chart lists them in spec.links." };
|
|
123
124
|
var ERROR_BARS = (what) => ({
|
|
124
125
|
type: ["object", "null"],
|
|
@@ -126,13 +127,13 @@ var ERROR_BARS = (what) => ({
|
|
|
126
127
|
properties: {
|
|
127
128
|
type: {
|
|
128
129
|
type: "string",
|
|
129
|
-
enum: [...
|
|
130
|
+
enum: [..._chunkOUO3DSRTcjs.CHART_ERROR_BAR_TYPES],
|
|
130
131
|
description: "fixed: the same amount at every point; percent: a percentage of each value; stddev: value standard deviations of the series, drawn around the series mean (as Excel does); stderr: the standard error of the series at every point; custom: per-point plus / minus amounts."
|
|
131
132
|
},
|
|
132
133
|
value: { type: "number", minimum: 0, description: "Amount in data units for fixed (default 1), percent of each value for percent (default 5), number of standard deviations for stddev (default 1). Not for stderr or custom." },
|
|
133
134
|
plus: { type: "array", items: VALUE, description: "custom only: amount above each point, one per category, in data units (0 or more; null for none)." },
|
|
134
135
|
minus: { type: "array", items: VALUE, description: "custom only: amount below each point, one per category (default: the plus amounts)." },
|
|
135
|
-
direction: { type: "string", enum: [...
|
|
136
|
+
direction: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_ERROR_BAR_DIRECTIONS], description: "both (default), plus (only above) or minus (only below)." },
|
|
136
137
|
cap: { type: "boolean", description: "Draw end caps (default true)." }
|
|
137
138
|
},
|
|
138
139
|
required: ["type"],
|
|
@@ -142,22 +143,22 @@ var SERIES_PROPS = {
|
|
|
142
143
|
name: { type: "string", description: "Series name (legend and data grid header)." },
|
|
143
144
|
values: { type: "array", items: VALUE, description: "One value per category, in category order (padded with gaps)." },
|
|
144
145
|
color: { type: ["string", "null"], description: "CSS colour, or null for the palette colour." },
|
|
145
|
-
type: { type: ["string", "null"], enum: [...
|
|
146
|
+
type: { type: ["string", "null"], enum: [..._chunkOUO3DSRTcjs.CHART_SERIES_TYPES, null], description: "Draw this series as bar, line, area or scatter (a combo chart); null follows the chart type." },
|
|
146
147
|
hidden: { type: "boolean", description: "Hide the series (its data is kept)." },
|
|
147
148
|
axis: { type: ["string", "null"], enum: ["primary", "secondary", null], description: "Value axis: secondary is drawn on the right with its own scale." },
|
|
148
149
|
x: { type: ["array", "null"], items: VALUE, description: "Numeric x per category, for scatter and bubble charts." },
|
|
149
150
|
sizes: { type: ["array", "null"], items: VALUE, description: "Bubble sizes per category (area is proportional to size)." },
|
|
150
151
|
pointColors: { type: ["array", "null"], items: { type: ["string", "null"] }, description: "Colour per category (null keeps the series colour)." },
|
|
151
152
|
callouts: { type: ["array", "null"], items: { type: ["string", "null"] }, description: "A label pinned to each point that matters, one per category (null: none); null removes them all. Bar, line, area and scatter charts. set_chart_callout sets one." },
|
|
152
|
-
marker: { type: ["string", "null"], enum: [...
|
|
153
|
-
curve: { type: ["string", "null"], enum: [...
|
|
153
|
+
marker: { type: ["string", "null"], enum: [..._chunkOUO3DSRTcjs.CHART_MARKERS, null], description: "Point marker shape for line, area and scatter series." },
|
|
154
|
+
curve: { type: ["string", "null"], enum: [..._chunkOUO3DSRTcjs.CHART_CURVES, null], description: "Line shape for this series: linear, smooth or step." },
|
|
154
155
|
dataLabels: { type: ["boolean", "null"], description: "Value labels for this series (null follows the chart)." },
|
|
155
156
|
format: { ...FORMAT, type: ["object", "null"], description: "How this series' labels are written (null follows the value axis)." },
|
|
156
157
|
errorBars: ERROR_BARS("Error bars along the value axis (bar, line, area and scatter series; on stacked charts they sit on the stack top)."),
|
|
157
158
|
xErrorBars: ERROR_BARS("Error bars along the x axis (scatter and bubble charts with numeric x values; amounts in x units).")
|
|
158
159
|
};
|
|
159
160
|
var CHART_UPDATE_PROPERTIES = {
|
|
160
|
-
type: { type: "string", enum: [...
|
|
161
|
+
type: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_TYPES], description: "Chart type. slope joins each category from the first series (before) to the second (after); likert reads each category as a question and the series as answers from most negative to most positive; parliament draws the first series as seats; sunburst draws the grouped data (set_chart_tree) as rings, and a treemap with grouped data nests its groups; sankey draws the flows (set_chart_links); barrace reads categories as time points and series as names, and animates their ranking; choropleth shades the regions of a map, each category naming a region by code (FRA) or name (France)." },
|
|
161
162
|
title: { type: "string", description: 'Title ("" for none).' },
|
|
162
163
|
subtitle: { type: "string", description: 'Subtitle ("" for none).' },
|
|
163
164
|
xAxis: AXIS("Category axis (or numeric x axis of scatter / bubble charts)."),
|
|
@@ -166,15 +167,15 @@ var CHART_UPDATE_PROPERTIES = {
|
|
|
166
167
|
legend: {
|
|
167
168
|
type: "object",
|
|
168
169
|
description: "Legend.",
|
|
169
|
-
properties: { show: { type: "boolean", description: "Show the legend." }, position: { type: "string", enum: [...
|
|
170
|
+
properties: { show: { type: "boolean", description: "Show the legend." }, position: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_LEGEND_POSITIONS], description: "Where the legend goes." } },
|
|
170
171
|
additionalProperties: false
|
|
171
172
|
},
|
|
172
|
-
stacking: { type: "string", enum: [...
|
|
173
|
-
orientation: { type: "string", enum: [...
|
|
174
|
-
curve: { type: "string", enum: [...
|
|
173
|
+
stacking: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_STACKINGS], description: "none, stacked, or percent (each category scaled to 100%)." },
|
|
174
|
+
orientation: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_ORIENTATIONS], description: "horizontal draws bars sideways." },
|
|
175
|
+
curve: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_CURVES], description: "Line shape: linear, smooth or step." },
|
|
175
176
|
points: { type: "boolean", description: "Dots on line and area series." },
|
|
176
177
|
dataLabels: { type: "boolean", description: "Value labels on bars, points and slices." },
|
|
177
|
-
labelPosition: { type: "string", enum: [...
|
|
178
|
+
labelPosition: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_LABEL_POSITIONS], description: "Bar label position; auto drops labels that do not fit." },
|
|
178
179
|
palette: { type: "array", items: { type: "string" }, minItems: 1, description: "Series colours in order (CSS colours)." },
|
|
179
180
|
innerRadius: { type: "number", minimum: 0, maximum: 0.9, description: "Donut hole as a fraction of the radius." },
|
|
180
181
|
gapWidth: { type: "number", minimum: 0, maximum: 0.9, description: "Space between bar groups as a fraction of the category (default 0.28)." },
|
|
@@ -182,19 +183,23 @@ var CHART_UPDATE_PROPERTIES = {
|
|
|
182
183
|
bins: { type: ["integer", "null"], minimum: 1, maximum: 500, description: "Histogram bin count, or null for \u221An." },
|
|
183
184
|
showTotal: { type: "boolean", description: "Waterfall: append a total bar." },
|
|
184
185
|
radarTicks: { type: ["integer", "null"], minimum: 1, maximum: 50, description: "Radar: number of evenly spaced rings from the value axis min to max, or null for round-number rings (default null)." },
|
|
185
|
-
radarGraticule: { type: "string", enum: [...
|
|
186
|
+
radarGraticule: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_RADAR_GRATICULES], description: "Radar: draw rings as polygons through the spokes or as circles (default polygon)." },
|
|
186
187
|
note: { type: "string", description: 'A source or footnote written under the chart ("" for none).' },
|
|
187
188
|
highlight: { type: "array", items: { type: "string" }, description: "Category labels and series names (or ids) to draw normally while the rest are muted; [] shows everything. highlight_chart checks the names." },
|
|
188
189
|
referenceLines: { type: "array", items: { type: "object", properties: REFERENCE_LINE_PROPS, required: ["value"], additionalProperties: false }, description: "Replaces every reference line (targets, floors, averages across the plot). add_chart_reference_line adds one." },
|
|
189
190
|
referenceBands: { type: "array", items: { type: "object", properties: REFERENCE_BAND_PROPS, required: ["from", "to"], additionalProperties: false }, description: "Replaces every reference band (target ranges across the plot). add_chart_reference_band adds one." },
|
|
190
191
|
varyColors: { type: "boolean", description: "A one-series bar, line, area or scatter chart colours each category from the palette, and its legend lists the categories (default false)." },
|
|
191
|
-
likertNeutral: { type: "string", enum: [...
|
|
192
|
-
likertSort: { type: "string", enum: [...
|
|
192
|
+
likertNeutral: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_LIKERT_NEUTRALS], description: "Likert with an odd number of answers: split (default) puts the middle answer across the centre line; separate draws it in its own column on the right." },
|
|
193
|
+
likertSort: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_LIKERT_SORTS], description: "Likert: order the questions by agreement (positive), by disagreement (negative) or as given (none, default)." },
|
|
193
194
|
parliamentArc: { type: "number", minimum: 90, maximum: 360, description: "Parliament: sweep of the hemicycle in degrees (default 180)." },
|
|
194
195
|
parliamentMajority: { type: ["integer", "null"], minimum: 1, description: "Parliament: seats needed for a majority, drawn as a dashed line (null: half of the seats plus one)." },
|
|
195
196
|
parliamentLabel: { type: "string", description: 'Parliament: caption under the seat total ("" writes "seats").' },
|
|
196
197
|
sunburstLabel: { type: "string", description: 'Sunburst: caption under the total in the centre ("" for none).' },
|
|
197
|
-
sankeyLinkColor: { type: "string", enum: [...
|
|
198
|
+
sankeyLinkColor: { type: "string", enum: [..._chunkOUO3DSRTcjs.CHART_SANKEY_LINK_COLORS], description: "Sankey: colour each flow by its source node (default), its target node, or grey." },
|
|
199
|
+
map: { type: "string", description: 'Choropleth: the registered map to draw (list_chart_map_regions lists them; "europe" by default).' },
|
|
200
|
+
mapSteps: { type: "integer", minimum: 2, maximum: 9, description: "Choropleth: number of equal colour classes between the smallest and largest value (default 5)." },
|
|
201
|
+
mapThresholds: { type: "array", items: { type: "number" }, maxItems: 8, description: "Choropleth: class breaks in ascending order, e.g. [100, 250, 500], used instead of mapSteps; [] goes back to equal classes." },
|
|
202
|
+
raceTopN: { type: "integer", minimum: 1, maximum: 30, description: "Bar race: how many bars each moment shows (default 10)." },
|
|
198
203
|
sankeyNodes: { type: "array", items: { type: "string" }, description: "Sankey: node names in the order to stack them within their columns (reorder to untangle crossing flows); nodes left out follow in the order the flows name them." }
|
|
199
204
|
};
|
|
200
205
|
|
|
@@ -216,4 +221,5 @@ var CHART_UPDATE_PROPERTIES = {
|
|
|
216
221
|
|
|
217
222
|
|
|
218
223
|
|
|
219
|
-
|
|
224
|
+
|
|
225
|
+
exports.VALUE = VALUE; exports.SERIES_REF = SERIES_REF; exports.CATEGORY_REF = CATEGORY_REF; exports.WIDTH = WIDTH; exports.HEIGHT = HEIGHT; exports.TRENDLINE_PROPS = TRENDLINE_PROPS; exports.REFERENCE_LINE_PROPS = REFERENCE_LINE_PROPS; exports.REFERENCE_BAND_PROPS = REFERENCE_BAND_PROPS; exports.REFERENCE_LINE_PATCH = REFERENCE_LINE_PATCH; exports.REFERENCE_BAND_PATCH = REFERENCE_BAND_PATCH; exports.REFERENCE_INDEX = REFERENCE_INDEX; exports.TREE_DEFS = TREE_DEFS; exports.TREE_PATH = TREE_PATH; exports.LINK_PROPS = LINK_PROPS; exports.RACE_TIME = RACE_TIME; exports.LINK_INDEX = LINK_INDEX; exports.SERIES_PROPS = SERIES_PROPS; exports.CHART_UPDATE_PROPERTIES = CHART_UPDATE_PROPERTIES;
|