@aquera/nile-visualization 0.3.0 → 0.5.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/dist/src/index.d.ts +8 -2
- package/dist/src/index.js +3 -0
- package/dist/src/internal/chart-adapters.js +86 -0
- package/dist/src/internal/highcharts-provider.js +27 -0
- package/dist/src/internal/types/all-chart-config.type.d.ts +2 -4
- package/dist/src/internal/types/chart-config.type.d.ts +3 -2
- package/dist/src/internal/types/chart-donut-config.type.d.ts +2 -0
- package/dist/src/internal/types/chart-heatmap-config.type.d.ts +19 -0
- package/dist/src/internal/types/chart-heatmap-config.type.js +2 -0
- package/dist/src/internal/types/chart-kpi-config.type.d.ts +5 -21
- package/dist/src/internal/types/chart-line-column-config.type.d.ts +14 -0
- package/dist/src/internal/types/chart-line-column-config.type.js +2 -0
- package/dist/src/internal/types/chart-organization-config.type.d.ts +13 -0
- package/dist/src/internal/types/chart-organization-config.type.js +2 -0
- package/dist/src/internal/types/index.d.ts +4 -1
- package/dist/src/internal/types/primitive-chart-config.type.d.ts +5 -1
- package/dist/src/nile-ai-panel/nile-ai-panel.css.js +8 -0
- package/dist/src/nile-ai-panel/nile-ai-panel.d.ts +2 -0
- package/dist/src/nile-ai-panel/nile-ai-panel.js +8 -0
- package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.js +3 -1
- package/dist/src/nile-chart/index.d.ts +2 -2
- package/dist/src/nile-chart/nile-chart-config.d.ts +39 -96
- package/dist/src/nile-chart/nile-chart.css.js +31 -6
- package/dist/src/nile-chart/nile-chart.d.ts +48 -7
- package/dist/src/nile-chart/nile-chart.js +527 -54
- package/dist/src/nile-donut-chart/nile-donut-chart.d.ts +2 -0
- package/dist/src/nile-donut-chart/nile-donut-chart.js +16 -1
- package/dist/src/nile-heatmap-chart/index.d.ts +2 -0
- package/dist/src/nile-heatmap-chart/index.js +2 -0
- package/dist/src/nile-heatmap-chart/nile-heatmap-chart.css.d.ts +1 -0
- package/dist/src/nile-heatmap-chart/nile-heatmap-chart.css.js +28 -0
- package/dist/src/nile-heatmap-chart/nile-heatmap-chart.d.ts +49 -0
- package/dist/src/nile-heatmap-chart/nile-heatmap-chart.js +259 -0
- package/dist/src/nile-histogram-chart/nile-histogram-chart.js +3 -1
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.js +4 -4
- package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +2 -0
- package/dist/src/nile-kpi-chart/nile-kpi-chart.js +6 -0
- package/dist/src/nile-line-column-chart/index.d.ts +2 -0
- package/dist/src/nile-line-column-chart/index.js +2 -0
- package/dist/src/nile-line-column-chart/nile-line-column-chart.css.d.ts +1 -0
- package/dist/src/nile-line-column-chart/nile-line-column-chart.css.js +28 -0
- package/dist/src/nile-line-column-chart/nile-line-column-chart.d.ts +42 -0
- package/dist/src/nile-line-column-chart/nile-line-column-chart.js +205 -0
- package/dist/src/nile-organization-chart/index.d.ts +2 -0
- package/dist/src/nile-organization-chart/index.js +2 -0
- package/dist/src/nile-organization-chart/nile-organization-chart.css.d.ts +1 -0
- package/dist/src/nile-organization-chart/nile-organization-chart.css.js +28 -0
- package/dist/src/nile-organization-chart/nile-organization-chart.d.ts +57 -0
- package/dist/src/nile-organization-chart/nile-organization-chart.js +206 -0
- package/package.json +4 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { html } from 'lit';
|
|
4
|
+
import { getHighcharts } from '../internal/highcharts-provider.js';
|
|
5
|
+
import NileElement from '../internal/nile-element.js';
|
|
6
|
+
import { applySeparatedChartConfig } from '../internal/separated-chart-config.js';
|
|
7
|
+
import { deepMerge } from '../internal/utils.js';
|
|
8
|
+
import { styles } from './nile-line-column-chart.css.js';
|
|
9
|
+
let NileLineColumnChart = class NileLineColumnChart extends NileElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this._hc = null;
|
|
13
|
+
this.chart = null;
|
|
14
|
+
this.resizeObserver = null;
|
|
15
|
+
this.config = null;
|
|
16
|
+
this.chartTitle = '';
|
|
17
|
+
this.chartSubtitle = '';
|
|
18
|
+
this.categories = [];
|
|
19
|
+
this.columnSeries = { name: '', data: [] };
|
|
20
|
+
this.lineSeries = { name: '', data: [] };
|
|
21
|
+
this.columnAxisTitle = '';
|
|
22
|
+
this.lineAxisTitle = '';
|
|
23
|
+
this.options = {};
|
|
24
|
+
this.loading = false;
|
|
25
|
+
this.height = '400px';
|
|
26
|
+
}
|
|
27
|
+
applyConfig(cfg) {
|
|
28
|
+
applySeparatedChartConfig(this, cfg);
|
|
29
|
+
}
|
|
30
|
+
connectedCallback() {
|
|
31
|
+
super.connectedCallback();
|
|
32
|
+
if (this.config)
|
|
33
|
+
this.applyConfig(this.config);
|
|
34
|
+
}
|
|
35
|
+
disconnectedCallback() {
|
|
36
|
+
super.disconnectedCallback();
|
|
37
|
+
this.destroyChart();
|
|
38
|
+
this.resizeObserver?.disconnect();
|
|
39
|
+
this.resizeObserver = null;
|
|
40
|
+
}
|
|
41
|
+
firstUpdated() {
|
|
42
|
+
this.initChart();
|
|
43
|
+
this.setupResizeObserver();
|
|
44
|
+
}
|
|
45
|
+
updated(changedProperties) {
|
|
46
|
+
if (changedProperties.has('config') && this.config) {
|
|
47
|
+
this.applyConfig(this.config);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const props = [
|
|
51
|
+
'categories',
|
|
52
|
+
'columnSeries',
|
|
53
|
+
'lineSeries',
|
|
54
|
+
'chartTitle',
|
|
55
|
+
'chartSubtitle',
|
|
56
|
+
'columnAxisTitle',
|
|
57
|
+
'lineAxisTitle',
|
|
58
|
+
'options',
|
|
59
|
+
'height',
|
|
60
|
+
'loading',
|
|
61
|
+
];
|
|
62
|
+
if (!props.some(p => changedProperties.has(p)))
|
|
63
|
+
return;
|
|
64
|
+
if (this.loading) {
|
|
65
|
+
this.destroyChart();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (this.chart) {
|
|
69
|
+
this.chart.update(this.buildOptions(), true, true);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this.initChart();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
setupResizeObserver() {
|
|
76
|
+
if (!this.chartContainer)
|
|
77
|
+
return;
|
|
78
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
79
|
+
this.chart?.reflow();
|
|
80
|
+
});
|
|
81
|
+
this.resizeObserver.observe(this.chartContainer);
|
|
82
|
+
}
|
|
83
|
+
buildOptions() {
|
|
84
|
+
const self = this;
|
|
85
|
+
const col = this.columnSeries;
|
|
86
|
+
const line = this.lineSeries;
|
|
87
|
+
return deepMerge({
|
|
88
|
+
chart: { height: this.height },
|
|
89
|
+
title: { text: this.chartTitle || undefined },
|
|
90
|
+
subtitle: { text: this.chartSubtitle || undefined },
|
|
91
|
+
xAxis: { categories: this.categories, crosshair: true },
|
|
92
|
+
yAxis: [
|
|
93
|
+
{
|
|
94
|
+
title: { text: this.columnAxisTitle || undefined },
|
|
95
|
+
labels: { style: { color: '#64748b' } },
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
title: { text: this.lineAxisTitle || undefined },
|
|
99
|
+
opposite: true,
|
|
100
|
+
labels: { style: { color: '#64748b' } },
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
tooltip: { shared: true },
|
|
104
|
+
legend: { enabled: true },
|
|
105
|
+
plotOptions: {
|
|
106
|
+
column: { borderRadius: 2 },
|
|
107
|
+
series: {
|
|
108
|
+
cursor: 'pointer',
|
|
109
|
+
point: {
|
|
110
|
+
events: {
|
|
111
|
+
click() {
|
|
112
|
+
self.emit('nile-chart-click', {
|
|
113
|
+
point: this,
|
|
114
|
+
category: this.category,
|
|
115
|
+
value: this.y,
|
|
116
|
+
seriesName: this.series.name,
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
series: [
|
|
124
|
+
{
|
|
125
|
+
type: 'column',
|
|
126
|
+
name: col.name,
|
|
127
|
+
data: col.data,
|
|
128
|
+
color: col.color,
|
|
129
|
+
yAxis: 0,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
type: 'line',
|
|
133
|
+
name: line.name,
|
|
134
|
+
data: line.data,
|
|
135
|
+
color: line.color,
|
|
136
|
+
yAxis: 1,
|
|
137
|
+
marker: { enabled: true, radius: 4 },
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
credits: { enabled: false },
|
|
141
|
+
}, this.options);
|
|
142
|
+
}
|
|
143
|
+
async initChart() {
|
|
144
|
+
if (this.loading || !this.chartContainer)
|
|
145
|
+
return;
|
|
146
|
+
if (!this._hc)
|
|
147
|
+
this._hc = await getHighcharts();
|
|
148
|
+
this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
|
|
149
|
+
this.emit('nile-chart-ready', { chart: this.chart });
|
|
150
|
+
}
|
|
151
|
+
destroyChart() {
|
|
152
|
+
if (this.chart) {
|
|
153
|
+
this.chart.destroy();
|
|
154
|
+
this.chart = null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
render() {
|
|
158
|
+
if (this.loading) {
|
|
159
|
+
return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
|
|
160
|
+
}
|
|
161
|
+
return html `<div class="chart-container"></div>`;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
NileLineColumnChart.styles = styles;
|
|
165
|
+
__decorate([
|
|
166
|
+
query('.chart-container')
|
|
167
|
+
], NileLineColumnChart.prototype, "chartContainer", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
property({ type: Object })
|
|
170
|
+
], NileLineColumnChart.prototype, "config", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
property({ type: String, attribute: 'chart-title' })
|
|
173
|
+
], NileLineColumnChart.prototype, "chartTitle", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
property({ type: String, attribute: 'chart-subtitle' })
|
|
176
|
+
], NileLineColumnChart.prototype, "chartSubtitle", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
property({ type: Array })
|
|
179
|
+
], NileLineColumnChart.prototype, "categories", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
property({ type: Object })
|
|
182
|
+
], NileLineColumnChart.prototype, "columnSeries", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
property({ type: Object })
|
|
185
|
+
], NileLineColumnChart.prototype, "lineSeries", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
property({ type: String, attribute: 'column-axis-title' })
|
|
188
|
+
], NileLineColumnChart.prototype, "columnAxisTitle", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
property({ type: String, attribute: 'line-axis-title' })
|
|
191
|
+
], NileLineColumnChart.prototype, "lineAxisTitle", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
property({ type: Object })
|
|
194
|
+
], NileLineColumnChart.prototype, "options", void 0);
|
|
195
|
+
__decorate([
|
|
196
|
+
property({ type: Boolean, reflect: true })
|
|
197
|
+
], NileLineColumnChart.prototype, "loading", void 0);
|
|
198
|
+
__decorate([
|
|
199
|
+
property({ type: String })
|
|
200
|
+
], NileLineColumnChart.prototype, "height", void 0);
|
|
201
|
+
NileLineColumnChart = __decorate([
|
|
202
|
+
customElement('nile-line-column-chart')
|
|
203
|
+
], NileLineColumnChart);
|
|
204
|
+
export { NileLineColumnChart };
|
|
205
|
+
//# sourceMappingURL=nile-line-column-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:host([hidden]) {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.chart-container {
|
|
14
|
+
width: 100%;
|
|
15
|
+
min-height: var(--nile-height-200px, var(--ng-height-200px));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.chart-loading {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
min-height: inherit;
|
|
23
|
+
color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
24
|
+
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
25
|
+
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
//# sourceMappingURL=nile-organization-chart.css.js.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
2
|
+
import type Highcharts from 'highcharts';
|
|
3
|
+
import NileElement from '../internal/nile-element.js';
|
|
4
|
+
import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
|
|
5
|
+
/** Directed edge: reporting line from `from` to `to` (node ids). */
|
|
6
|
+
export interface OrgChartLink {
|
|
7
|
+
from: string;
|
|
8
|
+
to: string;
|
|
9
|
+
}
|
|
10
|
+
/** Node card in the org chart (`id` must match link endpoints). */
|
|
11
|
+
export interface OrgChartNode {
|
|
12
|
+
id: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
image?: string;
|
|
17
|
+
color?: string;
|
|
18
|
+
/** When set, children hang under this node (Highcharts layout). */
|
|
19
|
+
layout?: 'hanging';
|
|
20
|
+
}
|
|
21
|
+
export declare class NileOrganizationChart extends NileElement {
|
|
22
|
+
static styles: CSSResultGroup;
|
|
23
|
+
private _hc;
|
|
24
|
+
private chart;
|
|
25
|
+
private resizeObserver;
|
|
26
|
+
private chartContainer;
|
|
27
|
+
/** Full chart configuration. Accepts separated `{ chart, aq }` input. */
|
|
28
|
+
config: SeparatedChartConfigInputType | null;
|
|
29
|
+
chartTitle: string;
|
|
30
|
+
chartSubtitle: string;
|
|
31
|
+
nodes: OrgChartNode[];
|
|
32
|
+
links: OrgChartLink[];
|
|
33
|
+
options: Highcharts.Options;
|
|
34
|
+
loading: boolean;
|
|
35
|
+
height: string;
|
|
36
|
+
seriesName: string;
|
|
37
|
+
/**
|
|
38
|
+
* When true (default), the chart flows top-down — typical for org charts in Highcharts.
|
|
39
|
+
* Set false for a horizontal layout.
|
|
40
|
+
*/
|
|
41
|
+
inverted: boolean;
|
|
42
|
+
private applyConfig;
|
|
43
|
+
connectedCallback(): void;
|
|
44
|
+
disconnectedCallback(): void;
|
|
45
|
+
protected firstUpdated(): void;
|
|
46
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
47
|
+
private setupResizeObserver;
|
|
48
|
+
private buildOptions;
|
|
49
|
+
private initChart;
|
|
50
|
+
private destroyChart;
|
|
51
|
+
render(): TemplateResult;
|
|
52
|
+
}
|
|
53
|
+
declare global {
|
|
54
|
+
interface HTMLElementTagNameMap {
|
|
55
|
+
'nile-organization-chart': NileOrganizationChart;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { html } from 'lit';
|
|
4
|
+
import { getHighcharts } from '../internal/highcharts-provider.js';
|
|
5
|
+
import NileElement from '../internal/nile-element.js';
|
|
6
|
+
import { applySeparatedChartConfig } from '../internal/separated-chart-config.js';
|
|
7
|
+
import { deepMerge } from '../internal/utils.js';
|
|
8
|
+
import { styles } from './nile-organization-chart.css.js';
|
|
9
|
+
let NileOrganizationChart = class NileOrganizationChart extends NileElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this._hc = null;
|
|
13
|
+
this.chart = null;
|
|
14
|
+
this.resizeObserver = null;
|
|
15
|
+
/** Full chart configuration. Accepts separated `{ chart, aq }` input. */
|
|
16
|
+
this.config = null;
|
|
17
|
+
this.chartTitle = '';
|
|
18
|
+
this.chartSubtitle = '';
|
|
19
|
+
this.nodes = [];
|
|
20
|
+
this.links = [];
|
|
21
|
+
this.options = {};
|
|
22
|
+
this.loading = false;
|
|
23
|
+
this.height = '480px';
|
|
24
|
+
this.seriesName = '';
|
|
25
|
+
/**
|
|
26
|
+
* When true (default), the chart flows top-down — typical for org charts in Highcharts.
|
|
27
|
+
* Set false for a horizontal layout.
|
|
28
|
+
*/
|
|
29
|
+
this.inverted = true;
|
|
30
|
+
}
|
|
31
|
+
applyConfig(cfg) {
|
|
32
|
+
applySeparatedChartConfig(this, cfg);
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
super.connectedCallback();
|
|
36
|
+
if (this.config)
|
|
37
|
+
this.applyConfig(this.config);
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
super.disconnectedCallback();
|
|
41
|
+
this.destroyChart();
|
|
42
|
+
this.resizeObserver?.disconnect();
|
|
43
|
+
this.resizeObserver = null;
|
|
44
|
+
}
|
|
45
|
+
firstUpdated() {
|
|
46
|
+
this.initChart();
|
|
47
|
+
this.setupResizeObserver();
|
|
48
|
+
}
|
|
49
|
+
updated(changedProperties) {
|
|
50
|
+
if (changedProperties.has('config') && this.config) {
|
|
51
|
+
this.applyConfig(this.config);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const props = [
|
|
55
|
+
'nodes',
|
|
56
|
+
'links',
|
|
57
|
+
'chartTitle',
|
|
58
|
+
'chartSubtitle',
|
|
59
|
+
'options',
|
|
60
|
+
'height',
|
|
61
|
+
'seriesName',
|
|
62
|
+
'inverted',
|
|
63
|
+
'loading',
|
|
64
|
+
];
|
|
65
|
+
if (!props.some(p => changedProperties.has(p)))
|
|
66
|
+
return;
|
|
67
|
+
if (this.loading) {
|
|
68
|
+
this.destroyChart();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (this.chart) {
|
|
72
|
+
this.chart.update(this.buildOptions(), true, true);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this.initChart();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
setupResizeObserver() {
|
|
79
|
+
if (!this.chartContainer)
|
|
80
|
+
return;
|
|
81
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
82
|
+
this.chart?.reflow();
|
|
83
|
+
});
|
|
84
|
+
this.resizeObserver.observe(this.chartContainer);
|
|
85
|
+
}
|
|
86
|
+
buildOptions() {
|
|
87
|
+
const self = this;
|
|
88
|
+
const data = this.links.map(l => [l.from, l.to]);
|
|
89
|
+
const nodeOpts = this.nodes.map(n => {
|
|
90
|
+
const { id, title, name, description, image, color, layout } = n;
|
|
91
|
+
return {
|
|
92
|
+
id,
|
|
93
|
+
title,
|
|
94
|
+
name,
|
|
95
|
+
description,
|
|
96
|
+
image,
|
|
97
|
+
color,
|
|
98
|
+
...(layout ? { layout } : {}),
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
return deepMerge({
|
|
102
|
+
chart: {
|
|
103
|
+
height: this.height,
|
|
104
|
+
inverted: this.inverted,
|
|
105
|
+
},
|
|
106
|
+
title: { text: this.chartTitle || undefined },
|
|
107
|
+
subtitle: { text: this.chartSubtitle || undefined },
|
|
108
|
+
tooltip: {
|
|
109
|
+
outside: true,
|
|
110
|
+
},
|
|
111
|
+
plotOptions: {
|
|
112
|
+
organization: {
|
|
113
|
+
dataLabels: {
|
|
114
|
+
color: '#1e293b',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
series: {
|
|
118
|
+
cursor: 'pointer',
|
|
119
|
+
point: {
|
|
120
|
+
events: {
|
|
121
|
+
click() {
|
|
122
|
+
const fromN = this.fromNode;
|
|
123
|
+
const toN = this.toNode;
|
|
124
|
+
self.emit('nile-chart-click', {
|
|
125
|
+
point: this,
|
|
126
|
+
fromId: fromN?.id,
|
|
127
|
+
toId: toN?.id,
|
|
128
|
+
seriesName: this.series.name,
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
series: [
|
|
136
|
+
{
|
|
137
|
+
type: 'organization',
|
|
138
|
+
name: this.seriesName || this.chartTitle || 'Organization',
|
|
139
|
+
keys: ['from', 'to'],
|
|
140
|
+
data,
|
|
141
|
+
nodes: nodeOpts,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
credits: { enabled: false },
|
|
145
|
+
}, this.options);
|
|
146
|
+
}
|
|
147
|
+
async initChart() {
|
|
148
|
+
if (this.loading || !this.chartContainer)
|
|
149
|
+
return;
|
|
150
|
+
if (!this._hc)
|
|
151
|
+
this._hc = await getHighcharts();
|
|
152
|
+
this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
|
|
153
|
+
this.emit('nile-chart-ready', { chart: this.chart });
|
|
154
|
+
}
|
|
155
|
+
destroyChart() {
|
|
156
|
+
if (this.chart) {
|
|
157
|
+
this.chart.destroy();
|
|
158
|
+
this.chart = null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
render() {
|
|
162
|
+
if (this.loading) {
|
|
163
|
+
return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
|
|
164
|
+
}
|
|
165
|
+
return html `<div class="chart-container"></div>`;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
NileOrganizationChart.styles = styles;
|
|
169
|
+
__decorate([
|
|
170
|
+
query('.chart-container')
|
|
171
|
+
], NileOrganizationChart.prototype, "chartContainer", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
property({ type: Object })
|
|
174
|
+
], NileOrganizationChart.prototype, "config", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
property({ type: String, attribute: 'chart-title' })
|
|
177
|
+
], NileOrganizationChart.prototype, "chartTitle", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
property({ type: String, attribute: 'chart-subtitle' })
|
|
180
|
+
], NileOrganizationChart.prototype, "chartSubtitle", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
property({ type: Array })
|
|
183
|
+
], NileOrganizationChart.prototype, "nodes", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
property({ type: Array })
|
|
186
|
+
], NileOrganizationChart.prototype, "links", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
property({ type: Object })
|
|
189
|
+
], NileOrganizationChart.prototype, "options", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
property({ type: Boolean, reflect: true })
|
|
192
|
+
], NileOrganizationChart.prototype, "loading", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
property({ type: String })
|
|
195
|
+
], NileOrganizationChart.prototype, "height", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
property({ type: String, attribute: 'series-name' })
|
|
198
|
+
], NileOrganizationChart.prototype, "seriesName", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
property({ type: Boolean, attribute: 'inverted' })
|
|
201
|
+
], NileOrganizationChart.prototype, "inverted", void 0);
|
|
202
|
+
NileOrganizationChart = __decorate([
|
|
203
|
+
customElement('nile-organization-chart')
|
|
204
|
+
], NileOrganizationChart);
|
|
205
|
+
export { NileOrganizationChart };
|
|
206
|
+
//# sourceMappingURL=nile-organization-chart.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aquera/nile-visualization",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A visualization Library for the Nile Design System",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Aquera Inc",
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
"./nile-gauge-chart": "./dist/src/nile-gauge-chart/index.js",
|
|
31
31
|
"./nile-waterfall-chart": "./dist/src/nile-waterfall-chart/index.js",
|
|
32
32
|
"./nile-funnel-chart": "./dist/src/nile-funnel-chart/index.js",
|
|
33
|
+
"./nile-organization-chart": "./dist/src/nile-organization-chart/index.js",
|
|
34
|
+
"./nile-line-column-chart": "./dist/src/nile-line-column-chart/index.js",
|
|
35
|
+
"./nile-heatmap-chart": "./dist/src/nile-heatmap-chart/index.js",
|
|
33
36
|
"./nile-flame-chart": "./dist/src/nile-flame-chart/index.js",
|
|
34
37
|
"./nile-spiderweb-chart": "./dist/src/nile-spiderweb-chart/index.js",
|
|
35
38
|
"./nile-trendline-chart": "./dist/src/nile-trendline-chart/index.js",
|