lovasoa / SQLpage

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

[Feature] Allow tooltips text to be customised #217

Open accforgithubtest opened 8 months ago

accforgithubtest commented 8 months ago

With all the charts in sqlpage, the tooltips seem to be only auto-generated.

It would be nice if the tooltips can be customized, allowing users to add extra data / context to the tooltip, (using data from columns or other static text) that are not necessarily required for the chart, but is extra info that can be passed on to a user via tooltips.

DSMejantel commented 8 months ago

Hi, it's possible to add some informations like this :

select 
    SUBSTR(aesh.aesh_firstname, 1, 1) ||'. '|| aesh_name as label,
    SUBSTR(eleve.prenom, 1, 1) ||'. '||eleve.nom||' ('||eleve.classe||')' as series,
    sum(suivi.temps/mut)        as value
        FROM suivi JOIN...

Capture-20240207072712-379x276

accforgithubtest commented 8 months ago

Hi @DSMejantel , thanks for your response.

In this example is the x-axis the same as the label ? According to the docs, looks like label is just an alias for x.

So when I tried to add a .... as label to a chart that already had a timeseries for x, it broke the chart. I think it means a chart cannot have different values for x and label at the same time. label is just an alias for x.

Pls let me know if I am missing something.

DSMejantel commented 8 months ago

You're right. If we have 'something as x', we can't ask for 'anotherthing as label'. What I propose with my example, you can concate differents rows in the label with || in relation with the context of the data like here with firstname and name : SUBSTR(aesh.aesh_firstname, 1, 1) ||'. '|| aesh_name as label

accforgithubtest commented 8 months ago

Thanks for the reply @DSMejantel. I am on the same page with you about this now.

The feature request is to allow for values that are not the same as the x or y to be passed to the tooltip. For example x is a time series, y is a dollar amount. Tooltip can provide other extra info (other than the dollar amount / predefined x-axis).