You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
explain how to build a graph from a remote database please #230
Let's say you have a table named charts with the following contents :
date
value
2022-01-01
15
2022-04-01
46
and you want to generate the same graph as in the documentation.
You start by connecting SQLPage to your database by editing sqlpage/sqlpage.json. Given the sql syntax you used above, it looks like you are using Microsoft SQL Server, so the connection string will have the following form, if the database is running locally on your computer (on localhost) :
Then you create a file named my_chart.sql with the following contents :
select'chart'as component,
'Quarterly Revenue'as title,
'area'as type,
'indigo'as color,
5as marker,
TRUE astime;
selectdateas x,
value as y
from
charts;
The second select will fetch the values from your table and return them in the format expected by the SQLPage chart component.
Activity
lovasoa commentedon Feb 16, 2024
Hello and welcome to SQLPage !
Let's say you have a table named
chartswith the following contents :and you want to generate the same graph as in the documentation.
You start by connecting SQLPage to your database by editing
sqlpage/sqlpage.json. Given the sql syntax you used above, it looks like you are using Microsoft SQL Server, so the connection string will have the following form, if the database is running locally on your computer (on localhost) :{ "database_url": "mssql://username:password@localhost/YourDatabaseName" }Then you create a file named
my_chart.sqlwith the following contents :The second select will fetch the values from your table and return them in the format expected by the SQLPage chart component.
You can then launch SQLPage and open http://localhost:8080/my_chart.sql and you will see your graph appear.