lizmap-web-client icon indicating copy to clipboard operation
lizmap-web-client copied to clipboard

[Bug]: Cant display filtered HTML Template Dataviz : `plot_config is undefined`

Open audelorAd opened this issue 2 years ago • 11 comments

What is the bug?

I Have a Dataviz "HTML Template" type in ordered to display a table. I can't display this dataviz in the parents popup. In this popup the content should be filtered.

In the browser console I get the following message : Uncaught TypeError: plot_config is undefined dataviz.js: 202:20

Steps to reproduce the issue

  1. QGIS Project with at least two layer with relation between them.
  2. In lizmap plugin, create a dataviz on the children layer
  3. Set the dataviz to display in the parent popup
  4. In the lizmap plugin create an attribute table on the parent layer.
  5. See the result, dataviz is displayed in the main panel, but not in the parent popup

Versions

Versions :

  • Lizmap Web Client : 3.5.4-pre.5333
  • Lizmap plugin : 3.8.2
  • QGIS Desktop : 3.22.4
  • QGIS Server : 3.22.4

Check Lizmap plugin

  • [X] I have done the step just before in the Lizmap QGIS desktop plugin before opening this ticket.

QGIS server version, only if the section above doesn't mention the QGIS Server version

3.22

Operating system

Windows 10

Browsers

Firefox

Browsers version

91.10

Relevant log output

Uncaught TypeError: plot_config is undefined
    buildHtmlPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:202
    buildPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:304
    getPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:190
    jQuery 9
    getPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:156
    getPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:539
    addChildrenDatavizFilteredByPopupFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:2990
    getLayerFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:5139
    getLayerFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:5749
    addChildrenDatavizFilteredByPopupFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:2948
    jQuery 2
    addChildrenDatavizFilteredByPopupFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:2919
    getfeatureinfo https://carto.audelor.com/assets/js/map.js?_r=220519235810:3341
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    triggerGetFeatureInfo https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1692
    handleResponse https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1693
    callback https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1689
    bind https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:77
    runCallbacks https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1563
    onreadystatechange https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1559
    dispatchEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1593
    fReadyStateChange https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1596
    onreadystatechange https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1579
    open https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1574
    issue https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1558
    GET https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1564
    request https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1691
    refreshGetFeatureInfo https://carto.audelor.com/assets/js/map.js?_r=220519235810:3441
    layerFilterParamChanged https://carto.audelor.com/assets/js/map.js?_r=220519235810:3474
    jQuery 8
    layerFilterParamChanged https://carto.audelor.com/assets/js/map.js?_r=220519235810:3470
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    applyLayerFilter https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2370
    callFeatureDataCallBacks https://carto.audelor.com/assets/js/map.js?_r=220519235810:4991
    callFeatureDataCallBacks https://carto.audelor.com/assets/js/map.js?_r=220519235810:4989
    getFeatureData https://carto.audelor.com/assets/js/map.js?_r=220519235810:5063
    jQuery 8
    getFeatureData https://carto.audelor.com/assets/js/map.js?_r=220519235810:5042
    getFeatureData https://carto.audelor.com/assets/js/map.js?_r=220519235810:5756
    applyLayerFilter https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2107
    updateLayer https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2085
    updateMapLayerDrawing https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2544
    layerFilteredFeaturesChanged https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2842
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    filterLayerFromSelectedFeatures https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2065
    layerfeaturefilterselected https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2813
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    lizmappopupdisplayed https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2999
    jQuery 10
    lizmappopupdisplayed https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2977
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    getfeatureinfo https://carto.audelor.com/assets/js/map.js?_r=220519235810:3344
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    triggerGetFeatureInfo https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1692
dataviz.js:202:20
    buildHtmlPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:202
    buildPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:304
    getPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:190
    jQuery 9
    getPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:156
    getPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:539
    addChildrenDatavizFilteredByPopupFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:2990
    getLayerFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:5139
    getLayerFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:5749
    addChildrenDatavizFilteredByPopupFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:2948
    jQuery 2
    addChildrenDatavizFilteredByPopupFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:2919
    getfeatureinfo https://carto.audelor.com/assets/js/map.js?_r=220519235810:3341
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    triggerGetFeatureInfo https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1692
    handleResponse https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1693
    callback https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1689
    bind https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:77
    runCallbacks https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1563
    onreadystatechange https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1559
    dispatchEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1593
    fReadyStateChange https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1596
    onreadystatechange https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1579
    (Asynchrone : EventHandlerNonNull)
    open https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1574
    issue https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1558
    GET https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1564
    request https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1691
    refreshGetFeatureInfo https://carto.audelor.com/assets/js/map.js?_r=220519235810:3441
    layerFilterParamChanged https://carto.audelor.com/assets/js/map.js?_r=220519235810:3474
    jQuery 8
    layerFilterParamChanged https://carto.audelor.com/assets/js/map.js?_r=220519235810:3470
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    applyLayerFilter https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2370
    callFeatureDataCallBacks https://carto.audelor.com/assets/js/map.js?_r=220519235810:4991
    forEach self-hosted:202
    callFeatureDataCallBacks https://carto.audelor.com/assets/js/map.js?_r=220519235810:4989
    getFeatureData https://carto.audelor.com/assets/js/map.js?_r=220519235810:5063
    jQuery 8
    getFeatureData https://carto.audelor.com/assets/js/map.js?_r=220519235810:5042
    getFeatureData https://carto.audelor.com/assets/js/map.js?_r=220519235810:5756
    applyLayerFilter https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2107
    updateLayer https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2085
    updateMapLayerDrawing https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2544
    layerFilteredFeaturesChanged https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2842
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    filterLayerFromSelectedFeatures https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2065
    layerfeaturefilterselected https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2813
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    lizmappopupdisplayed https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2999
    jQuery 10
    lizmappopupdisplayed https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2977
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    getfeatureinfo https://carto.audelor.com/assets/js/map.js?_r=220519235810:3344
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    triggerGetFeatureInfo https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1692

