@unovis/ts 1.4.0-alpha.9 → 1.4.0-beta.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/components/annotations/config.d.ts +19 -0
- package/components/annotations/config.js +6 -0
- package/components/annotations/config.js.map +1 -0
- package/components/annotations/index.d.ts +24 -0
- package/components/annotations/index.js +116 -0
- package/components/annotations/index.js.map +1 -0
- package/components/annotations/style.d.ts +13 -0
- package/components/annotations/style.js +43 -0
- package/components/annotations/style.js.map +1 -0
- package/components/annotations/types.d.ts +43 -0
- package/components/annotations/types.js +8 -0
- package/components/annotations/types.js.map +1 -0
- package/components/area/config.d.ts +1 -1
- package/components/area/config.js.map +1 -1
- package/components/area/index.js.map +1 -1
- package/components/bullet-legend/config.d.ts +4 -2
- package/components/bullet-legend/config.js +1 -2
- package/components/bullet-legend/config.js.map +1 -1
- package/components/bullet-legend/index.js +15 -17
- package/components/bullet-legend/index.js.map +1 -1
- package/components/bullet-legend/modules/shape.d.ts +1 -2
- package/components/bullet-legend/modules/shape.js +39 -48
- package/components/bullet-legend/modules/shape.js.map +1 -1
- package/components/bullet-legend/style.js +2 -5
- package/components/bullet-legend/style.js.map +1 -1
- package/components/bullet-legend/types.d.ts +14 -5
- package/components/bullet-legend/types.js +4 -6
- package/components/bullet-legend/types.js.map +1 -1
- package/components/graph/config.d.ts +15 -22
- package/components/graph/config.js +2 -4
- package/components/graph/config.js.map +1 -1
- package/components/graph/index.d.ts +2 -7
- package/components/graph/index.js +116 -117
- package/components/graph/index.js.map +1 -1
- package/components/graph/modules/layout.js +19 -30
- package/components/graph/modules/layout.js.map +1 -1
- package/components/graph/modules/link/helper.d.ts +6 -4
- package/components/graph/modules/link/helper.js +25 -15
- package/components/graph/modules/link/helper.js.map +1 -1
- package/components/graph/modules/link/index.d.ts +3 -3
- package/components/graph/modules/link/index.js +89 -111
- package/components/graph/modules/link/index.js.map +1 -1
- package/components/graph/modules/link/style.d.ts +5 -5
- package/components/graph/modules/link/style.js +22 -26
- package/components/graph/modules/link/style.js.map +1 -1
- package/components/graph/modules/node/helper.d.ts +0 -1
- package/components/graph/modules/node/helper.js +1 -4
- package/components/graph/modules/node/helper.js.map +1 -1
- package/components/graph/modules/node/index.js +11 -28
- package/components/graph/modules/node/index.js.map +1 -1
- package/components/graph/modules/node/style.d.ts +1 -1
- package/components/graph/modules/node/style.js +6 -13
- package/components/graph/modules/node/style.js.map +1 -1
- package/components/graph/modules/shape.d.ts +2 -0
- package/components/graph/modules/shape.js +9 -7
- package/components/graph/modules/shape.js.map +1 -1
- package/components/graph/types.d.ts +5 -63
- package/components/graph/types.js +0 -1
- package/components/graph/types.js.map +1 -1
- package/components/stacked-bar/index.js.map +1 -1
- package/components/tooltip/config.d.ts +1 -1
- package/components/tooltip/config.js.map +1 -1
- package/components/tooltip/index.js +1 -3
- package/components/tooltip/index.js.map +1 -1
- package/components/vis-controls/index.d.ts +0 -3
- package/components/vis-controls/index.js +1 -6
- package/components/vis-controls/index.js.map +1 -1
- package/components.d.ts +2 -0
- package/components.js +1 -0
- package/components.js.map +1 -1
- package/containers/single-container/config.d.ts +3 -0
- package/containers/single-container/config.js.map +1 -1
- package/containers/single-container/index.js +10 -1
- package/containers/single-container/index.js.map +1 -1
- package/containers/xy-container/config.d.ts +3 -0
- package/containers/xy-container/config.js +1 -1
- package/containers/xy-container/config.js.map +1 -1
- package/containers/xy-container/index.js +17 -5
- package/containers/xy-container/index.js.map +1 -1
- package/core/component/index.d.ts +3 -3
- package/core/component/index.js +1 -1
- package/core/component/index.js.map +1 -1
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/types/misc.d.ts +1 -0
- package/types/scale.d.ts +3 -2
- package/types/scale.js +2 -1
- package/types/scale.js.map +1 -1
- package/types.d.ts +1 -0
- package/types.js +1 -0
- package/types.js.map +1 -1
- package/utils/misc.d.ts +2 -1
- package/utils/misc.js +13 -1
- package/utils/misc.js.map +1 -1
- package/utils/svg.d.ts +0 -3
- package/utils/text.js.map +1 -1
- package/utils/svg.js +0 -61
- package/utils/svg.js.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentConfigInterface } from "../../core/component/config";
|
|
2
|
+
import { AnnotationItem } from './types';
|
|
3
|
+
export interface AnnotationsConfigInterface extends ComponentConfigInterface {
|
|
4
|
+
/** Legend items. Array of `AnnotationItem`:
|
|
5
|
+
* ```
|
|
6
|
+
* {
|
|
7
|
+
* content: string | UnovisText | UnovisText[];
|
|
8
|
+
* subject?: AnnotationSubject;
|
|
9
|
+
* x?: LengthUnit;
|
|
10
|
+
* y?: LengthUnit;
|
|
11
|
+
* width?: LengthUnit;
|
|
12
|
+
* height?: LengthUnit;
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
* To learn more, see our docs https://unovis.dev/docs/auxiliary/Annotations/
|
|
16
|
+
* Default: `[]` */
|
|
17
|
+
items: AnnotationItem[] | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare const AnnotationsDefaultConfig: AnnotationsConfigInterface;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/annotations/config.ts"],"sourcesContent":["import { ComponentConfigInterface, ComponentDefaultConfig } from 'core/component/config'\n\n// Types\nimport { AnnotationItem } from './types'\n\nexport interface AnnotationsConfigInterface extends ComponentConfigInterface {\n /** Legend items. Array of `AnnotationItem`:\n * ```\n * {\n * content: string | UnovisText | UnovisText[];\n * subject?: AnnotationSubject;\n * x?: LengthUnit;\n * y?: LengthUnit;\n * width?: LengthUnit;\n * height?: LengthUnit;\n * }\n * ```\n * To learn more, see our docs https://unovis.dev/docs/auxiliary/Annotations/\n * Default: `[]` */\n items: AnnotationItem[] | undefined;\n}\n\nexport const AnnotationsDefaultConfig: AnnotationsConfigInterface = {\n ...ComponentDefaultConfig,\n items: [],\n}\n"],"names":[],"mappings":";;AAsBa,MAAA,wBAAwB,GAChC,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,sBAAsB,KACzB,KAAK,EAAE,EAAE,EAAA;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Selection } from 'd3-selection';
|
|
2
|
+
import { ComponentCore } from "../../core/component";
|
|
3
|
+
import { Spacing } from "../../types/spacing";
|
|
4
|
+
import { AnnotationsConfigInterface } from './config';
|
|
5
|
+
import * as s from './style';
|
|
6
|
+
export declare class Annotations extends ComponentCore<unknown[], AnnotationsConfigInterface> {
|
|
7
|
+
static selectors: typeof s;
|
|
8
|
+
static cssVariables: {
|
|
9
|
+
annotationsConnectorStrokeColor: "--vis-annotations-connector-stroke-color";
|
|
10
|
+
annotationsConnectorStrokeWidth: "--vis-annotations-connector-stroke-width";
|
|
11
|
+
annotationsConnectorStrokeDasharray: "--vis-annotations-connector-stroke-dasharray";
|
|
12
|
+
annotationsSubjectStrokeColor: "--vis-annotations-subject-stroke-color";
|
|
13
|
+
annotationsSubjectFillColor: "--vis-annotations-subject-fill-color";
|
|
14
|
+
annotationsSubjectStrokeDasharray: "--vis-annotations-subject-stroke-dasharray";
|
|
15
|
+
};
|
|
16
|
+
protected _defaultConfig: AnnotationsConfigInterface;
|
|
17
|
+
config: AnnotationsConfigInterface;
|
|
18
|
+
g: Selection<SVGGElement, unknown, null, undefined>;
|
|
19
|
+
events: {};
|
|
20
|
+
constructor(config?: AnnotationsConfigInterface);
|
|
21
|
+
get bleed(): Spacing;
|
|
22
|
+
_render(customDuration?: number): void;
|
|
23
|
+
private _renderSubject;
|
|
24
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { select } from 'd3-selection';
|
|
2
|
+
import { ComponentCore } from '../../core/component/index.js';
|
|
3
|
+
import { isNumber } from '../../utils/data.js';
|
|
4
|
+
import { smartTransition } from '../../utils/d3.js';
|
|
5
|
+
import { renderTextIntoFrame } from '../../utils/text.js';
|
|
6
|
+
import { parseUnit } from '../../utils/misc.js';
|
|
7
|
+
import { AnnotationsDefaultConfig } from './config.js';
|
|
8
|
+
import * as style from './style.js';
|
|
9
|
+
import { annotation, annotationContent, clickable, annotationSubject, variables } from './style.js';
|
|
10
|
+
|
|
11
|
+
class Annotations extends ComponentCore {
|
|
12
|
+
constructor(config) {
|
|
13
|
+
super();
|
|
14
|
+
this._defaultConfig = AnnotationsDefaultConfig;
|
|
15
|
+
this.config = this._defaultConfig;
|
|
16
|
+
this.events = {};
|
|
17
|
+
if (config)
|
|
18
|
+
this.setConfig(config);
|
|
19
|
+
}
|
|
20
|
+
// Todo: implement
|
|
21
|
+
get bleed() {
|
|
22
|
+
return { top: 0, bottom: 0, left: 0, right: 0 };
|
|
23
|
+
}
|
|
24
|
+
_render(customDuration) {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
super._render(customDuration);
|
|
27
|
+
const { config } = this;
|
|
28
|
+
const duration = isNumber(customDuration) ? customDuration : config.duration;
|
|
29
|
+
const annotations = this.g
|
|
30
|
+
.selectAll(`.${annotation}`)
|
|
31
|
+
.data((_a = config.items) !== null && _a !== void 0 ? _a : []);
|
|
32
|
+
const annotationsEnter = annotations.enter().append('g')
|
|
33
|
+
.attr('class', annotation);
|
|
34
|
+
annotationsEnter.append('g')
|
|
35
|
+
.attr('class', annotationContent)
|
|
36
|
+
.classed(clickable, ((_b = config.events) === null || _b === void 0 ? void 0 : _b[annotationContent]) !== undefined);
|
|
37
|
+
const annotationsSubject = annotationsEnter.append('g')
|
|
38
|
+
.attr('class', annotationSubject);
|
|
39
|
+
annotationsSubject.append('circle');
|
|
40
|
+
annotationsSubject.append('line');
|
|
41
|
+
// Todo: smooth transition
|
|
42
|
+
annotationsEnter.merge(annotations)
|
|
43
|
+
.each((annotation, i, elements) => {
|
|
44
|
+
var _a;
|
|
45
|
+
// Content rendering
|
|
46
|
+
// const contentGroupElement = elements[i].querySelector<SVGGElement>(`.${s.annotationContent}`)
|
|
47
|
+
const contentGroupElement = select(elements[i])
|
|
48
|
+
.select(`.${annotationContent}`)
|
|
49
|
+
.style('cursor', ((_a = config.events) === null || _a === void 0 ? void 0 : _a[annotationSubject]) ? 'pointer' : null);
|
|
50
|
+
const content = typeof annotation.content === 'string' ? { text: annotation.content, fontSize: 12 } : annotation.content;
|
|
51
|
+
const x = parseUnit(annotation.x, this._width);
|
|
52
|
+
const y = parseUnit(annotation.y, this._height);
|
|
53
|
+
const width = parseUnit(annotation.width, this._width);
|
|
54
|
+
const height = parseUnit(annotation.height, this._height);
|
|
55
|
+
const options = Object.assign(Object.assign({}, annotation), { x, y, width, height });
|
|
56
|
+
renderTextIntoFrame(contentGroupElement.node(), content, options);
|
|
57
|
+
// Subject rendering
|
|
58
|
+
requestAnimationFrame(() => this._renderSubject(elements[i], annotation.subject, duration));
|
|
59
|
+
});
|
|
60
|
+
smartTransition(annotations.exit(), duration)
|
|
61
|
+
.style('opacity', 0)
|
|
62
|
+
.remove();
|
|
63
|
+
}
|
|
64
|
+
_renderSubject(annotationGroupElement, subject, duration) {
|
|
65
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
66
|
+
const contentGroupElement = annotationGroupElement.querySelector(`.${annotationContent}`);
|
|
67
|
+
const subjectGroupElement = annotationGroupElement.querySelector(`.${annotationSubject}`);
|
|
68
|
+
const subjectGroup = select(subjectGroupElement);
|
|
69
|
+
const subjectX = (_a = parseUnit(typeof (subject === null || subject === void 0 ? void 0 : subject.x) === 'function' ? subject.x() : subject === null || subject === void 0 ? void 0 : subject.x, this._width)) !== null && _a !== void 0 ? _a : null;
|
|
70
|
+
const subjectY = (_b = parseUnit(typeof (subject === null || subject === void 0 ? void 0 : subject.y) === 'function' ? subject.y() : subject === null || subject === void 0 ? void 0 : subject.y, this._height)) !== null && _b !== void 0 ? _b : null;
|
|
71
|
+
const subjectStrokeColor = (_c = subject === null || subject === void 0 ? void 0 : subject.strokeColor) !== null && _c !== void 0 ? _c : null;
|
|
72
|
+
const subjectFillColor = (_d = subject === null || subject === void 0 ? void 0 : subject.fillColor) !== null && _d !== void 0 ? _d : null;
|
|
73
|
+
const subjectStrokeDasharray = (_e = subject === null || subject === void 0 ? void 0 : subject.strokeDasharray) !== null && _e !== void 0 ? _e : null;
|
|
74
|
+
const connectorLineColor = (_f = subject === null || subject === void 0 ? void 0 : subject.connectorLineColor) !== null && _f !== void 0 ? _f : null;
|
|
75
|
+
const connectorLineStrokeDasharray = (_g = subject === null || subject === void 0 ? void 0 : subject.connectorLineStrokeDasharray) !== null && _g !== void 0 ? _g : null;
|
|
76
|
+
const subjectRadius = (_h = subject === null || subject === void 0 ? void 0 : subject.radius) !== null && _h !== void 0 ? _h : 0;
|
|
77
|
+
const padding = (_j = subject === null || subject === void 0 ? void 0 : subject.padding) !== null && _j !== void 0 ? _j : 5;
|
|
78
|
+
const contentBbox = contentGroupElement.getBBox();
|
|
79
|
+
const dy = Math.abs(subjectY - (contentBbox.y + contentBbox.height / 2));
|
|
80
|
+
const dx = Math.abs(subjectX - (contentBbox.x + contentBbox.width / 2));
|
|
81
|
+
const annotationPadding = 5;
|
|
82
|
+
const x2 = (dx < dy) && ((subjectY < contentBbox.y) || (subjectY > (contentBbox.y + contentBbox.height)))
|
|
83
|
+
? contentBbox.x + contentBbox.width / 2
|
|
84
|
+
: (subjectX < contentBbox.x) ? contentBbox.x - annotationPadding : contentBbox.x + contentBbox.width + annotationPadding;
|
|
85
|
+
const y2 = (dx >= dy) || ((subjectY >= contentBbox.y) && (subjectY <= (contentBbox.y + contentBbox.height)))
|
|
86
|
+
? contentBbox.y + contentBbox.height / 2
|
|
87
|
+
: (subjectY < contentBbox.y) ? contentBbox.y - annotationPadding : contentBbox.y + contentBbox.height + annotationPadding;
|
|
88
|
+
const angle = Math.atan2(y2 - subjectY, x2 - subjectX) * 180 / Math.PI;
|
|
89
|
+
const x1 = subjectX + Math.cos(angle * Math.PI / 180) * (subjectRadius + padding);
|
|
90
|
+
const y1 = subjectY + Math.sin(angle * Math.PI / 180) * (subjectRadius + padding);
|
|
91
|
+
const circleSelection = subjectGroup.select('circle');
|
|
92
|
+
const lineSelection = subjectGroup.select('line');
|
|
93
|
+
circleSelection
|
|
94
|
+
.attr('visibility', subject ? null : 'hidden')
|
|
95
|
+
.attr('cx', subjectX)
|
|
96
|
+
.attr('cy', subjectY)
|
|
97
|
+
.attr('r', subjectRadius)
|
|
98
|
+
.style('stroke', subjectStrokeColor)
|
|
99
|
+
.style('fill', subjectFillColor)
|
|
100
|
+
.style('stroke-dasharray', subjectStrokeDasharray);
|
|
101
|
+
lineSelection
|
|
102
|
+
.attr('visibility', subject ? null : 'hidden')
|
|
103
|
+
.attr('x1', x1)
|
|
104
|
+
.attr('y1', y1)
|
|
105
|
+
.attr('x2', x2)
|
|
106
|
+
.attr('y2', y2)
|
|
107
|
+
.style('stroke', connectorLineColor)
|
|
108
|
+
.style('stroke-dasharray', connectorLineStrokeDasharray)
|
|
109
|
+
.style('fill', 'none');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
Annotations.selectors = style;
|
|
113
|
+
Annotations.cssVariables = variables;
|
|
114
|
+
|
|
115
|
+
export { Annotations };
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/annotations/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\n\n// Core\nimport { ComponentCore } from 'core/component'\n\n// Utils\nimport { isNumber } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { renderTextIntoFrame } from 'utils/text'\nimport { parseUnit } from 'utils/misc'\n\n// Types\nimport { Spacing } from 'types/spacing'\n\n// Local Types\nimport { AnnotationItem, AnnotationSubject } from './types'\n\n// Config\nimport { AnnotationsDefaultConfig, AnnotationsConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Annotations extends ComponentCore<unknown[], AnnotationsConfigInterface> {\n static selectors = s\n static cssVariables = s.variables\n protected _defaultConfig = AnnotationsDefaultConfig as AnnotationsConfigInterface\n public config: AnnotationsConfigInterface = this._defaultConfig\n\n g: Selection<SVGGElement, unknown, null, undefined>\n\n events = {}\n\n constructor (config?: AnnotationsConfigInterface) {\n super()\n if (config) this.setConfig(config)\n }\n\n // Todo: implement\n get bleed (): Spacing {\n return { top: 0, bottom: 0, left: 0, right: 0 }\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n const annotations = this.g\n .selectAll<SVGGElement, AnnotationItem>(`.${s.annotation}`)\n .data(config.items ?? [])\n\n const annotationsEnter = annotations.enter().append('g')\n .attr('class', s.annotation)\n\n annotationsEnter.append('g')\n .attr('class', s.annotationContent)\n .classed(s.clickable, config.events?.[s.annotationContent] !== undefined)\n\n const annotationsSubject = annotationsEnter.append('g')\n .attr('class', s.annotationSubject)\n\n annotationsSubject.append('circle')\n annotationsSubject.append('line')\n\n // Todo: smooth transition\n annotationsEnter.merge(annotations)\n .each((annotation, i, elements) => {\n // Content rendering\n // const contentGroupElement = elements[i].querySelector<SVGGElement>(`.${s.annotationContent}`)\n const contentGroupElement = select(elements[i])\n .select<SVGGElement>(`.${s.annotationContent}`)\n .style('cursor', config.events?.[s.annotationSubject] ? 'pointer' : null)\n const content = typeof annotation.content === 'string' ? { text: annotation.content, fontSize: 12 } : annotation.content\n const x = parseUnit(annotation.x, this._width)\n const y = parseUnit(annotation.y, this._height)\n const width = parseUnit(annotation.width, this._width)\n const height = parseUnit(annotation.height, this._height)\n const options = { ...annotation, x, y, width, height }\n\n renderTextIntoFrame(contentGroupElement.node(), content, options)\n\n // Subject rendering\n requestAnimationFrame(() => this._renderSubject(elements[i], annotation.subject, duration))\n })\n\n smartTransition(annotations.exit(), duration)\n .style('opacity', 0)\n .remove()\n }\n\n private _renderSubject (\n annotationGroupElement: SVGGElement,\n subject: AnnotationSubject | undefined,\n duration?: number\n ): void {\n const contentGroupElement = annotationGroupElement.querySelector<SVGGElement>(`.${s.annotationContent}`)\n const subjectGroupElement = annotationGroupElement.querySelector<SVGGElement>(`.${s.annotationSubject}`)\n const subjectGroup = select(subjectGroupElement)\n\n const subjectX: number | null = parseUnit(typeof subject?.x === 'function' ? subject.x() : subject?.x, this._width) ?? null\n const subjectY: number | null = parseUnit(typeof subject?.y === 'function' ? subject.y() : subject?.y, this._height) ?? null\n const subjectStrokeColor: string | null = subject?.strokeColor ?? null\n const subjectFillColor: string | null = subject?.fillColor ?? null\n const subjectStrokeDasharray: string | null = subject?.strokeDasharray ?? null\n const connectorLineColor: string | null = subject?.connectorLineColor ?? null\n const connectorLineStrokeDasharray: string | null = subject?.connectorLineStrokeDasharray ?? null\n const subjectRadius: number | null = subject?.radius ?? 0\n const padding = subject?.padding ?? 5\n\n const contentBbox = contentGroupElement.getBBox()\n const dy = Math.abs(subjectY - (contentBbox.y + contentBbox.height / 2))\n const dx = Math.abs(subjectX - (contentBbox.x + contentBbox.width / 2))\n const annotationPadding = 5\n const x2 = (dx < dy) && ((subjectY < contentBbox.y) || (subjectY > (contentBbox.y + contentBbox.height)))\n ? contentBbox.x + contentBbox.width / 2\n : (subjectX < contentBbox.x) ? contentBbox.x - annotationPadding : contentBbox.x + contentBbox.width + annotationPadding\n\n const y2 = (dx >= dy) || ((subjectY >= contentBbox.y) && (subjectY <= (contentBbox.y + contentBbox.height)))\n ? contentBbox.y + contentBbox.height / 2\n : (subjectY < contentBbox.y) ? contentBbox.y - annotationPadding : contentBbox.y + contentBbox.height + annotationPadding\n\n const angle = Math.atan2(y2 - subjectY, x2 - subjectX) * 180 / Math.PI\n const x1 = subjectX + Math.cos(angle * Math.PI / 180) * (subjectRadius + padding)\n const y1 = subjectY + Math.sin(angle * Math.PI / 180) * (subjectRadius + padding)\n\n const circleSelection = subjectGroup.select('circle')\n const lineSelection = subjectGroup.select('line')\n circleSelection\n .attr('visibility', subject ? null : 'hidden')\n .attr('cx', subjectX)\n .attr('cy', subjectY)\n .attr('r', subjectRadius)\n .style('stroke', subjectStrokeColor)\n .style('fill', subjectFillColor)\n .style('stroke-dasharray', subjectStrokeDasharray)\n\n lineSelection\n .attr('visibility', subject ? null : 'hidden')\n .attr('x1', x1)\n .attr('y1', y1)\n .attr('x2', x2)\n .attr('y2', y2)\n .style('stroke', connectorLineColor)\n .style('stroke-dasharray', connectorLineStrokeDasharray)\n .style('fill', 'none')\n }\n}\n"],"names":["s.annotation","s.annotationContent","s.clickable","s.annotationSubject","s","s.variables"],"mappings":";;;;;;;;;;AAuBM,MAAO,WAAY,SAAQ,aAAoD,CAAA;AAUnF,IAAA,WAAA,CAAa,MAAmC,EAAA;AAC9C,QAAA,KAAK,EAAE,CAAA;QARC,IAAc,CAAA,cAAA,GAAG,wBAAsD,CAAA;AAC1E,QAAA,IAAA,CAAA,MAAM,GAA+B,IAAI,CAAC,cAAc,CAAA;QAI/D,IAAM,CAAA,MAAA,GAAG,EAAE,CAAA;AAIT,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;KACnC;;AAGD,IAAA,IAAI,KAAK,GAAA;AACP,QAAA,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;KAChD;AAED,IAAA,OAAO,CAAE,cAAuB,EAAA;;AAC9B,QAAA,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;AAC7B,QAAA,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;AACvB,QAAA,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,GAAG,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAA;AAE5E,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC;AACvB,aAAA,SAAS,CAA8B,CAAI,CAAA,EAAAA,UAAY,EAAE,CAAC;aAC1D,IAAI,CAAC,MAAA,MAAM,CAAC,KAAK,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GA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AAC,kBAAkB,EAAE,4BAA4B,CAAC;AACvD,aAAA,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KACzB;;AA1HM,WAAS,CAAA,SAAA,GAAGC,KAAC,CAAA;AACb,WAAA,CAAA,YAAY,GAAGC,SAAW;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const root: string;
|
|
2
|
+
export declare const variables: {
|
|
3
|
+
annotationsConnectorStrokeColor: "--vis-annotations-connector-stroke-color";
|
|
4
|
+
annotationsConnectorStrokeWidth: "--vis-annotations-connector-stroke-width";
|
|
5
|
+
annotationsConnectorStrokeDasharray: "--vis-annotations-connector-stroke-dasharray";
|
|
6
|
+
annotationsSubjectStrokeColor: "--vis-annotations-subject-stroke-color";
|
|
7
|
+
annotationsSubjectFillColor: "--vis-annotations-subject-fill-color";
|
|
8
|
+
annotationsSubjectStrokeDasharray: "--vis-annotations-subject-stroke-dasharray";
|
|
9
|
+
};
|
|
10
|
+
export declare const annotation: string;
|
|
11
|
+
export declare const annotationSubject: string;
|
|
12
|
+
export declare const annotationContent: string;
|
|
13
|
+
export declare const clickable: string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { css } from '@emotion/css';
|
|
2
|
+
import { getCssVarNames, injectGlobalCssVariables } from '../../utils/style.js';
|
|
3
|
+
|
|
4
|
+
const cssVarDefaults = {
|
|
5
|
+
'--vis-annotations-connector-stroke-color': '#444',
|
|
6
|
+
'--vis-annotations-connector-stroke-width': '1px',
|
|
7
|
+
'--vis-annotations-connector-stroke-dasharray': 'none',
|
|
8
|
+
'--vis-annotations-subject-stroke-color': '#444',
|
|
9
|
+
'--vis-annotations-subject-fill-color': 'none',
|
|
10
|
+
'--vis-annotations-subject-stroke-dasharray': 'none',
|
|
11
|
+
};
|
|
12
|
+
const root = css `
|
|
13
|
+
label: annotations-component;
|
|
14
|
+
`;
|
|
15
|
+
const variables = getCssVarNames(cssVarDefaults);
|
|
16
|
+
injectGlobalCssVariables(cssVarDefaults, root);
|
|
17
|
+
const annotation = css `
|
|
18
|
+
label: annotation;
|
|
19
|
+
`;
|
|
20
|
+
const annotationSubject = css `
|
|
21
|
+
label: annotationSubject;
|
|
22
|
+
|
|
23
|
+
line {
|
|
24
|
+
stroke: var(${variables.annotationsConnectorStrokeColor});
|
|
25
|
+
stroke-width: var(${variables.annotationsConnectorStrokeWidth});
|
|
26
|
+
stroke-dasharray: var(${variables.annotationsConnectorStrokeDasharray});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
circle {
|
|
30
|
+
stroke: var(${variables.annotationsSubjectStrokeColor});
|
|
31
|
+
fill: var(${variables.annotationsSubjectFillColor});
|
|
32
|
+
stroke-dasharray: var(${variables.annotationsSubjectStrokeDasharray});
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
const annotationContent = css `
|
|
36
|
+
label: annotationContent;
|
|
37
|
+
`;
|
|
38
|
+
const clickable = css `
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
export { annotation, annotationContent, annotationSubject, clickable, root, variables };
|
|
43
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../src/components/annotations/style.ts"],"sourcesContent":["import { css } from '@emotion/css'\n\n// Utils\nimport { getCssVarNames, injectGlobalCssVariables } from 'utils/style'\n\nconst cssVarDefaults = {\n '--vis-annotations-connector-stroke-color': '#444',\n '--vis-annotations-connector-stroke-width': '1px',\n '--vis-annotations-connector-stroke-dasharray': 'none',\n\n '--vis-annotations-subject-stroke-color': '#444',\n '--vis-annotations-subject-fill-color': 'none',\n '--vis-annotations-subject-stroke-dasharray': 'none',\n}\n\nexport const root = css`\n label: annotations-component;\n`\nexport const variables = getCssVarNames(cssVarDefaults)\ninjectGlobalCssVariables(cssVarDefaults, root)\n\nexport const annotation = css`\n label: annotation;\n`\n\nexport const annotationSubject = css`\n label: annotationSubject;\n\n line {\n stroke: var(${variables.annotationsConnectorStrokeColor});\n stroke-width: var(${variables.annotationsConnectorStrokeWidth});\n stroke-dasharray: var(${variables.annotationsConnectorStrokeDasharray});\n }\n\n circle {\n stroke: var(${variables.annotationsSubjectStrokeColor});\n fill: var(${variables.annotationsSubjectFillColor});\n stroke-dasharray: var(${variables.annotationsSubjectStrokeDasharray});\n }\n`\n\nexport const annotationContent = css`\n label: annotationContent;\n`\n\nexport const clickable = css`\n cursor: pointer;\n`\n"],"names":[],"mappings":";;;AAKA,MAAM,cAAc,GAAG;AACrB,IAAA,0CAA0C,EAAE,MAAM;AAClD,IAAA,0CAA0C,EAAE,KAAK;AACjD,IAAA,8CAA8C,EAAE,MAAM;AAEtD,IAAA,wCAAwC,EAAE,MAAM;AAChD,IAAA,sCAAsC,EAAE,MAAM;AAC9C,IAAA,4CAA4C,EAAE,MAAM;CACrD,CAAA;AAEM,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;EAEtB;MACY,SAAS,GAAG,cAAc,CAAC,cAAc,EAAC;AACvD,wBAAwB,CAAC,cAAc,EAAE,IAAI,CAAC,CAAA;AAEvC,MAAM,UAAU,GAAG,GAAG,CAAA,CAAA;;EAE5B;AAEM,MAAM,iBAAiB,GAAG,GAAG,CAAA,CAAA;;;;AAIlB,gBAAA,EAAA,SAAS,CAAC,+BAA+B,CAAA;AACnC,sBAAA,EAAA,SAAS,CAAC,+BAA+B,CAAA;AACrC,0BAAA,EAAA,SAAS,CAAC,mCAAmC,CAAA;;;;AAIvD,gBAAA,EAAA,SAAS,CAAC,6BAA6B,CAAA;AACzC,cAAA,EAAA,SAAS,CAAC,2BAA2B,CAAA;AACzB,0BAAA,EAAA,SAAS,CAAC,iCAAiC,CAAA;;EAEtE;AAEM,MAAM,iBAAiB,GAAG,GAAG,CAAA,CAAA;;EAEnC;AAEM,MAAM,SAAS,GAAG,GAAG,CAAA,CAAA;;;;;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { LengthUnit } from "../../types/misc";
|
|
2
|
+
import { UnovisText, UnovisTextFrameOptions } from "../../types/text";
|
|
3
|
+
export declare type AnnotationItem = UnovisTextFrameOptions & {
|
|
4
|
+
content: string | UnovisText | UnovisText[];
|
|
5
|
+
subject?: AnnotationSubject;
|
|
6
|
+
x?: LengthUnit;
|
|
7
|
+
y?: LengthUnit;
|
|
8
|
+
width?: LengthUnit;
|
|
9
|
+
height?: LengthUnit;
|
|
10
|
+
};
|
|
11
|
+
export declare type AnnotationSubjectLocationXY = {
|
|
12
|
+
x: LengthUnit | (() => LengthUnit);
|
|
13
|
+
y: LengthUnit | (() => LengthUnit);
|
|
14
|
+
};
|
|
15
|
+
export declare enum AnnotationSubjectType {
|
|
16
|
+
Circle = "circle",
|
|
17
|
+
Rect = "rect"
|
|
18
|
+
}
|
|
19
|
+
export declare type AnnotationSubjectStyle = {
|
|
20
|
+
/** Type of the subject: AnnotationSubjectType.Circle or AnnotationSubjectType.Rect
|
|
21
|
+
* Default: AnnotationSubjectType.Circle
|
|
22
|
+
*/
|
|
23
|
+
shape?: AnnotationSubjectType | string;
|
|
24
|
+
/** Subject width. Only for `AnnotationSubjectType.Rect` */
|
|
25
|
+
width?: number;
|
|
26
|
+
/** Subject height. Only for `AnnotationSubjectType.Rect` */
|
|
27
|
+
height?: number;
|
|
28
|
+
/** Subject radius. Only for `AnnotationSubjectType.Circle` */
|
|
29
|
+
radius?: number;
|
|
30
|
+
/** Subject fill color */
|
|
31
|
+
fillColor?: string;
|
|
32
|
+
/** Subject stroke color */
|
|
33
|
+
strokeColor?: string;
|
|
34
|
+
/** Subject stroke-dasharray configuration */
|
|
35
|
+
strokeDasharray?: string;
|
|
36
|
+
/** Padding between the subject and the connector line */
|
|
37
|
+
padding?: number;
|
|
38
|
+
/** Connector line color */
|
|
39
|
+
connectorLineColor?: string;
|
|
40
|
+
/** Connector line stroke-dasharray configuration */
|
|
41
|
+
connectorLineStrokeDasharray?: string;
|
|
42
|
+
};
|
|
43
|
+
export declare type AnnotationSubject = AnnotationSubjectStyle & AnnotationSubjectLocationXY;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var AnnotationSubjectType;
|
|
2
|
+
(function (AnnotationSubjectType) {
|
|
3
|
+
AnnotationSubjectType["Circle"] = "circle";
|
|
4
|
+
AnnotationSubjectType["Rect"] = "rect";
|
|
5
|
+
})(AnnotationSubjectType || (AnnotationSubjectType = {}));
|
|
6
|
+
|
|
7
|
+
export { AnnotationSubjectType };
|
|
8
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/components/annotations/types.ts"],"sourcesContent":["import { LengthUnit } from 'types/misc'\nimport { UnovisText, UnovisTextFrameOptions } from 'types/text'\n\nexport type AnnotationItem = UnovisTextFrameOptions & {\n content: string | UnovisText | UnovisText[];\n subject?: AnnotationSubject;\n x?: LengthUnit;\n y?: LengthUnit;\n width?: LengthUnit;\n height?: LengthUnit;\n}\n\nexport type AnnotationSubjectLocationXY = {\n x: LengthUnit | (() => LengthUnit);\n y: LengthUnit | (() => LengthUnit);\n}\n\nexport enum AnnotationSubjectType {\n Circle = 'circle',\n Rect = 'rect',\n}\n\nexport type AnnotationSubjectStyle = {\n /** Type of the subject: AnnotationSubjectType.Circle or AnnotationSubjectType.Rect\n * Default: AnnotationSubjectType.Circle\n */\n shape?: AnnotationSubjectType | string;\n /** Subject width. Only for `AnnotationSubjectType.Rect` */\n width?: number;\n /** Subject height. Only for `AnnotationSubjectType.Rect` */\n height?: number;\n /** Subject radius. Only for `AnnotationSubjectType.Circle` */\n radius?: number;\n /** Subject fill color */\n fillColor?: string;\n /** Subject stroke color */\n strokeColor?: string;\n /** Subject stroke-dasharray configuration */\n strokeDasharray?: string;\n /** Padding between the subject and the connector line */\n padding?: number;\n /** Connector line color */\n connectorLineColor?: string;\n /** Connector line stroke-dasharray configuration */\n connectorLineStrokeDasharray?: string;\n}\n\nexport type AnnotationSubject = AnnotationSubjectStyle & AnnotationSubjectLocationXY\n\n"],"names":[],"mappings":"IAiBY,sBAGX;AAHD,CAAA,UAAY,qBAAqB,EAAA;AAC/B,IAAA,qBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,qBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACf,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,GAGhC,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -5,7 +5,7 @@ export interface AreaConfigInterface<Datum> extends XYComponentConfigInterface<D
|
|
|
5
5
|
/** Area color accessor function. The whole data array will be passed as the first argument. Default: `undefined` */
|
|
6
6
|
color?: ColorAccessor<Datum[]>;
|
|
7
7
|
/** Curve type from the CurveType enum. Default: `CurveType.MonotoneX` */
|
|
8
|
-
curveType?: CurveType;
|
|
8
|
+
curveType?: CurveType | string;
|
|
9
9
|
/** Baseline value or accessor function. Default: `undefined` */
|
|
10
10
|
baseline?: NumericAccessor<Datum>;
|
|
11
11
|
/** Opacity value or accessor function. Default: `1` */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/area/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentDefaultConfig } from 'core/xy-component/config'\n\n// Types\nimport { CurveType } from 'types/curve'\nimport { ColorAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\n\nexport interface AreaConfigInterface<Datum> extends XYComponentConfigInterface<Datum> {\n /** Area color accessor function. The whole data array will be passed as the first argument. Default: `undefined` */\n color?: ColorAccessor<Datum[]>;\n /** Curve type from the CurveType enum. Default: `CurveType.MonotoneX` */\n curveType?: CurveType;\n /** Baseline value or accessor function. Default: `undefined` */\n baseline?: NumericAccessor<Datum>;\n /** Opacity value or accessor function. Default: `1` */\n opacity?: NumericAccessor<Datum[]>;\n /** Optional area cursor. String or accessor function. Default: `null` */\n cursor?: StringAccessor<Datum[]>;\n /** If an area is smaller than 1px, extend it to have 1px height.\n * This setting is useful when some of the area values are zeros or very small so visually they become\n * practically invisible, but you want to show that the data behind them exists and they're not just empty segments.\n * Default: `false` */\n minHeight1Px?: boolean;\n}\n\nexport const AreaDefaultConfig: AreaConfigInterface<unknown> = {\n ...XYComponentDefaultConfig,\n color: undefined,\n curveType: CurveType.MonotoneX,\n baseline: (): number => 0,\n opacity: 1,\n cursor: null,\n minHeight1Px: false,\n}\n"],"names":[],"mappings":";;;AAwBO,MAAM,iBAAiB,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACzB,wBAAwB,CAC3B,EAAA,EAAA,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,SAAS,CAAC,SAAS,EAC9B,QAAQ,EAAE,MAAc,CAAC,EACzB,OAAO,EAAE,CAAC,EACV,MAAM,EAAE,IAAI,EACZ,YAAY,EAAE,KAAK;;;;"}
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/area/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentDefaultConfig } from 'core/xy-component/config'\n\n// Types\nimport { CurveType } from 'types/curve'\nimport { ColorAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\n\nexport interface AreaConfigInterface<Datum> extends XYComponentConfigInterface<Datum> {\n /** Area color accessor function. The whole data array will be passed as the first argument. Default: `undefined` */\n color?: ColorAccessor<Datum[]>;\n /** Curve type from the CurveType enum. Default: `CurveType.MonotoneX` */\n curveType?: CurveType | string;\n /** Baseline value or accessor function. Default: `undefined` */\n baseline?: NumericAccessor<Datum>;\n /** Opacity value or accessor function. Default: `1` */\n opacity?: NumericAccessor<Datum[]>;\n /** Optional area cursor. String or accessor function. Default: `null` */\n cursor?: StringAccessor<Datum[]>;\n /** If an area is smaller than 1px, extend it to have 1px height.\n * This setting is useful when some of the area values are zeros or very small so visually they become\n * practically invisible, but you want to show that the data behind them exists and they're not just empty segments.\n * Default: `false` */\n minHeight1Px?: boolean;\n}\n\nexport const AreaDefaultConfig: AreaConfigInterface<unknown> = {\n ...XYComponentDefaultConfig,\n color: undefined,\n curveType: CurveType.MonotoneX,\n baseline: (): number => 0,\n opacity: 1,\n cursor: null,\n minHeight1Px: false,\n}\n"],"names":[],"mappings":";;;AAwBO,MAAM,iBAAiB,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACzB,wBAAwB,CAC3B,EAAA,EAAA,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,SAAS,CAAC,SAAS,EAC9B,QAAQ,EAAE,MAAc,CAAC,EACzB,OAAO,EAAE,CAAC,EACV,MAAM,EAAE,IAAI,EACZ,YAAY,EAAE,KAAK;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/area/index.ts"],"sourcesContent":["import { select } from 'd3-selection'\nimport { Transition } from 'd3-transition'\nimport { area, Area as AreaInterface } from 'd3-shape'\nimport { interpolatePath } from 'd3-interpolate-path'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { getNumber, getString, isArray, isNumber, getStackedExtent, getStackedData, filterDataByRange } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\n\n// Types\nimport { Curve } from 'types/curve'\nimport { NumericAccessor } from 'types/accessor'\n\n// Local Types\nimport { AreaDatum } from './types'\n\n// Config\nimport { AreaDefaultConfig, AreaConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Area<Datum> extends XYComponentCore<Datum, AreaConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = AreaDefaultConfig as AreaConfigInterface<Datum>\n public config: AreaConfigInterface<Datum> = this._defaultConfig\n public stacked = true\n private _areaGen: AreaInterface<AreaDatum>\n private _prevNegative: boolean[] | undefined // To help guessing the stack direction when an accessor was set to null or 0\n\n events = {\n [Area.selectors.area]: {},\n }\n\n constructor (config?: AreaConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config, datamodel: { data } } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n const curveGen = Curve[config.curveType]\n this._areaGen = area<AreaDatum>()\n .x(d => d.x)\n .y0(d => d.y0)\n .y1(d => {\n const isSmallerThanPixel = Math.abs(d.y1 - d.y0) < 1\n return d.y1 - ((isSmallerThanPixel && config.minHeight1Px) ? 1 : 0)\n })\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n .curve(curveGen)\n\n const yAccessors = (isArray(config.y) ? config.y : [config.y]) as NumericAccessor<Datum>[]\n const areaDataX = data.map((d, i) => this.xScale(getNumber(d, config.x, i)))\n\n const stacked = getStackedData(data, config.baseline, yAccessors, this._prevNegative)\n this._prevNegative = stacked.map(s => !!s.negative)\n const stackedData: AreaDatum[][] = stacked.map(\n arr => arr.map(\n (d, j) => ({\n y0: this.yScale(d[0]),\n y1: this.yScale(d[1]),\n x: areaDataX[j],\n })\n )\n )\n\n // We reverse the data in order to have the first areas to be displayed on top\n // for better visibility when they're close to zero\n const areaMaxIdx = stackedData.length - 1\n const stackedDataReversed = stackedData.reverse()\n const areas = this.g\n .selectAll<SVGPathElement, AreaDatum>(`.${s.area}`)\n .data(stackedDataReversed)\n\n const areasEnter = areas.enter().append('path')\n .attr('class', s.area)\n .attr('d', d => this._areaGen(d) || this._emptyPath())\n .style('opacity', 0)\n .style('fill', (d, i) => getColor(data, config.color, areaMaxIdx - i))\n\n const areasMerged = smartTransition(areasEnter.merge(areas), duration)\n .style('opacity', (d, i) => {\n const isDefined = d.some(p => (p.y0 - p.y1) !== 0)\n return isDefined ? getNumber(data, config.opacity, areaMaxIdx - i) : 0\n })\n .style('fill', (d, i) => getColor(data, config.color, areaMaxIdx - i))\n .style('cursor', (d, i) => getString(data, config.cursor, areaMaxIdx - i))\n\n if (duration) {\n const transition = areasMerged as Transition<SVGPathElement, AreaDatum[], SVGGElement, AreaDatum[]>\n transition.attrTween('d', (d, i, el) => {\n const previous = select(el[i]).attr('d')\n const next = this._areaGen(d) || this._emptyPath()\n return interpolatePath(previous, next)\n })\n } else {\n areasMerged.attr('d', d => this._areaGen(d) || this._emptyPath())\n }\n\n smartTransition(areas.exit(), duration)\n .style('opacity', 0)\n .remove()\n }\n\n getYDataExtent (scaleByVisibleData: boolean): number[] {\n const { config, datamodel } = this\n const yAccessors = (isArray(config.y) ? config.y : [config.y]) as NumericAccessor<Datum>[]\n\n const data = scaleByVisibleData ? filterDataByRange(datamodel.data, this.xScale.domain() as [number, number], config.x) : datamodel.data\n return getStackedExtent(data, config.baseline, ...yAccessors)\n }\n\n _emptyPath (): string {\n const xRange = this.xScale.range()\n const yDomain = this.yScale.domain() as number[]\n\n const y0 = this.yScale((yDomain[0] + yDomain[1]) / 2)\n const y1 = y0\n\n return this._areaGen([\n { y0, y1, x: xRange[0] },\n { y0, y1, x: xRange[1] },\n ])\n }\n}\n"],"names":["s.area","s"],"mappings":";;;;;;;;;;;;AA0BM,MAAO,IAAY,SAAQ,eAAkD,CAAA;AAYjF,IAAA,WAAA,CAAa,MAAmC,EAAA;AAC9C,QAAA,KAAK,EAAE,CAAA;QAXC,IAAc,CAAA,cAAA,GAAG,iBAA+C,CAAA;AACnE,QAAA,IAAA,CAAA,MAAM,GAA+B,IAAI,CAAC,cAAc,CAAA;QACxD,IAAO,CAAA,OAAA,GAAG,IAAI,CAAA;AAIrB,QAAA,IAAA,CAAA,MAAM,GAAG;AACP,YAAA,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,EAAE;SAC1B,CAAA;AAIC,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;KACnC;AAED,IAAA,OAAO,CAAE,cAAuB,EAAA;AAC9B,QAAA,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;QAC7B,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,CAAA;AAC5C,QAAA,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,GAAG,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAA;QAE5E,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/area/index.ts"],"sourcesContent":["import { select } from 'd3-selection'\nimport { Transition } from 'd3-transition'\nimport { area, Area as AreaInterface } from 'd3-shape'\nimport { interpolatePath } from 'd3-interpolate-path'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { getNumber, getString, isArray, isNumber, getStackedExtent, getStackedData, filterDataByRange } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\n\n// Types\nimport { Curve, CurveType } from 'types/curve'\nimport { NumericAccessor } from 'types/accessor'\n\n// Local Types\nimport { AreaDatum } from './types'\n\n// Config\nimport { AreaDefaultConfig, AreaConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Area<Datum> extends XYComponentCore<Datum, AreaConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = AreaDefaultConfig as AreaConfigInterface<Datum>\n public config: AreaConfigInterface<Datum> = this._defaultConfig\n public stacked = true\n private _areaGen: AreaInterface<AreaDatum>\n private _prevNegative: boolean[] | undefined // To help guessing the stack direction when an accessor was set to null or 0\n\n events = {\n [Area.selectors.area]: {},\n }\n\n constructor (config?: AreaConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config, datamodel: { data } } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n const curveGen = Curve[config.curveType as CurveType]\n this._areaGen = area<AreaDatum>()\n .x(d => d.x)\n .y0(d => d.y0)\n .y1(d => {\n const isSmallerThanPixel = Math.abs(d.y1 - d.y0) < 1\n return d.y1 - ((isSmallerThanPixel && config.minHeight1Px) ? 1 : 0)\n })\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n .curve(curveGen)\n\n const yAccessors = (isArray(config.y) ? config.y : [config.y]) as NumericAccessor<Datum>[]\n const areaDataX = data.map((d, i) => this.xScale(getNumber(d, config.x, i)))\n\n const stacked = getStackedData(data, config.baseline, yAccessors, this._prevNegative)\n this._prevNegative = stacked.map(s => !!s.negative)\n const stackedData: AreaDatum[][] = stacked.map(\n arr => arr.map(\n (d, j) => ({\n y0: this.yScale(d[0]),\n y1: this.yScale(d[1]),\n x: areaDataX[j],\n })\n )\n )\n\n // We reverse the data in order to have the first areas to be displayed on top\n // for better visibility when they're close to zero\n const areaMaxIdx = stackedData.length - 1\n const stackedDataReversed = stackedData.reverse()\n const areas = this.g\n .selectAll<SVGPathElement, AreaDatum>(`.${s.area}`)\n .data(stackedDataReversed)\n\n const areasEnter = areas.enter().append('path')\n .attr('class', s.area)\n .attr('d', d => this._areaGen(d) || this._emptyPath())\n .style('opacity', 0)\n .style('fill', (d, i) => getColor(data, config.color, areaMaxIdx - i))\n\n const areasMerged = smartTransition(areasEnter.merge(areas), duration)\n .style('opacity', (d, i) => {\n const isDefined = d.some(p => (p.y0 - p.y1) !== 0)\n return isDefined ? getNumber(data, config.opacity, areaMaxIdx - i) : 0\n })\n .style('fill', (d, i) => getColor(data, config.color, areaMaxIdx - i))\n .style('cursor', (d, i) => getString(data, config.cursor, areaMaxIdx - i))\n\n if (duration) {\n const transition = areasMerged as Transition<SVGPathElement, AreaDatum[], SVGGElement, AreaDatum[]>\n transition.attrTween('d', (d, i, el) => {\n const previous = select(el[i]).attr('d')\n const next = this._areaGen(d) || this._emptyPath()\n return interpolatePath(previous, next)\n })\n } else {\n areasMerged.attr('d', d => this._areaGen(d) || this._emptyPath())\n }\n\n smartTransition(areas.exit(), duration)\n .style('opacity', 0)\n .remove()\n }\n\n getYDataExtent (scaleByVisibleData: boolean): number[] {\n const { config, datamodel } = this\n const yAccessors = (isArray(config.y) ? config.y : [config.y]) as NumericAccessor<Datum>[]\n\n const data = scaleByVisibleData ? filterDataByRange(datamodel.data, this.xScale.domain() as [number, number], config.x) : datamodel.data\n return getStackedExtent(data, config.baseline, ...yAccessors)\n }\n\n _emptyPath (): string {\n const xRange = this.xScale.range()\n const yDomain = this.yScale.domain() as number[]\n\n const y0 = this.yScale((yDomain[0] + yDomain[1]) / 2)\n const y1 = y0\n\n return this._areaGen([\n { y0, y1, x: xRange[0] },\n { y0, y1, x: xRange[1] },\n ])\n }\n}\n"],"names":["s.area","s"],"mappings":";;;;;;;;;;;;AA0BM,MAAO,IAAY,SAAQ,eAAkD,CAAA;AAYjF,IAAA,WAAA,CAAa,MAAmC,EAAA;AAC9C,QAAA,KAAK,EAAE,CAAA;QAXC,IAAc,CAAA,cAAA,GAAG,iBAA+C,CAAA;AACnE,QAAA,IAAA,CAAA,MAAM,GAA+B,IAAI,CAAC,cAAc,CAAA;QACxD,IAAO,CAAA,OAAA,GAAG,IAAI,CAAA;AAIrB,QAAA,IAAA,CAAA,MAAM,GAAG;AACP,YAAA,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,EAAE;SAC1B,CAAA;AAIC,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;KACnC;AAED,IAAA,OAAO,CAAE,cAAuB,EAAA;AAC9B,QAAA,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;QAC7B,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,CAAA;AAC5C,QAAA,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,GAAG,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAA;QAE5E,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,SAAsB,CAAC,CAAA;AACrD,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,EAAa;aAC9B,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;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AAC,CAA6B,CAAA;AAE1F,QAAA,MAAM,IAAI,GAAG,kBAAkB,GAAG,iBAAiB,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAsB,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,CAAA;QACxI,OAAO,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAA;KAC9D;IAED,UAAU,GAAA;QACR,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAc,CAAA;QAEhD,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;QACrD,MAAM,EAAE,GAAG,EAAE,CAAA;QAEb,OAAO,IAAI,CAAC,QAAQ,CAAC;YACnB,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE;YACxB,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE;AACzB,SAAA,CAAC,CAAA;KACH;;AAzGM,IAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GenericAccessor } from "../../types/accessor";
|
|
1
2
|
import { BulletLegendItemInterface, BulletShape } from './types';
|
|
2
3
|
export interface BulletLegendConfigInterface {
|
|
3
4
|
/** Legend items. Array of `BulletLegendItemInterface`:
|
|
@@ -5,6 +6,7 @@ export interface BulletLegendConfigInterface {
|
|
|
5
6
|
* {
|
|
6
7
|
* name: string | number;
|
|
7
8
|
* color?: string;
|
|
9
|
+
* shape?: BulletShape;
|
|
8
10
|
* inactive?: boolean;
|
|
9
11
|
* hidden?: boolean;
|
|
10
12
|
* pointer?: boolean;
|
|
@@ -22,7 +24,7 @@ export interface BulletLegendConfigInterface {
|
|
|
22
24
|
labelMaxWidth?: string | null;
|
|
23
25
|
/** Bullet shape size, mapped to the width and height CSS properties. Default: `null` */
|
|
24
26
|
bulletSize?: string | null;
|
|
25
|
-
/** Bullet shape
|
|
26
|
-
bulletShape?: BulletShape
|
|
27
|
+
/** Bullet shape enum value or accessor function. Default: `d => d.shape ?? BulletShape.Circle */
|
|
28
|
+
bulletShape?: GenericAccessor<BulletShape, BulletLegendItemInterface>;
|
|
27
29
|
}
|
|
28
30
|
export declare const BulletLegendDefaultConfig: BulletLegendConfigInterface;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BulletShape } from './types.js';
|
|
2
2
|
|
|
3
|
-
// Local Types
|
|
4
3
|
const BulletLegendDefaultConfig = {
|
|
5
4
|
items: [],
|
|
6
5
|
labelClassName: '',
|
|
@@ -8,7 +7,7 @@ const BulletLegendDefaultConfig = {
|
|
|
8
7
|
labelFontSize: null,
|
|
9
8
|
labelMaxWidth: null,
|
|
10
9
|
bulletSize: null,
|
|
11
|
-
bulletShape: BulletShape.Circle,
|
|
10
|
+
bulletShape: d => { var _a; return (_a = d.shape) !== null && _a !== void 0 ? _a : BulletShape.Circle; },
|
|
12
11
|
};
|
|
13
12
|
|
|
14
13
|
export { BulletLegendDefaultConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/bullet-legend/config.ts"],"sourcesContent":["// Local Types\nimport { BulletLegendItemInterface, BulletShape } from './types'\n\nexport interface BulletLegendConfigInterface {\n /** Legend items. Array of `BulletLegendItemInterface`:\n * ```\n * {\n * name: string | number;\n * color?: string;\n * inactive?: boolean;\n * hidden?: boolean;\n * pointer?: boolean;\n * }\n * ```\n * Default: `[]` */\n items: BulletLegendItemInterface[];\n /** Apply a specific class to the labels. Default: `''` */\n labelClassName?: string;\n /** Callback function for the legend item click. Default: `undefined` */\n onLegendItemClick?: ((d: BulletLegendItemInterface, i: number) => void);\n /** Label text (<span> element) font-size CSS. Default: `null` */\n labelFontSize?: string | null;\n /** Label text (<span> element) max-width CSS property. Default: `null` */\n labelMaxWidth?: string | null;\n /** Bullet shape size, mapped to the width and height CSS properties. Default: `null` */\n bulletSize?: string | null;\n /** Bullet shape
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/bullet-legend/config.ts"],"sourcesContent":["// Local Types\nimport { GenericAccessor } from 'types/accessor'\nimport { BulletLegendItemInterface, BulletShape } from './types'\n\nexport interface BulletLegendConfigInterface {\n /** Legend items. Array of `BulletLegendItemInterface`:\n * ```\n * {\n * name: string | number;\n * color?: string;\n * shape?: BulletShape;\n * inactive?: boolean;\n * hidden?: boolean;\n * pointer?: boolean;\n * }\n * ```\n * Default: `[]` */\n items: BulletLegendItemInterface[];\n /** Apply a specific class to the labels. Default: `''` */\n labelClassName?: string;\n /** Callback function for the legend item click. Default: `undefined` */\n onLegendItemClick?: ((d: BulletLegendItemInterface, i: number) => void);\n /** Label text (<span> element) font-size CSS. Default: `null` */\n labelFontSize?: string | null;\n /** Label text (<span> element) max-width CSS property. Default: `null` */\n labelMaxWidth?: string | null;\n /** Bullet shape size, mapped to the width and height CSS properties. Default: `null` */\n bulletSize?: string | null;\n /** Bullet shape enum value or accessor function. Default: `d => d.shape ?? BulletShape.Circle */\n bulletShape?: GenericAccessor<BulletShape, BulletLegendItemInterface>;\n}\n\nexport const BulletLegendDefaultConfig: BulletLegendConfigInterface = {\n items: [],\n labelClassName: '',\n onLegendItemClick: undefined,\n labelFontSize: null,\n labelMaxWidth: null,\n bulletSize: null,\n bulletShape: d => d.shape ?? BulletShape.Circle,\n}\n"],"names":[],"mappings":";;AAgCa,MAAA,yBAAyB,GAAgC;AACpE,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,cAAc,EAAE,EAAE;AAClB,IAAA,iBAAiB,EAAE,SAAS;AAC5B,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,WAAW,EAAE,CAAC,cAAI,OAAA,CAAA,EAAA,GAAA,CAAC,CAAC,KAAK,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,WAAW,CAAC,MAAM,CAAA,EAAA;;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { select } from 'd3-selection';
|
|
2
2
|
import { merge } from '../../utils/data.js';
|
|
3
3
|
import { BulletLegendDefaultConfig } from './config.js';
|
|
4
|
-
import {
|
|
4
|
+
import { updateBullets } from './modules/shape.js';
|
|
5
5
|
import * as style from './style.js';
|
|
6
|
-
import { root, item, bullet, label
|
|
6
|
+
import { root, item, clickable, bullet, label } from './style.js';
|
|
7
7
|
|
|
8
8
|
class BulletLegend {
|
|
9
9
|
constructor(element, config) {
|
|
@@ -26,28 +26,26 @@ class BulletLegend {
|
|
|
26
26
|
}
|
|
27
27
|
render() {
|
|
28
28
|
const { config } = this;
|
|
29
|
-
const legendItems = this.div.selectAll(`.${item}`)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.append('div')
|
|
33
|
-
.attr('class', item)
|
|
29
|
+
const legendItems = this.div.selectAll(`.${item}`).data(config.items);
|
|
30
|
+
const legendItemsEnter = legendItems.enter().append('div')
|
|
31
|
+
.attr('class', d => { var _a; return `${item} ${(_a = d.className) !== null && _a !== void 0 ? _a : ''}`; })
|
|
34
32
|
.on('click', this._onItemClick.bind(this));
|
|
35
|
-
legendItemsEnter.append('span')
|
|
36
|
-
.attr('class', bullet)
|
|
37
|
-
.call(createBullets, config);
|
|
38
|
-
legendItemsEnter.append('span')
|
|
39
|
-
.attr('class', label)
|
|
40
|
-
.classed(config.labelClassName, true)
|
|
41
|
-
.style('max-width', config.labelMaxWidth)
|
|
42
|
-
.style('font-size', config.labelFontSize);
|
|
43
33
|
const legendItemsMerged = legendItemsEnter.merge(legendItems);
|
|
44
34
|
legendItemsMerged
|
|
45
35
|
.classed(clickable, d => !!config.onLegendItemClick && this._isItemClickable(d))
|
|
46
36
|
.style('display', (d) => d.hidden ? 'none' : null);
|
|
37
|
+
// Bullet
|
|
38
|
+
legendItemsEnter.append('svg')
|
|
39
|
+
.attr('class', bullet)
|
|
40
|
+
.append('path');
|
|
47
41
|
legendItemsMerged.select(`.${bullet}`)
|
|
48
|
-
.style('min-width', config.bulletSize)
|
|
49
|
-
.style('height', config.bulletSize)
|
|
50
42
|
.call(updateBullets, this.config, this._colorAccessor);
|
|
43
|
+
// Labels
|
|
44
|
+
legendItemsEnter.append('span')
|
|
45
|
+
.attr('class', label)
|
|
46
|
+
.classed(config.labelClassName, true)
|
|
47
|
+
.style('max-width', config.labelMaxWidth)
|
|
48
|
+
.style('font-size', config.labelFontSize);
|
|
51
49
|
legendItemsMerged.select(`.${label}`)
|
|
52
50
|
.text((d) => d.name);
|
|
53
51
|
legendItems.exit().remove();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/bullet-legend/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\n\n// Utils\nimport { merge } from 'utils/data'\n\n// Config\nimport { BulletLegendDefaultConfig, BulletLegendConfigInterface } from './config'\n\n// Local Types\nimport { BulletLegendItemInterface } from './types'\n\n// Modules\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/bullet-legend/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\n\n// Utils\nimport { merge } from 'utils/data'\n\n// Config\nimport { BulletLegendDefaultConfig, BulletLegendConfigInterface } from './config'\n\n// Local Types\nimport { BulletLegendItemInterface } from './types'\n\n// Modules\nimport { updateBullets } from './modules/shape'\n\n// Styles\nimport * as s from './style'\n\nexport class BulletLegend {\n static selectors = s\n protected _defaultConfig = BulletLegendDefaultConfig as BulletLegendConfigInterface\n public config: BulletLegendConfigInterface = this._defaultConfig\n\n div: Selection<HTMLDivElement, unknown, null, undefined>\n element: HTMLElement\n prevConfig: BulletLegendConfigInterface\n protected _container: HTMLElement\n\n private _colorAccessor = (d: BulletLegendItemInterface): string => d.color\n\n constructor (element: HTMLElement, config?: BulletLegendConfigInterface) {\n this._container = element\n\n // Create SVG element for visualizations\n this.div = select(this._container)\n .append('div')\n .attr('class', s.root)\n\n this.element = this.div.node()\n\n if (config) this.update(config)\n }\n\n update (config: BulletLegendConfigInterface): void {\n this.prevConfig = this.config\n this.config = merge(this._defaultConfig, config)\n this.render()\n }\n\n render (): void {\n const { config } = this\n\n const legendItems = this.div.selectAll<HTMLDivElement, unknown>(`.${s.item}`).data(config.items)\n\n const legendItemsEnter = legendItems.enter().append('div')\n .attr('class', d => `${s.item} ${d.className ?? ''}`)\n .on('click', this._onItemClick.bind(this))\n\n const legendItemsMerged = legendItemsEnter.merge(legendItems)\n legendItemsMerged\n .classed(s.clickable, d => !!config.onLegendItemClick && this._isItemClickable(d))\n .style('display', (d: BulletLegendItemInterface) => d.hidden ? 'none' : null)\n\n // Bullet\n legendItemsEnter.append('svg')\n .attr('class', s.bullet)\n .append('path')\n\n legendItemsMerged.select<SVGElement>(`.${s.bullet}`)\n .call(updateBullets, this.config, this._colorAccessor)\n\n // Labels\n legendItemsEnter.append('span')\n .attr('class', s.label)\n .classed(config.labelClassName, true)\n .style('max-width', config.labelMaxWidth)\n .style('font-size', config.labelFontSize)\n\n legendItemsMerged.select(`.${s.label}`)\n .text((d: BulletLegendItemInterface) => d.name)\n\n legendItems.exit().remove()\n }\n\n _isItemClickable (item: BulletLegendItemInterface): boolean {\n return item.pointer === undefined ? true : item.pointer\n }\n\n _onItemClick (event: MouseEvent, d: BulletLegendItemInterface): void {\n const { config: { onLegendItemClick } } = this\n\n const legendItems = this.div.selectAll(`.${s.item}`).nodes() as HTMLElement[]\n const index = legendItems.indexOf(event.currentTarget as HTMLElement)\n if (onLegendItemClick) onLegendItemClick(d, index)\n }\n\n public destroy (): void {\n this.div.rem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AAC;aACpC,IAAI,CAAC,CAAC,CAA4B,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;AAEjD,QAAA,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAA;KAC5B;AAED,IAAA,gBAAgB,CAAE,IAA+B,EAAA;AAC/C,QAAA,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC,OAAO,CAAA;KACxD;IAED,YAAY,CAAE,KAAiB,EAAE,CAA4B,EAAA;QAC3D,MAAM,EAAE,MAAM,EAAE,EAAE,iBAAiB,EAAE,EAAE,GAAG,IAAI,CAAA;AAE9C,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAI,CAAA,EAAAH,IAAM,CAAA,CAAE,CAAC,CAAC,KAAK,EAAmB,CAAA;QAC7E,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,aAA4B,CAAC,CAAA;AACrE,QAAA,IAAI,iBAAiB;AAAE,YAAA,iBAAiB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;KACnD;IAEM,OAAO,GAAA;AACZ,QAAA,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA;KAClB;;AA/EM,YAAS,CAAA,SAAA,GAAGI,KAAC;;;;"}
|
|
@@ -2,5 +2,4 @@ import { Selection } from 'd3-selection';
|
|
|
2
2
|
import { ColorAccessor } from "../../../types/accessor";
|
|
3
3
|
import { BulletLegendConfigInterface } from '../config';
|
|
4
4
|
import { BulletLegendItemInterface } from '../types';
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function updateBullets(container: Selection<HTMLSpanElement, BulletLegendItemInterface, HTMLDivElement, unknown>, config: BulletLegendConfigInterface, colorAccessor: ColorAccessor<BulletLegendItemInterface>): void;
|
|
5
|
+
export declare function updateBullets(container: Selection<SVGElement, BulletLegendItemInterface, HTMLDivElement, unknown>, config: BulletLegendConfigInterface, colorAccessor: ColorAccessor<BulletLegendItemInterface>): void;
|