lovasoa / SQLpage

SQL-only webapp builder, empowering data analysts to build websites and applications quickly
https://sql.ophir.dev
MIT License
928 stars 65 forks source link

Graph doesnt display data #492

Open alexisrc1 opened 3 weeks ago

alexisrc1 commented 3 weeks ago

Introduction

While the data exist and seems to be formatted correctly, no data apperas on the graph

To Reproduce

here is a data sample:

series | x | y 2024 | 08 | 1378.52 2024 | 09 | 4987.839999999999 2024 | 10 | 14099.9 2023 | 10 | 3886.4200000000005 2024 | 11 | 11128.019999999999 2023 | 11 | 9229.219999999998 2023 | 12 | 12063.259999999995 2024 | 12 | 24815.0 2023 | 13 | 8767.86 2024 | 13 | 12267.899999999996 2023 | 14 | 10196.460000000003 2024 | 14 | 23070.420000000002 2024 | 15 | 13350.87 2023 | 15 | 31956.820000000007 2023 | 16 | 53994.23000000004 2024 | 16 | 15837.699999999997


the table component does display the data above:
SELECT 'table' as component;

SELECT year as series,hour_included as x, sum(netto_incl_eur) as y
from data_live_facture
group by year,hour_included
order by hour_included asc;

but this doesnt display anything:

select 
    'chart'             as component,
    concat('Live data CA') as title,
    'area'              as type,
    'indigo'            as color,
    5                   as marker,
    0 as ymin;

SELECT year as series,hour_included as x, sum(netto_incl_eur) as y
from data_live_facture
group by year,hour_included
order by hour_included asc; 

Actual behavior

After following these steps, what happened ? If you saw an error on the command line or inside your page, then paste it here

your error message here

Screenshots

image

Expected behavior

A clear and concise description of what you expected to happen.

Version information

Additional context

Add any other context about the problem here.

lovasoa commented 2 weeks ago

Hey @alexisrc1 !

I tried to reproduce the issue with

select 
    'chart'             as component,
    concat('Live data CA') as title,
    'area'              as type,
    'indigo'            as color,
    5                   as marker,
    0 as ymin;

SELECT * FROM (
    SELECT 2024 AS series, 08 AS x, 1378.52 AS y
    UNION ALL
    SELECT 2024, 09, 4987.839999999999
    UNION ALL
    SELECT 2024, 10, 14099.9
    UNION ALL
    SELECT 2023, 10, 3886.4200000000005
    UNION ALL
    SELECT 2024, 11, 11128.019999999999
    UNION ALL
    SELECT 2023, 11, 9229.219999999998
    UNION ALL
    SELECT 2023, 12, 12063.259999999995
    UNION ALL
    SELECT 2024, 12, 24815.0
    UNION ALL
    SELECT 2023, 13, 8767.86
    UNION ALL
    SELECT 2024, 13, 12267.899999999996
    UNION ALL
    SELECT 2023, 14, 10196.460000000003
    UNION ALL
    SELECT 2024, 14, 23070.420000000002
    UNION ALL
    SELECT 2024, 15, 13350.87
    UNION ALL
    SELECT 2023, 15, 31956.820000000007
    UNION ALL
    SELECT 2023, 16, 53994.23000000004
    UNION ALL
    SELECT 2024, 16, 15837.699999999997
);

But it seems to be working well:

image

Can you please provide a reproducible example with static data, that exposes the issue with the latest version of sqlpage ?