audelorAd avatar Jun 29 '22 15:06 audelorAd

Few more test today :

  • Dataviz filter works fine in the main dataviz panel
  • But still not in the parents popup

See below :

  • On the right the main dataviz panel with working filter.
  • On the left the parent popup with non working dataviz and blue progress bar instead 2022-06-30_10h36_26

audelorAd avatar Jun 30 '22 08:06 audelorAd

Problem seems situated inside buildHtmlPlot function of dataviz.js file In this function the id args is not the same between dataviz panel plots ( id value here start with "dataviz_plot_") and parent popup plots (id value here is the parent layer id).

buildHtmlPlot function seems able to deals only with dataviz panel plots like we can see below:

function buildHtmlPlot(id, data, layout) {
        if (!data) {
            return;
        }
        var a = **parseInt(id.replace('dataviz_plot_', ''))**

audelorAd avatar Jul 11 '22 15:07 audelorAd

Any idea on how to fix this ?

audelorAd avatar Jul 11 '22 15:07 audelorAd

Note from @audelorAd on IRC :

<audelorad> This afternoon I tried to modify dataviz.js code through Chrome Developper console and the code below is working fine :
<audelorad> * Add "pid" in the line 303 => buildHtmlPlot(id, pid, conf.data, conf.layout);
<audelorad> * Use also "pid" in line 201 => var plot_config = dv.config.layers[pid];
<audelorad> * Delete line 200

Gustry avatar Aug 02 '22 15:08 Gustry

I encountered the issue also on another instance and I have access to the data.

Gustry avatar Dec 16 '22 15:12 Gustry

Apparently, this issue was only with "HTML plot" when it's filtered with a parent layer.

On one running LWC instance, I'm not sure to reproduce the issue (if the plot is still here in the config)

@audelorAd Do you still confirm the issue ? Can you share a URL (or private) ?

Gustry avatar Oct 25 '23 13:10 Gustry

Yes I confirm issue still here on Lizmap 3.6.7 I will share you URL privately.

audelorAd avatar Nov 06 '23 14:11 audelorAd

Yes I confirm issue still here on Lizmap 3.6.7

Ok, I got the issue too.

Gustry avatar Nov 06 '23 15:11 Gustry

This issue is missing some feedbacks. 👻 Please have a look to the discussion, thanks. 🦎

github-actions[bot] avatar Jan 05 '24 04:01 github-actions[bot]

Are layers data used for the dataviz all accessible? (no filter by user/group etc.)

nboisteault avatar May 02 '24 10:05 nboisteault

It can be linked to #4400

Gustry avatar May 02 '24 10:05 Gustry