sqlpage / SQLPage

Fast SQL-only data application builder. Automatically build a UI on top of SQL queries.
https://sql.datapage.app
MIT License
1.57k stars 89 forks source link

Graph doesnt display data #492

Closed alexisrc1 closed 1 month ago

alexisrc1 commented 3 months 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 3 months 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 ?

alexisrc1 commented 1 month ago

Hello @lovasoa and congratulation for this beautiful project that SQLPage is 😉

please find the same issue:


SELECT   
    'table' AS component,  
       TRUE  as sort,  
          TRUE    as search,  
          'Last 10 days of data' as description,  
          1 as small
    ;

SELECT * FROM (
    SELECT DATE('2024-07-01') AS x, 1378.52 AS y
    UNION ALL
    SELECT  DATE('2024-07-02') AS x, 4987.839999999999
    UNION ALL
    SELECT DATE('2024-07-03') AS x, 14099.9
    UNION ALL
    SELECT DATE('2024-07-04') AS x, 3886.4200000000005
    UNION ALL
    SELECT DATE('2024-07-05') AS x, 11128.019999999999);

--> this should show a table

SELECT 
    'chart' AS component,
   -- CONCAT('daily Revenue from ', $start_date_comparison, ' to ', $end_date_comparison) AS title,
 'area' AS type,
   -- 'indigo' AS color,
  5 AS marker,
 TRUE    as time, 
    0 AS ymin;

and

SELECT * FROM (
    SELECT DATE('2024-07-01') AS x, 1378.52 AS y
    UNION ALL
    SELECT  DATE('2024-07-02') AS x, 4987.839999999999
    UNION ALL
    SELECT DATE('2024-07-03') AS x, 14099.9
    UNION ALL
    SELECT DATE('2024-07-04') AS x, 3886.4200000000005
    UNION ALL
    SELECT DATE('2024-07-05') AS x, 11128.019999999999);

doesnt display anything