Skip to content

How to populate a pie chart (i.e any chart) with table data? #533

Answered by lovasoa
alexandlazaris asked this question in Q&A
Discussion options

You must be logged in to vote

Hello and welcome to SQLPage !

What you want is probably

select 'chart'  as component, 'pie' as type;

SELECT item as label, count(*) as value
FROM Items
GROUP BY item;

Here is a live example that you can run in your browser: https://replit.com/@pimaj62145/SQLPage-bar-chart#index.sql

Two important concepts in SQLPage are components and properties. A component is a graphical widget that you can add to your page.

  • You customize the components appearance with top-level properties, that you set in a first SQL query. Most of the time you hardcode them, but you are free to make your own queries to return them. In our example above, there is one top-level parameter: type, that is set to the str…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@alexandlazaris
Comment options

Answer selected by alexandlazaris
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
documentation Improvements or additions to documentation
2 participants