lovasoa / SQLpage

SQL-only webapp builder, empowering data analysts to build websites and applications quickly
https://sql.datapage.app
MIT License
1.29k stars 69 forks source link

Bubble Chart and Marker size #120

Closed DSMejantel closed 8 months ago

DSMejantel commented 10 months ago

Hello, Thanks for this beautiful app ! I tried to build a bubble chart but it seems like scatter chart. It's seem because "marker" parameter is in "Top-level parameters" instead of Row-level parameters. So we can't ask for a size from a table for each id in this table. Il would like somethings that :+1:

-- Graphique
select 
    'chart'               as component,
    'Répartitions des suivis' as title,
    'bubble'             as type,
     'Élève '         as xtitle,
    'AESH ' as ytitle,
    0                     as xmin,
    10                    as xmax,
    0                     as ymin,
    35                    as ymax,
    20                    as xticks,
    7                    as yticks;

select 
    aesh_name as y,
        eleve.nom as x,
    suivi.temps        as marker
        FROM eleve INNER JOIN etab on eleve.etab_id = etab.id JOIN suivi on suivi.eleve_id=eleve.id JOIN aesh on suivi.aesh_id=aesh.id WHERE eleve.etab_id=$id and aesh.id>1  ORDER BY suivi.temps ASC;

Do you some ideas ?

lovasoa commented 10 months ago

There is an undocumented row-level parameter called z that can be used to control the last dimension which should be represented by the bubble size in bubble charts, but the support for it is not great at the moment.

Given your column names, it looks like what you are representing is non-numeric data, that may be easier to represent using multiple series: if I were you, I would use a cumulative bar chart for that, where each column represents an accompanying person (aesh), and columns representing the total time are split by student.

If you'd like to chat about your use case in french, I'd love to: contact@ophir.dev

DSMejantel commented 8 months ago

It's ok with numerics values for x, y and z

Capture-20231205165706-877x557

-- Graphique Bulle
select 
    SUBSTR(aesh.aesh_firstname, 1, 1) ||'. '|| aesh_name as series,
    coalesce(eleve.id,0) as x,
    coalesce(aesh.id,0) as y,    
    coalesce(suivi.temps,0)        as z
        FROM eleve JOIN etab on eleve.etab_id = etab.id JOIN suivi on suivi.eleve_id=eleve.id JOIN aesh on suivi.aesh_id=aesh.id WHERE eleve.etab_id=$id and aesh.id>1 ;