@aquera/nile-visualization 0.2.0 → 0.4.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 +37 -1
- package/dist/src/index.js +19 -0
- package/dist/src/internal/chart-adapters.js +86 -0
- package/dist/src/internal/highcharts-provider.js +72 -0
- package/dist/src/internal/types/all-chart-config.type.d.ts +2 -4
- package/dist/src/internal/types/chart-area-config.type.d.ts +4 -0
- package/dist/src/internal/types/chart-area-negative-config.type.d.ts +13 -0
- package/dist/src/internal/types/chart-area-negative-config.type.js +2 -0
- package/dist/src/internal/types/chart-area-range-config.type.d.ts +12 -0
- package/dist/src/internal/types/chart-area-range-config.type.js +2 -0
- package/dist/src/internal/types/chart-area-spline-config.type.d.ts +13 -0
- package/dist/src/internal/types/chart-area-spline-config.type.js +2 -0
- package/dist/src/internal/types/chart-column-drilldown-config.type.d.ts +13 -0
- package/dist/src/internal/types/chart-column-drilldown-config.type.js +2 -0
- package/dist/src/internal/types/chart-column-pyramid-config.type.d.ts +11 -0
- package/dist/src/internal/types/chart-column-pyramid-config.type.js +2 -0
- package/dist/src/internal/types/chart-column-range-config.type.d.ts +12 -0
- package/dist/src/internal/types/chart-column-range-config.type.js +2 -0
- 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-dumbbell-lower-config.type.d.ts +5 -0
- package/dist/src/internal/types/chart-dumbbell-lower-config.type.js +2 -0
- package/dist/src/internal/types/chart-dumbbell-upper-config.type.d.ts +5 -0
- package/dist/src/internal/types/chart-dumbbell-upper-config.type.js +2 -0
- package/dist/src/internal/types/chart-euler-config.type.d.ts +10 -0
- package/dist/src/internal/types/chart-euler-config.type.js +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-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-lollipop-config.type.d.ts +11 -0
- package/dist/src/internal/types/chart-lollipop-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/chart-polygon-config.type.d.ts +12 -0
- package/dist/src/internal/types/chart-polygon-config.type.js +2 -0
- package/dist/src/internal/types/chart-radial-bar-config.type.d.ts +16 -0
- package/dist/src/internal/types/chart-radial-bar-config.type.js +2 -0
- package/dist/src/internal/types/chart-variable-pie-config.type.d.ts +13 -0
- package/dist/src/internal/types/chart-variable-pie-config.type.js +2 -0
- package/dist/src/internal/types/chart-vector-config.type.d.ts +13 -0
- package/dist/src/internal/types/chart-vector-config.type.js +2 -0
- package/dist/src/internal/types/chart-xrange-config.type.d.ts +13 -0
- package/dist/src/internal/types/chart-xrange-config.type.js +2 -0
- package/dist/src/internal/types/index.d.ts +19 -1
- package/dist/src/internal/types/primitive-chart-config.type.d.ts +20 -1
- package/dist/src/nile-area-negative-chart/index.d.ts +2 -0
- package/dist/src/nile-area-negative-chart/index.js +2 -0
- package/dist/src/nile-area-negative-chart/nile-area-negative-chart.css.d.ts +1 -0
- package/dist/src/nile-area-negative-chart/nile-area-negative-chart.css.js +28 -0
- package/dist/src/nile-area-negative-chart/nile-area-negative-chart.d.ts +42 -0
- package/dist/src/nile-area-negative-chart/nile-area-negative-chart.js +178 -0
- package/dist/src/nile-area-range-chart/index.d.ts +2 -0
- package/dist/src/nile-area-range-chart/index.js +2 -0
- package/dist/src/nile-area-range-chart/nile-area-range-chart.css.d.ts +1 -0
- package/dist/src/nile-area-range-chart/nile-area-range-chart.css.js +28 -0
- package/dist/src/nile-area-range-chart/nile-area-range-chart.d.ts +41 -0
- package/dist/src/nile-area-range-chart/nile-area-range-chart.js +173 -0
- package/dist/src/nile-area-spline-chart/index.d.ts +2 -0
- package/dist/src/nile-area-spline-chart/index.js +2 -0
- package/dist/src/nile-area-spline-chart/nile-area-spline-chart.css.d.ts +1 -0
- package/dist/src/nile-area-spline-chart/nile-area-spline-chart.css.js +28 -0
- package/dist/src/nile-area-spline-chart/nile-area-spline-chart.d.ts +41 -0
- package/dist/src/nile-area-spline-chart/nile-area-spline-chart.js +174 -0
- package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.js +3 -1
- package/dist/src/nile-chart/index.d.ts +1 -1
- package/dist/src/nile-chart/nile-chart-config.d.ts +36 -96
- package/dist/src/nile-chart/nile-chart.css.js +1 -1
- package/dist/src/nile-chart/nile-chart.d.ts +36 -0
- package/dist/src/nile-chart/nile-chart.js +412 -5
- package/dist/src/nile-column-drilldown-chart/index.d.ts +2 -0
- package/dist/src/nile-column-drilldown-chart/index.js +2 -0
- package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.css.d.ts +1 -0
- package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.css.js +28 -0
- package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.d.ts +49 -0
- package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.js +186 -0
- package/dist/src/nile-column-pyramid-chart/index.d.ts +2 -0
- package/dist/src/nile-column-pyramid-chart/index.js +2 -0
- package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.css.d.ts +1 -0
- package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.css.js +28 -0
- package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.d.ts +39 -0
- package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.js +155 -0
- package/dist/src/nile-column-range-chart/index.d.ts +2 -0
- package/dist/src/nile-column-range-chart/index.js +2 -0
- package/dist/src/nile-column-range-chart/nile-column-range-chart.css.d.ts +1 -0
- package/dist/src/nile-column-range-chart/nile-column-range-chart.css.js +28 -0
- package/dist/src/nile-column-range-chart/nile-column-range-chart.d.ts +40 -0
- package/dist/src/nile-column-range-chart/nile-column-range-chart.js +169 -0
- 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-dumbbell-lower-chart/index.d.ts +1 -0
- package/dist/src/nile-dumbbell-lower-chart/index.js +2 -0
- package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.css.d.ts +1 -0
- package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.css.js +28 -0
- package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.d.ts +40 -0
- package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.js +214 -0
- package/dist/src/nile-dumbbell-upper-chart/index.d.ts +1 -0
- package/dist/src/nile-dumbbell-upper-chart/index.js +2 -0
- package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.css.d.ts +1 -0
- package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.css.js +28 -0
- package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.d.ts +40 -0
- package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.js +214 -0
- package/dist/src/nile-euler-chart/index.d.ts +2 -0
- package/dist/src/nile-euler-chart/index.js +2 -0
- package/dist/src/nile-euler-chart/nile-euler-chart.css.d.ts +1 -0
- package/dist/src/nile-euler-chart/nile-euler-chart.css.js +28 -0
- package/dist/src/nile-euler-chart/nile-euler-chart.d.ts +38 -0
- package/dist/src/nile-euler-chart/nile-euler-chart.js +149 -0
- 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-inverted-area-chart/index.d.ts +2 -0
- package/dist/src/nile-inverted-area-chart/index.js +2 -0
- package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.css.d.ts +1 -0
- package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.css.js +28 -0
- package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.d.ts +40 -0
- package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.js +173 -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-lollipop-chart/index.d.ts +2 -0
- package/dist/src/nile-lollipop-chart/index.js +2 -0
- package/dist/src/nile-lollipop-chart/nile-lollipop-chart.css.d.ts +1 -0
- package/dist/src/nile-lollipop-chart/nile-lollipop-chart.css.js +28 -0
- package/dist/src/nile-lollipop-chart/nile-lollipop-chart.d.ts +39 -0
- package/dist/src/nile-lollipop-chart/nile-lollipop-chart.js +174 -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/dist/src/nile-polygon-chart/index.d.ts +2 -0
- package/dist/src/nile-polygon-chart/index.js +2 -0
- package/dist/src/nile-polygon-chart/nile-polygon-chart.css.d.ts +1 -0
- package/dist/src/nile-polygon-chart/nile-polygon-chart.css.js +28 -0
- package/dist/src/nile-polygon-chart/nile-polygon-chart.d.ts +41 -0
- package/dist/src/nile-polygon-chart/nile-polygon-chart.js +167 -0
- package/dist/src/nile-radial-bar-chart/index.d.ts +2 -0
- package/dist/src/nile-radial-bar-chart/index.js +2 -0
- package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.css.d.ts +1 -0
- package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.css.js +28 -0
- package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.d.ts +42 -0
- package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.js +191 -0
- package/dist/src/nile-variable-pie-chart/index.d.ts +2 -0
- package/dist/src/nile-variable-pie-chart/index.js +2 -0
- package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.css.d.ts +1 -0
- package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.css.js +28 -0
- package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.d.ts +42 -0
- package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.js +180 -0
- package/dist/src/nile-vector-chart/index.d.ts +2 -0
- package/dist/src/nile-vector-chart/index.js +2 -0
- package/dist/src/nile-vector-chart/nile-vector-chart.css.d.ts +1 -0
- package/dist/src/nile-vector-chart/nile-vector-chart.css.js +28 -0
- package/dist/src/nile-vector-chart/nile-vector-chart.d.ts +44 -0
- package/dist/src/nile-vector-chart/nile-vector-chart.js +181 -0
- package/dist/src/nile-xrange-chart/index.d.ts +2 -0
- package/dist/src/nile-xrange-chart/index.js +2 -0
- package/dist/src/nile-xrange-chart/nile-xrange-chart.css.d.ts +1 -0
- package/dist/src/nile-xrange-chart/nile-xrange-chart.css.js +28 -0
- package/dist/src/nile-xrange-chart/nile-xrange-chart.d.ts +44 -0
- package/dist/src/nile-xrange-chart/nile-xrange-chart.js +193 -0
- package/package.json +4 -1
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
export interface EulerVennDataPoint {
|
|
6
|
+
sets: string[];
|
|
7
|
+
value: number;
|
|
8
|
+
name?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class NileEulerChart extends NileElement {
|
|
11
|
+
static styles: CSSResultGroup;
|
|
12
|
+
private _hc;
|
|
13
|
+
private chart;
|
|
14
|
+
private resizeObserver;
|
|
15
|
+
private chartContainer;
|
|
16
|
+
config: SeparatedChartConfigInputType | null;
|
|
17
|
+
chartTitle: string;
|
|
18
|
+
chartSubtitle: string;
|
|
19
|
+
data: EulerVennDataPoint[];
|
|
20
|
+
options: Highcharts.Options;
|
|
21
|
+
loading: boolean;
|
|
22
|
+
height: string;
|
|
23
|
+
private applyConfig;
|
|
24
|
+
connectedCallback(): void;
|
|
25
|
+
disconnectedCallback(): void;
|
|
26
|
+
protected firstUpdated(): void;
|
|
27
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
28
|
+
private setupResizeObserver;
|
|
29
|
+
private buildOptions;
|
|
30
|
+
private initChart;
|
|
31
|
+
private destroyChart;
|
|
32
|
+
render(): TemplateResult;
|
|
33
|
+
}
|
|
34
|
+
declare global {
|
|
35
|
+
interface HTMLElementTagNameMap {
|
|
36
|
+
'nile-euler-chart': NileEulerChart;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { html } from 'lit';
|
|
4
|
+
import NileElement from '../internal/nile-element.js';
|
|
5
|
+
import { applySeparatedChartConfig } from '../internal/separated-chart-config.js';
|
|
6
|
+
import { getHighcharts } from '../internal/highcharts-provider.js';
|
|
7
|
+
import { deepMerge } from '../internal/utils.js';
|
|
8
|
+
import { styles } from './nile-euler-chart.css.js';
|
|
9
|
+
let NileEulerChart = class NileEulerChart 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.data = [];
|
|
19
|
+
this.options = {};
|
|
20
|
+
this.loading = false;
|
|
21
|
+
this.height = '400px';
|
|
22
|
+
}
|
|
23
|
+
applyConfig(cfg) {
|
|
24
|
+
applySeparatedChartConfig(this, cfg);
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
super.connectedCallback();
|
|
28
|
+
if (this.config)
|
|
29
|
+
this.applyConfig(this.config);
|
|
30
|
+
}
|
|
31
|
+
disconnectedCallback() {
|
|
32
|
+
super.disconnectedCallback();
|
|
33
|
+
this.destroyChart();
|
|
34
|
+
this.resizeObserver?.disconnect();
|
|
35
|
+
this.resizeObserver = null;
|
|
36
|
+
}
|
|
37
|
+
firstUpdated() {
|
|
38
|
+
this.initChart();
|
|
39
|
+
this.setupResizeObserver();
|
|
40
|
+
}
|
|
41
|
+
updated(changedProperties) {
|
|
42
|
+
if (changedProperties.has('config') && this.config) {
|
|
43
|
+
this.applyConfig(this.config);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const props = ['data', 'chartTitle', 'chartSubtitle', 'options', 'height', 'loading'];
|
|
47
|
+
if (!props.some(p => changedProperties.has(p)))
|
|
48
|
+
return;
|
|
49
|
+
if (this.loading) {
|
|
50
|
+
this.destroyChart();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (this.chart) {
|
|
54
|
+
this.chart.update(this.buildOptions(), true, true);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.initChart();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
setupResizeObserver() {
|
|
61
|
+
if (!this.chartContainer)
|
|
62
|
+
return;
|
|
63
|
+
this.resizeObserver = new ResizeObserver(() => this.chart?.reflow());
|
|
64
|
+
this.resizeObserver.observe(this.chartContainer);
|
|
65
|
+
}
|
|
66
|
+
buildOptions() {
|
|
67
|
+
const self = this;
|
|
68
|
+
return deepMerge({
|
|
69
|
+
chart: { height: this.height },
|
|
70
|
+
title: { text: this.chartTitle || undefined },
|
|
71
|
+
subtitle: { text: this.chartSubtitle || undefined },
|
|
72
|
+
tooltip: { headerFormat: '', pointFormat: '{point.name}: <b>{point.value}</b>' },
|
|
73
|
+
plotOptions: {
|
|
74
|
+
venn: {
|
|
75
|
+
cursor: 'pointer',
|
|
76
|
+
point: {
|
|
77
|
+
events: {
|
|
78
|
+
click() {
|
|
79
|
+
self.emit('nile-chart-click', {
|
|
80
|
+
point: this,
|
|
81
|
+
value: this.value,
|
|
82
|
+
seriesName: this.series.name,
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
series: [
|
|
90
|
+
{
|
|
91
|
+
type: 'venn',
|
|
92
|
+
name: 'Sets',
|
|
93
|
+
data: this.data,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
credits: { enabled: false },
|
|
97
|
+
}, this.options);
|
|
98
|
+
}
|
|
99
|
+
async initChart() {
|
|
100
|
+
if (this.loading || !this.chartContainer)
|
|
101
|
+
return;
|
|
102
|
+
if (!this._hc)
|
|
103
|
+
this._hc = await getHighcharts();
|
|
104
|
+
this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
|
|
105
|
+
this.emit('nile-chart-ready', { chart: this.chart });
|
|
106
|
+
}
|
|
107
|
+
destroyChart() {
|
|
108
|
+
if (this.chart) {
|
|
109
|
+
this.chart.destroy();
|
|
110
|
+
this.chart = null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
render() {
|
|
114
|
+
if (this.loading) {
|
|
115
|
+
return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
|
|
116
|
+
}
|
|
117
|
+
return html `<div class="chart-container"></div>`;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
NileEulerChart.styles = styles;
|
|
121
|
+
__decorate([
|
|
122
|
+
query('.chart-container')
|
|
123
|
+
], NileEulerChart.prototype, "chartContainer", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
property({ type: Object })
|
|
126
|
+
], NileEulerChart.prototype, "config", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
property({ type: String, attribute: 'chart-title' })
|
|
129
|
+
], NileEulerChart.prototype, "chartTitle", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
property({ type: String, attribute: 'chart-subtitle' })
|
|
132
|
+
], NileEulerChart.prototype, "chartSubtitle", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
property({ type: Array })
|
|
135
|
+
], NileEulerChart.prototype, "data", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ type: Object })
|
|
138
|
+
], NileEulerChart.prototype, "options", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
property({ type: Boolean, reflect: true })
|
|
141
|
+
], NileEulerChart.prototype, "loading", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
property({ type: String })
|
|
144
|
+
], NileEulerChart.prototype, "height", void 0);
|
|
145
|
+
NileEulerChart = __decorate([
|
|
146
|
+
customElement('nile-euler-chart')
|
|
147
|
+
], NileEulerChart);
|
|
148
|
+
export { NileEulerChart };
|
|
149
|
+
//# sourceMappingURL=nile-euler-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-heatmap-chart.css.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
/** One cell: x/y are 0-based indices into `xCategories` / `yCategories`. */
|
|
6
|
+
export interface HeatmapCell {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
value: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class NileHeatmapChart extends NileElement {
|
|
12
|
+
static styles: CSSResultGroup;
|
|
13
|
+
private _hc;
|
|
14
|
+
private chart;
|
|
15
|
+
private resizeObserver;
|
|
16
|
+
private chartContainer;
|
|
17
|
+
config: SeparatedChartConfigInputType | null;
|
|
18
|
+
chartTitle: string;
|
|
19
|
+
chartSubtitle: string;
|
|
20
|
+
xCategories: string[];
|
|
21
|
+
yCategories: string[];
|
|
22
|
+
data: HeatmapCell[];
|
|
23
|
+
seriesName: string;
|
|
24
|
+
colorMin: number | null;
|
|
25
|
+
colorMax: number | null;
|
|
26
|
+
minColor: string;
|
|
27
|
+
maxColor: string;
|
|
28
|
+
colorAxisTitle: string;
|
|
29
|
+
options: Highcharts.Options;
|
|
30
|
+
loading: boolean;
|
|
31
|
+
height: string;
|
|
32
|
+
showDataLabels: boolean;
|
|
33
|
+
private applyConfig;
|
|
34
|
+
connectedCallback(): void;
|
|
35
|
+
disconnectedCallback(): void;
|
|
36
|
+
protected firstUpdated(): void;
|
|
37
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
38
|
+
private setupResizeObserver;
|
|
39
|
+
private valueExtent;
|
|
40
|
+
private buildOptions;
|
|
41
|
+
private initChart;
|
|
42
|
+
private destroyChart;
|
|
43
|
+
render(): TemplateResult;
|
|
44
|
+
}
|
|
45
|
+
declare global {
|
|
46
|
+
interface HTMLElementTagNameMap {
|
|
47
|
+
'nile-heatmap-chart': NileHeatmapChart;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
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-heatmap-chart.css.js';
|
|
9
|
+
let NileHeatmapChart = class NileHeatmapChart 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.xCategories = [];
|
|
19
|
+
this.yCategories = [];
|
|
20
|
+
this.data = [];
|
|
21
|
+
this.seriesName = '';
|
|
22
|
+
this.colorMin = null;
|
|
23
|
+
this.colorMax = null;
|
|
24
|
+
this.minColor = '#ffffff';
|
|
25
|
+
this.maxColor = '#1e40af';
|
|
26
|
+
this.colorAxisTitle = '';
|
|
27
|
+
this.options = {};
|
|
28
|
+
this.loading = false;
|
|
29
|
+
this.height = '400px';
|
|
30
|
+
this.showDataLabels = true;
|
|
31
|
+
}
|
|
32
|
+
applyConfig(cfg) {
|
|
33
|
+
applySeparatedChartConfig(this, cfg);
|
|
34
|
+
}
|
|
35
|
+
connectedCallback() {
|
|
36
|
+
super.connectedCallback();
|
|
37
|
+
if (this.config)
|
|
38
|
+
this.applyConfig(this.config);
|
|
39
|
+
}
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
super.disconnectedCallback();
|
|
42
|
+
this.destroyChart();
|
|
43
|
+
this.resizeObserver?.disconnect();
|
|
44
|
+
this.resizeObserver = null;
|
|
45
|
+
}
|
|
46
|
+
firstUpdated() {
|
|
47
|
+
this.initChart();
|
|
48
|
+
this.setupResizeObserver();
|
|
49
|
+
}
|
|
50
|
+
updated(changedProperties) {
|
|
51
|
+
if (changedProperties.has('config') && this.config) {
|
|
52
|
+
this.applyConfig(this.config);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const props = [
|
|
56
|
+
'xCategories',
|
|
57
|
+
'yCategories',
|
|
58
|
+
'data',
|
|
59
|
+
'chartTitle',
|
|
60
|
+
'chartSubtitle',
|
|
61
|
+
'seriesName',
|
|
62
|
+
'colorMin',
|
|
63
|
+
'colorMax',
|
|
64
|
+
'minColor',
|
|
65
|
+
'maxColor',
|
|
66
|
+
'colorAxisTitle',
|
|
67
|
+
'options',
|
|
68
|
+
'height',
|
|
69
|
+
'loading',
|
|
70
|
+
'showDataLabels',
|
|
71
|
+
];
|
|
72
|
+
if (!props.some(p => changedProperties.has(p)))
|
|
73
|
+
return;
|
|
74
|
+
if (this.loading) {
|
|
75
|
+
this.destroyChart();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (this.chart) {
|
|
79
|
+
this.chart.update(this.buildOptions(), true, true);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.initChart();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
setupResizeObserver() {
|
|
86
|
+
if (!this.chartContainer)
|
|
87
|
+
return;
|
|
88
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
89
|
+
this.chart?.reflow();
|
|
90
|
+
});
|
|
91
|
+
this.resizeObserver.observe(this.chartContainer);
|
|
92
|
+
}
|
|
93
|
+
valueExtent() {
|
|
94
|
+
if (this.data.length === 0)
|
|
95
|
+
return { min: 0, max: 1 };
|
|
96
|
+
let min = this.data[0].value;
|
|
97
|
+
let max = min;
|
|
98
|
+
for (const c of this.data) {
|
|
99
|
+
if (c.value < min)
|
|
100
|
+
min = c.value;
|
|
101
|
+
if (c.value > max)
|
|
102
|
+
max = c.value;
|
|
103
|
+
}
|
|
104
|
+
if (min === max)
|
|
105
|
+
max = min + 1;
|
|
106
|
+
return { min, max };
|
|
107
|
+
}
|
|
108
|
+
buildOptions() {
|
|
109
|
+
const self = this;
|
|
110
|
+
const ext = this.valueExtent();
|
|
111
|
+
const cMin = this.colorMin ?? ext.min;
|
|
112
|
+
const cMax = this.colorMax ?? ext.max;
|
|
113
|
+
const seriesData = this.data.map(c => [c.x, c.y, c.value]);
|
|
114
|
+
return deepMerge({
|
|
115
|
+
chart: { type: 'heatmap', height: this.height },
|
|
116
|
+
title: { text: this.chartTitle || undefined },
|
|
117
|
+
subtitle: { text: this.chartSubtitle || undefined },
|
|
118
|
+
xAxis: { categories: this.xCategories, title: { text: undefined } },
|
|
119
|
+
yAxis: {
|
|
120
|
+
categories: this.yCategories,
|
|
121
|
+
title: { text: undefined },
|
|
122
|
+
reversed: true,
|
|
123
|
+
},
|
|
124
|
+
colorAxis: {
|
|
125
|
+
min: cMin,
|
|
126
|
+
max: cMax,
|
|
127
|
+
minColor: this.minColor,
|
|
128
|
+
maxColor: this.maxColor,
|
|
129
|
+
title: { text: this.colorAxisTitle || undefined },
|
|
130
|
+
},
|
|
131
|
+
legend: { align: 'right', layout: 'vertical', verticalAlign: 'top' },
|
|
132
|
+
tooltip: {
|
|
133
|
+
formatter() {
|
|
134
|
+
const p = this.point;
|
|
135
|
+
if (!p)
|
|
136
|
+
return false;
|
|
137
|
+
const x = p.x;
|
|
138
|
+
const y = p.y;
|
|
139
|
+
const xCat = self.xCategories[x] ?? String(x);
|
|
140
|
+
const yCat = self.yCategories[y] ?? String(y);
|
|
141
|
+
const val = p.value;
|
|
142
|
+
return `<b>${yCat}</b> · ${xCat}<br/>Value: <b>${val ?? ''}</b>`;
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
plotOptions: {
|
|
146
|
+
heatmap: {
|
|
147
|
+
dataLabels: { enabled: this.showDataLabels },
|
|
148
|
+
borderWidth: 1,
|
|
149
|
+
borderColor: '#e2e8f0',
|
|
150
|
+
},
|
|
151
|
+
series: {
|
|
152
|
+
cursor: 'pointer',
|
|
153
|
+
point: {
|
|
154
|
+
events: {
|
|
155
|
+
click() {
|
|
156
|
+
const x = this.x;
|
|
157
|
+
const y = this.y;
|
|
158
|
+
self.emit('nile-chart-click', {
|
|
159
|
+
point: this,
|
|
160
|
+
xCategory: self.xCategories[x],
|
|
161
|
+
yCategory: self.yCategories[y],
|
|
162
|
+
xIndex: x,
|
|
163
|
+
yIndex: y,
|
|
164
|
+
value: this.value,
|
|
165
|
+
seriesName: this.series.name,
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
series: [
|
|
173
|
+
{
|
|
174
|
+
type: 'heatmap',
|
|
175
|
+
name: this.seriesName || 'Intensity',
|
|
176
|
+
data: seriesData,
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
credits: { enabled: false },
|
|
180
|
+
}, this.options);
|
|
181
|
+
}
|
|
182
|
+
async initChart() {
|
|
183
|
+
if (this.loading || !this.chartContainer)
|
|
184
|
+
return;
|
|
185
|
+
if (!this._hc)
|
|
186
|
+
this._hc = await getHighcharts();
|
|
187
|
+
this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
|
|
188
|
+
this.emit('nile-chart-ready', { chart: this.chart });
|
|
189
|
+
}
|
|
190
|
+
destroyChart() {
|
|
191
|
+
if (this.chart) {
|
|
192
|
+
this.chart.destroy();
|
|
193
|
+
this.chart = null;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
render() {
|
|
197
|
+
if (this.loading) {
|
|
198
|
+
return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
|
|
199
|
+
}
|
|
200
|
+
return html `<div class="chart-container"></div>`;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
NileHeatmapChart.styles = styles;
|
|
204
|
+
__decorate([
|
|
205
|
+
query('.chart-container')
|
|
206
|
+
], NileHeatmapChart.prototype, "chartContainer", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
property({ type: Object })
|
|
209
|
+
], NileHeatmapChart.prototype, "config", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
property({ type: String, attribute: 'chart-title' })
|
|
212
|
+
], NileHeatmapChart.prototype, "chartTitle", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
property({ type: String, attribute: 'chart-subtitle' })
|
|
215
|
+
], NileHeatmapChart.prototype, "chartSubtitle", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
property({ type: Array })
|
|
218
|
+
], NileHeatmapChart.prototype, "xCategories", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
property({ type: Array })
|
|
221
|
+
], NileHeatmapChart.prototype, "yCategories", void 0);
|
|
222
|
+
__decorate([
|
|
223
|
+
property({ type: Array })
|
|
224
|
+
], NileHeatmapChart.prototype, "data", void 0);
|
|
225
|
+
__decorate([
|
|
226
|
+
property({ type: String, attribute: 'series-name' })
|
|
227
|
+
], NileHeatmapChart.prototype, "seriesName", void 0);
|
|
228
|
+
__decorate([
|
|
229
|
+
property({ type: Number, attribute: 'color-min' })
|
|
230
|
+
], NileHeatmapChart.prototype, "colorMin", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
property({ type: Number, attribute: 'color-max' })
|
|
233
|
+
], NileHeatmapChart.prototype, "colorMax", void 0);
|
|
234
|
+
__decorate([
|
|
235
|
+
property({ type: String, attribute: 'min-color' })
|
|
236
|
+
], NileHeatmapChart.prototype, "minColor", void 0);
|
|
237
|
+
__decorate([
|
|
238
|
+
property({ type: String, attribute: 'max-color' })
|
|
239
|
+
], NileHeatmapChart.prototype, "maxColor", void 0);
|
|
240
|
+
__decorate([
|
|
241
|
+
property({ type: String, attribute: 'color-axis-title' })
|
|
242
|
+
], NileHeatmapChart.prototype, "colorAxisTitle", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
property({ type: Object })
|
|
245
|
+
], NileHeatmapChart.prototype, "options", void 0);
|
|
246
|
+
__decorate([
|
|
247
|
+
property({ type: Boolean, reflect: true })
|
|
248
|
+
], NileHeatmapChart.prototype, "loading", void 0);
|
|
249
|
+
__decorate([
|
|
250
|
+
property({ type: String })
|
|
251
|
+
], NileHeatmapChart.prototype, "height", void 0);
|
|
252
|
+
__decorate([
|
|
253
|
+
property({ type: Boolean, attribute: 'show-data-labels' })
|
|
254
|
+
], NileHeatmapChart.prototype, "showDataLabels", void 0);
|
|
255
|
+
NileHeatmapChart = __decorate([
|
|
256
|
+
customElement('nile-heatmap-chart')
|
|
257
|
+
], NileHeatmapChart);
|
|
258
|
+
export { NileHeatmapChart };
|
|
259
|
+
//# sourceMappingURL=nile-heatmap-chart.js.map
|
|
@@ -112,7 +112,9 @@ let NileHistogramChart = class NileHistogramChart extends NileElement {
|
|
|
112
112
|
buildOptions() {
|
|
113
113
|
const self = this;
|
|
114
114
|
const bw = this.binWidth > 0 ? this.binWidth : undefined;
|
|
115
|
-
|
|
115
|
+
// Highcharts #15: line/scatter x values must be ascending; raw samples are often unsorted.
|
|
116
|
+
const sorted = [...this.data].sort((a, b) => a - b);
|
|
117
|
+
const scatterData = sorted.map(x => [x, 0]);
|
|
116
118
|
return deepMerge({
|
|
117
119
|
chart: { height: this.height },
|
|
118
120
|
title: { text: this.chartTitle || undefined },
|
|
@@ -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-inverted-area-chart.css.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
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/index.js';
|
|
5
|
+
export interface InvertedAreaChartSeriesData {
|
|
6
|
+
name: string;
|
|
7
|
+
data: number[];
|
|
8
|
+
color?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class NileInvertedAreaChart extends NileElement {
|
|
11
|
+
static styles: CSSResultGroup;
|
|
12
|
+
private _hc;
|
|
13
|
+
private chart;
|
|
14
|
+
private resizeObserver;
|
|
15
|
+
private chartContainer;
|
|
16
|
+
config: SeparatedChartConfigInputType | null;
|
|
17
|
+
chartTitle: string;
|
|
18
|
+
chartSubtitle: string;
|
|
19
|
+
data: InvertedAreaChartSeriesData[];
|
|
20
|
+
categories: string[];
|
|
21
|
+
options: Highcharts.Options;
|
|
22
|
+
loading: boolean;
|
|
23
|
+
height: string;
|
|
24
|
+
yAxisTitle: string;
|
|
25
|
+
stacked: boolean;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
protected firstUpdated(): void;
|
|
29
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
30
|
+
private setupResizeObserver;
|
|
31
|
+
private buildOptions;
|
|
32
|
+
private initChart;
|
|
33
|
+
private destroyChart;
|
|
34
|
+
render(): TemplateResult;
|
|
35
|
+
}
|
|
36
|
+
declare global {
|
|
37
|
+
interface HTMLElementTagNameMap {
|
|
38
|
+
'nile-inverted-area-chart': NileInvertedAreaChart;
|
|
39
|
+
}
|
|
40
|
+
}
|