DataPlotly icon indicating copy to clipboard operation
DataPlotly copied to clipboard

graphs not showing for relate layers data

Open janavaarro opened this issue 2 years ago • 3 comments

Dear sir, my name is Juan Antonio, and i work for the Guadalquivir river basin administration (southern Spain). My job is about water quality monitoring, both surface and ground water, from the perspective of pollution prevention. Intermediate QGIS and remote sensing user.

After several trials and errors, i can´t get graphs for relates layers in QGIS. I have one master shp layer with points from our water quality network. Then a second spreadsheet with the station code, sample date and parameter results (ammonia, etc). Firstly i set the relation btw those two layers in project -> properties. That relation is correctly set, as clicking at any point in the canvas with the info tool, i get a form with both the data of the "master" layer" (mainly station caracteristics) and below, a table with the time series in rows.

I´ve tried these two alternatives to get the scatter plot with time series in dataPlotly:

  1. Setting the shp layer as the layer: no graph at all, it seems that the info in the spreadsheet is not accesible for Plotly.

  2. Setting the spreadsheet as the layer: Then all data appears in the plot but there is no connection with the canvas (use selected or visible features, etc)

I wonder if there´s a way to get the plots, or else Data Plotly only works with one layer data, or with joined data at most, but not with relates, which indeed would be a very interesting feature.

Thank you for your attention,

Juan,

janavaarro avatar Jun 30 '22 07:06 janavaarro

@janavaarro it should work correctly also with 1:N relations. You have to use the main shp layer in the plugin dialog but you should also set up an aggregate function in the y field so you are able to retrieve the data from the second spreadsheet layer, connected to the main one

ghtmtt avatar Jul 18 '22 06:07 ghtmtt

Thanks for the comments @ghtmtt, finally it worked, but only when setting the xls layer in the plugin and, yes, as you say, using an aggregate function, in this case for detecting the selected feature id in the canvas. The thing is that all that stuff is slowing the plugin but the plot appears. The other way (using shp layer + aggregate xls layer) doesnt produce time series scatter plots as (i think) the plugin is intended to show scatter data for different features in an area.

image

janavaarro avatar Jul 18 '22 06:07 janavaarro

it depends on what you want to show in the plot. If you have a 1:N relation and in the X you want to have a variable for the shape while on the Y a variable of the xls layer, than you should use a relation_aggregate function (e.g. the mean of teh Y field of the xls layer for that particular station)

ghtmtt avatar Jul 18 '22 07:07 ghtmtt