g3w-admin-qplotly 0.0.1__py3-none-any.whl
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.
- g3w_admin_qplotly-0.0.1.dist-info/METADATA +52 -0
- g3w_admin_qplotly-0.0.1.dist-info/RECORD +139 -0
- g3w_admin_qplotly-0.0.1.dist-info/WHEEL +5 -0
- g3w_admin_qplotly-0.0.1.dist-info/licenses/LICENSE +373 -0
- g3w_admin_qplotly-0.0.1.dist-info/top_level.txt +1 -0
- qplotly/__init__.py +1 -0
- qplotly/admin.py +34 -0
- qplotly/api/__init__.py +0 -0
- qplotly/api/plots/__init__.py +0 -0
- qplotly/api/plots/views.py +211 -0
- qplotly/api/widgets/__init__.py +0 -0
- qplotly/api/widgets/permissions.py +79 -0
- qplotly/api/widgets/serializers.py +109 -0
- qplotly/api/widgets/views.py +287 -0
- qplotly/apiurls.py +132 -0
- qplotly/apps.py +11 -0
- qplotly/locale/bg/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/bg/LC_MESSAGES/django.po +162 -0
- qplotly/locale/de/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/de/LC_MESSAGES/django.po +126 -0
- qplotly/locale/de/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/de/LC_MESSAGES/djangojs.po +221 -0
- qplotly/locale/es/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/es/LC_MESSAGES/django.po +151 -0
- qplotly/locale/es/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/es/LC_MESSAGES/djangojs.po +232 -0
- qplotly/locale/fi/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/fi/LC_MESSAGES/django.po +126 -0
- qplotly/locale/fi/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/fi/LC_MESSAGES/djangojs.po +222 -0
- qplotly/locale/fr/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/fr/LC_MESSAGES/django.po +160 -0
- qplotly/locale/fr/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/fr/LC_MESSAGES/djangojs.po +222 -0
- qplotly/locale/it/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/it/LC_MESSAGES/django.po +163 -0
- qplotly/locale/it/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/it/LC_MESSAGES/djangojs.po +220 -0
- qplotly/locale/pl/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/pl/LC_MESSAGES/django.po +129 -0
- qplotly/locale/pl/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/pl/LC_MESSAGES/djangojs.po +217 -0
- qplotly/locale/pt/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/pt/LC_MESSAGES/django.po +160 -0
- qplotly/locale/ro/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/ro/LC_MESSAGES/django.po +128 -0
- qplotly/locale/ro/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/ro/LC_MESSAGES/djangojs.po +222 -0
- qplotly/locale/se/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/se/LC_MESSAGES/django.po +126 -0
- qplotly/locale/se/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/se/LC_MESSAGES/djangojs.po +222 -0
- qplotly/migrations/0001_initial.py +26 -0
- qplotly/migrations/0002_qplotlywidget_type.py +18 -0
- qplotly/migrations/0003_auto_20200925_0838.py +18 -0
- qplotly/migrations/0004_auto_20200925_1535.py +25 -0
- qplotly/migrations/0005_qplotlywidget_show_on_start_client.py +18 -0
- qplotly/migrations/0006_alter_qplotlywidget_options_qplotlywidget_order.py +23 -0
- qplotly/migrations/0007_alter_qplotlywidget_options_and_more.py +22 -0
- qplotly/migrations/0008_alter_qplotlywidget_order.py +18 -0
- qplotly/migrations/0009_qplotlywidget_show_in_sidebar.py +18 -0
- qplotly/migrations/0010_remove_qplotlywidget_show_in_sidebar_and_more.py +22 -0
- qplotly/migrations/0011_rename_show_poistion_qplotlywidget_show_position.py +18 -0
- qplotly/migrations/0012_qplotlywidgetrelation_qplotlywidget_related_widgets.py +34 -0
- qplotly/migrations/0013_alter_qplotlywidgetrelation_source_and_more.py +24 -0
- qplotly/migrations/0014_alter_qplotlywidgetrelation_source_and_more.py +24 -0
- qplotly/migrations/0015_qplotlywidgetrelation_project.py +34 -0
- qplotly/migrations/0016_remove_qplotlywidget_project.py +17 -0
- qplotly/migrations/__init__.py +0 -0
- qplotly/models.py +142 -0
- qplotly/receivers.py +356 -0
- qplotly/requirements.txt +1 -0
- qplotly/server_filters/__init__.py +1 -0
- qplotly/server_filters/relations.py +32 -0
- qplotly/static/qplotly/icons/2dhistogram.svg +2048 -0
- qplotly/static/qplotly/icons/barplot.svg +2048 -0
- qplotly/static/qplotly/icons/boxplot.svg +2048 -0
- qplotly/static/qplotly/icons/contour.svg +2056 -0
- qplotly/static/qplotly/icons/histogram.svg +2048 -0
- qplotly/static/qplotly/icons/pie.svg +2048 -0
- qplotly/static/qplotly/icons/polar.svg +2055 -0
- qplotly/static/qplotly/icons/scatterplot.svg +2048 -0
- qplotly/static/qplotly/icons/scatterternary.svg +2055 -0
- qplotly/static/qplotly/icons/violin.svg +2878 -0
- qplotly/static/qplotly/js/data-widget-qplotlyWidgetList.js +373 -0
- qplotly/static/qplotly/js/i18n/bg.js +19 -0
- qplotly/static/qplotly/js/i18n/de.js +19 -0
- qplotly/static/qplotly/js/i18n/en.js +19 -0
- qplotly/static/qplotly/js/i18n/fi.js +19 -0
- qplotly/static/qplotly/js/i18n/fr.js +19 -0
- qplotly/static/qplotly/js/i18n/index.js +19 -0
- qplotly/static/qplotly/js/i18n/it.js +19 -0
- qplotly/static/qplotly/js/i18n/ro.js +19 -0
- qplotly/static/qplotly/js/i18n/se.js +19 -0
- qplotly/static/qplotly/js/i18n/uk.js +19 -0
- qplotly/static/qplotly/js/plugin.js +927 -0
- qplotly/static/qplotly/js/sidebar.js +373 -0
- qplotly/static/qplotly/js/widget.js +9 -0
- qplotly/static/qplotly/plotly-1.52.2.min.js +7 -0
- qplotly/static/qplotly/polyfill.min.js +3 -0
- qplotly/templates/qplotly/include/plot_type_icon.html +52 -0
- qplotly/templates/qplotly/layer_action.html +13 -0
- qplotly/templates/qplotly/plots_list_order.html +68 -0
- qplotly/templates/qplotly/plots_list_order_action.html +14 -0
- qplotly/templatetags/__init__.py +0 -0
- qplotly/templatetags/qplotly_tags.py +28 -0
- qplotly/urls.py +52 -0
- qplotly/utils/__init__.py +13 -0
- qplotly/utils/models.py +86 -0
- qplotly/utils/qplotly_factory.py +699 -0
- qplotly/utils/qplotly_settings.py +37 -0
- qplotly/vendor/DataPlotly/__init__.py +0 -0
- qplotly/vendor/DataPlotly/core/__init__.py +0 -0
- qplotly/vendor/DataPlotly/core/plot_factory.py +843 -0
- qplotly/vendor/DataPlotly/core/plot_settings.py +322 -0
- qplotly/vendor/DataPlotly/core/plot_types/__init__.py +20 -0
- qplotly/vendor/DataPlotly/core/plot_types/bar_plot.py +83 -0
- qplotly/vendor/DataPlotly/core/plot_types/box.py +56 -0
- qplotly/vendor/DataPlotly/core/plot_types/contour.py +43 -0
- qplotly/vendor/DataPlotly/core/plot_types/histogram.py +66 -0
- qplotly/vendor/DataPlotly/core/plot_types/histogram2d.py +39 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/2dhistogram.svg +2048 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/barplot.svg +2048 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/boxplot.svg +2048 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/contour.svg +2056 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/histogram.svg +2048 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/pie.svg +2048 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/polar.svg +2055 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/scatterplot.svg +2048 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/scatterternary.svg +2055 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/violin.svg +2878 -0
- qplotly/vendor/DataPlotly/core/plot_types/pie.py +60 -0
- qplotly/vendor/DataPlotly/core/plot_types/plot_type.py +170 -0
- qplotly/vendor/DataPlotly/core/plot_types/polar.py +63 -0
- qplotly/vendor/DataPlotly/core/plot_types/scatter.py +74 -0
- qplotly/vendor/DataPlotly/core/plot_types/ternary.py +129 -0
- qplotly/vendor/DataPlotly/core/plot_types/violin.py +62 -0
- qplotly/vendor/__init__.py +0 -0
- qplotly/views.py +148 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
const { GUI } = g3wsdk.gui;
|
|
2
|
+
const { debounce, getUniqueDomId } = g3wsdk.core.utils;
|
|
3
|
+
const { CatalogLayersStoresRegistry } = g3wsdk.core.catalog;
|
|
4
|
+
const { ApplicationState } = g3wsdk.core;
|
|
5
|
+
|
|
6
|
+
export default ({
|
|
7
|
+
|
|
8
|
+
template: /* html */ `
|
|
9
|
+
<div
|
|
10
|
+
v-disabled = "service.state.loading"
|
|
11
|
+
:id = "id"
|
|
12
|
+
class = "plot-content"
|
|
13
|
+
:role = "rel ? 'region' : null"
|
|
14
|
+
:aria-label = "rel ? $t('plugins.qplotly.title') : null"
|
|
15
|
+
:tabindex = "rel ? 0 : null"
|
|
16
|
+
:style = "{
|
|
17
|
+
overflow: rel ? 'auto' : 'hidden visible',
|
|
18
|
+
width: '100%',
|
|
19
|
+
height: order.length > 1 && rel?.height ? rel.height + 'px' : '100%',
|
|
20
|
+
}"
|
|
21
|
+
>
|
|
22
|
+
<template v-if = "order.length">
|
|
23
|
+
|
|
24
|
+
<template v-for = "plotId in order">
|
|
25
|
+
|
|
26
|
+
<figure v-for = "({ chart }) in charts[plotId]">
|
|
27
|
+
|
|
28
|
+
<figcaption>
|
|
29
|
+
|
|
30
|
+
<div style="margin:auto">{{ chart.title || '' }}</div>
|
|
31
|
+
|
|
32
|
+
<div class = "plot-tools">
|
|
33
|
+
<span
|
|
34
|
+
v-if = "!rel && chart.tools.selection.active"
|
|
35
|
+
style = "margin: auto"
|
|
36
|
+
class = "action-button action-button-icon fas fa-filter"
|
|
37
|
+
@click.stop = "toggleFilter(chart.layerId)"
|
|
38
|
+
:class = "{ 'toggled': chart.tools.filter.active }"
|
|
39
|
+
data-placement = "bottom"
|
|
40
|
+
title = "plugins.qplotly.tooltip.filter_chart"
|
|
41
|
+
></span>
|
|
42
|
+
<span
|
|
43
|
+
v-if = "!rel && service.state.geolayer"
|
|
44
|
+
style = "margin: auto"
|
|
45
|
+
class = "action-button action-button-icon far fa-map"
|
|
46
|
+
:class = "{ 'toggled': service.state.bbox_filter }"
|
|
47
|
+
@click.stop = "toggleBBox"
|
|
48
|
+
data-placement = "bottom"
|
|
49
|
+
title = "plugins.qplotly.tooltip.show_all_features_on_map"
|
|
50
|
+
></span>
|
|
51
|
+
<a
|
|
52
|
+
v-if = "edit_url"
|
|
53
|
+
:href = "edit_url"
|
|
54
|
+
target = "_blank"
|
|
55
|
+
style = "margin: auto"
|
|
56
|
+
class = "action-button action-button-icon far fa-edit"
|
|
57
|
+
data-placement = "bottom"
|
|
58
|
+
title = "Edit in admin"
|
|
59
|
+
></a>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
</figcaption>
|
|
63
|
+
|
|
64
|
+
<ul v-if="(chart.filters || []).length > 0" class="plot-filters">
|
|
65
|
+
<li
|
|
66
|
+
v-for = "filter in chart.filters"
|
|
67
|
+
:key = "filter"
|
|
68
|
+
v-t-plugin = "'qplotly.filters.' + filter"
|
|
69
|
+
></li>
|
|
70
|
+
</ul>
|
|
71
|
+
|
|
72
|
+
<div
|
|
73
|
+
:ref = "plotId"
|
|
74
|
+
:style = "rel ? { minWidth: '250px', minHeight: rel.height ? null : '250px' } : {}"
|
|
75
|
+
></div>
|
|
76
|
+
|
|
77
|
+
</figure>
|
|
78
|
+
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
</template>
|
|
82
|
+
|
|
83
|
+
<div
|
|
84
|
+
v-else
|
|
85
|
+
id = "no_plots"
|
|
86
|
+
class = "skin-color"
|
|
87
|
+
>
|
|
88
|
+
<div v-if = "service.state.loading" class = "bar-loader" style = "align-self: flex-start; border: 0"></div>
|
|
89
|
+
<h4 v-if = "!service.state.loading" v-t-plugin = "'qplotly.no_plots'"></h4>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
</div>`,
|
|
93
|
+
|
|
94
|
+
name: "qplotly",
|
|
95
|
+
|
|
96
|
+
props: ['ids', 'rel', 'service', 'container'],
|
|
97
|
+
|
|
98
|
+
data() {
|
|
99
|
+
return {
|
|
100
|
+
charts: {},
|
|
101
|
+
order: [], //array of ordered plot id
|
|
102
|
+
plots: this.service.config.plots,
|
|
103
|
+
id: getUniqueDomId(),
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
computed: {
|
|
108
|
+
edit_url() {
|
|
109
|
+
return ApplicationState.project.getState?.()?.layers_url || '';
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
methods: {
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Toggle filter token on project layer
|
|
117
|
+
* @param layerId
|
|
118
|
+
*/
|
|
119
|
+
async toggleFilter(layerId) {
|
|
120
|
+
await CatalogLayersStoresRegistry.getLayerById(layerId)?.toggleToken();
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Handle click on map icon tool (show bbox data)
|
|
125
|
+
*/
|
|
126
|
+
async toggleBBox() {
|
|
127
|
+
await this.service.toggleCharts({ bbox: !this.service.state.bbox_filter });
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @param { Object } opts
|
|
132
|
+
* @param { Object } opts.charts
|
|
133
|
+
* @param { Array } opts.order ordered array of plot ids
|
|
134
|
+
* @param { Array } opts.plotId id of plot to be removed
|
|
135
|
+
* @param { boolean } opts.throwOnError propagate errors during initial mounting
|
|
136
|
+
*
|
|
137
|
+
* @returns { Promise<void> }
|
|
138
|
+
*/
|
|
139
|
+
async draw({
|
|
140
|
+
charts = {},
|
|
141
|
+
order = [],
|
|
142
|
+
plotId = null,
|
|
143
|
+
throwOnError = false,
|
|
144
|
+
} = {}) {
|
|
145
|
+
if (!order || !charts) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
this.service.setLoading(true);
|
|
150
|
+
|
|
151
|
+
const resize = this.order === order; //check if order is changed
|
|
152
|
+
this.order = order; // get new charts order
|
|
153
|
+
|
|
154
|
+
// remove plot
|
|
155
|
+
if (plotId in this.charts) {
|
|
156
|
+
delete this.charts[plotId];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// loop through charts and initialize chart with plotId and get chart (set reactive state by Vue.observable)
|
|
160
|
+
Object.keys(charts).forEach(id => {
|
|
161
|
+
this.charts[id] = (charts[id] || []).map(chart => ({ chart, state: Vue.observable({ loading: false }) }));
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// draw all charts → loop through plots ids (ordered) draw Plotly Chart
|
|
165
|
+
const results = await Promise.allSettled(this.order.flatMap(plotId =>
|
|
166
|
+
this.charts?.[plotId]?.map(async ({ chart, state }) => {
|
|
167
|
+
try {
|
|
168
|
+
await this.$nextTick();
|
|
169
|
+
const plot_container = this.$refs[`${plotId}`][0];
|
|
170
|
+
const svg_container = plot_container?.querySelector('.svg-container');
|
|
171
|
+
// fold multi‑plot arrays into a single trace list
|
|
172
|
+
let traces = chart.data;
|
|
173
|
+
if (!traces) {
|
|
174
|
+
throw new Error('Failed to load chart data');
|
|
175
|
+
}
|
|
176
|
+
if (Array.isArray(traces[0])) {
|
|
177
|
+
// chart.data is an array of arrays: flatten one level
|
|
178
|
+
traces = traces.flat();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// no data check (applies to flattened traces)
|
|
182
|
+
const noData =
|
|
183
|
+
1 === traces.length
|
|
184
|
+
&& !traces[0][({ pie: 'values', scatterternary: 'a', scatterpolar: 'r' })[
|
|
185
|
+
traces[0]?.type
|
|
186
|
+
] || 'x']?.length;
|
|
187
|
+
|
|
188
|
+
if (noData) {
|
|
189
|
+
if (!plot_container.querySelector('.no_data')) {
|
|
190
|
+
plot_container.innerHTML = /* html */ `
|
|
191
|
+
<div class = "no_data" style = "display: flex; flex-direction: column; align-items: center; height: ${svg_container?.style?.height || '100%' }; justify-content: center;">
|
|
192
|
+
<h4 style = "font-weight: bold;" class = "skin-color">${ this.$t('plugins.qplotly.no_data') }</h4>
|
|
193
|
+
</div>`;
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
// retrieve "trace-config" from cache
|
|
197
|
+
this.draw.configs = this.draw.configs || {};
|
|
198
|
+
if (!this.draw.configs[plotId]) {
|
|
199
|
+
const plot = this.service.config.plots.find(p => plotId === p.id);
|
|
200
|
+
//get config from server
|
|
201
|
+
this.draw.configs[plotId] = (await (await fetch(`/qplotly/api/trace-config/${(plot.plots ?? [plot]).at(-1).id}/`)).json()).data;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const { layout = {}, config = {} } = this.draw.configs[plotId];
|
|
205
|
+
layout.title = chart.title;
|
|
206
|
+
// plot bg-color
|
|
207
|
+
plot_container.parentNode.style.backgroundColor = layout.plot_bgcolor || '#fff';
|
|
208
|
+
// plot height
|
|
209
|
+
if (this?.rel?.height) {
|
|
210
|
+
layout.height = this?.rel?.height;
|
|
211
|
+
plot_container.style.height = null;
|
|
212
|
+
} else {
|
|
213
|
+
plot_container.style.height =
|
|
214
|
+
(this.$el.offsetHeight / (this.order.length > 1 ? 2 : 1))
|
|
215
|
+
- Array.from(plot_container.parentNode.children).filter(el => plot_container !== el).reduce((height, sibling) => (height += sibling.offsetHeight), 0)
|
|
216
|
+
+ 'px';
|
|
217
|
+
}
|
|
218
|
+
state.loading = !this.rel;
|
|
219
|
+
if (resize && svg_container) {
|
|
220
|
+
await Plotly.Plots.resize(plot_container);
|
|
221
|
+
} else {
|
|
222
|
+
plot_container.innerHTML = '';
|
|
223
|
+
await Plotly.newPlot(plot_container, traces , layout, config);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
} catch (e) {
|
|
227
|
+
console.warn(e);
|
|
228
|
+
if (throwOnError) {
|
|
229
|
+
throw e;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return plotId;
|
|
233
|
+
})
|
|
234
|
+
));
|
|
235
|
+
results.forEach(response => this.charts?.[response.value]?.forEach(chart => chart.state.loading = false));
|
|
236
|
+
|
|
237
|
+
setTimeout(() => this.service.setLoading(false))
|
|
238
|
+
const failure = throwOnError && results.find(response => 'rejected' === response.status);
|
|
239
|
+
if (failure) {
|
|
240
|
+
throw failure.reason;
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* @listens service~change-charts
|
|
248
|
+
*/
|
|
249
|
+
mounted() {
|
|
250
|
+
this.mountPromise = (async () => {
|
|
251
|
+
|
|
252
|
+
//show chart on query result
|
|
253
|
+
if (this.container) {
|
|
254
|
+
this.container.append(this.$el);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
this.service.on('change-charts', this.draw);
|
|
258
|
+
|
|
259
|
+
// show chart in sidebar
|
|
260
|
+
if (!this.container) {
|
|
261
|
+
await GUI.showContent({
|
|
262
|
+
content: this.$el,
|
|
263
|
+
title: 'plugins.qplotly.title',
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// at mount time get Charts
|
|
268
|
+
const { charts, order } = await this.service.getCharts({
|
|
269
|
+
layerIds: this.ids, // provided by query result service otherwise is undefined
|
|
270
|
+
rel: this.rel, // provided by query result service otherwise is undefined
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
// set charts
|
|
274
|
+
await this.draw({ charts, order, throwOnError: true });
|
|
275
|
+
|
|
276
|
+
this.resize = new ResizeObserver(debounce(() => { this.draw({ order: this.order }); }));
|
|
277
|
+
this.resize.observe(this.$el);
|
|
278
|
+
|
|
279
|
+
this.service.state.showCharts = true;
|
|
280
|
+
|
|
281
|
+
})();
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* un listen all events
|
|
286
|
+
*/
|
|
287
|
+
beforeDestroy() {
|
|
288
|
+
this.resize?.unobserve(this.$el);
|
|
289
|
+
|
|
290
|
+
if (this.container) {
|
|
291
|
+
this.$el.remove();
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
this.service.off('change-charts', this.draw);
|
|
295
|
+
|
|
296
|
+
this.rel = null;
|
|
297
|
+
this.service.state.bbox_filter = false;
|
|
298
|
+
this.service.state.bbox = undefined;
|
|
299
|
+
|
|
300
|
+
// remove handler of map moveend and reset to empty
|
|
301
|
+
if (this.service.state.bbox_key) {
|
|
302
|
+
ol.Observable.unByKey(this.service.state.bbox_key);
|
|
303
|
+
this.service.state.bbox_key = null;
|
|
304
|
+
this.service.state.bbox_ids = [];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
this.service.config.plots
|
|
308
|
+
.filter(p => p.show)
|
|
309
|
+
.forEach(p => {
|
|
310
|
+
this.service.clearData(p);
|
|
311
|
+
p.tools.geolayer.active = !p.tools.geolayer.show && p.tools.geolayer.active;
|
|
312
|
+
p.filters = [];
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
this.service.state.showCharts = false;
|
|
316
|
+
this.charts = null;
|
|
317
|
+
this.order = null;
|
|
318
|
+
this.ids = null;
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
document.head.insertAdjacentHTML(
|
|
324
|
+
'beforeend',
|
|
325
|
+
/* css */`
|
|
326
|
+
<style>
|
|
327
|
+
#no_plots {
|
|
328
|
+
height: 100%;
|
|
329
|
+
width: 100%;
|
|
330
|
+
display: flex;
|
|
331
|
+
justify-content: center;
|
|
332
|
+
align-items: center;
|
|
333
|
+
background-color: white;
|
|
334
|
+
}
|
|
335
|
+
#no_plots > h4 {
|
|
336
|
+
text-align: center;
|
|
337
|
+
font-weight: bold;
|
|
338
|
+
}
|
|
339
|
+
.plot-content figcaption {
|
|
340
|
+
width:100%;
|
|
341
|
+
position: sticky;
|
|
342
|
+
top:0;
|
|
343
|
+
z-index: 1;
|
|
344
|
+
background-color: #374146;
|
|
345
|
+
display:flex;
|
|
346
|
+
padding: 2px;
|
|
347
|
+
min-height: 20px;
|
|
348
|
+
font-size: 1.4em;
|
|
349
|
+
text-align: center;
|
|
350
|
+
color: #FFF;
|
|
351
|
+
}
|
|
352
|
+
.plot-content .plot-tools:not(:empty) {
|
|
353
|
+
background-color: #FFF;
|
|
354
|
+
padding: 2px;
|
|
355
|
+
font-size: 1.0em;
|
|
356
|
+
border-radius: 3px;
|
|
357
|
+
height: min-content;
|
|
358
|
+
margin: auto 0;
|
|
359
|
+
}
|
|
360
|
+
.plot-content .plot-filters {
|
|
361
|
+
color: initial;
|
|
362
|
+
list-style-type: ' ℹ️ ';
|
|
363
|
+
padding: 5px 0 0 25px;
|
|
364
|
+
}
|
|
365
|
+
.plot-content.bar-loader::before {
|
|
366
|
+
z-index: 2;
|
|
367
|
+
background-color: #fff;
|
|
368
|
+
}
|
|
369
|
+
.plot-content .action-button {
|
|
370
|
+
--skin-color: #374146;
|
|
371
|
+
}
|
|
372
|
+
</style>`,
|
|
373
|
+
);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Add qplotlyWidgetList manager widget
|
|
2
|
+
// -------------------------------------------------
|
|
3
|
+
// activate widget: append to ga.ui.before_datatable_callbacks for to cala it before DatTable init
|
|
4
|
+
ga.ui.before_datatable_callbacks.push(function($widgetItem){
|
|
5
|
+
$widgetItem.find('[data-widget-type="qplotlyWidgetList"]').on('click', async function() {
|
|
6
|
+
const widget = (await import(`${STATIC_BASE_URL}qplotly/js/data-widget-qplotlyWidgetList.js`)).default;
|
|
7
|
+
widget($(this).parents("table").DataTable(), $(this));
|
|
8
|
+
});
|
|
9
|
+
});
|