Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format values, tooltips and legends in API-based charts #782

Closed
garcia-marco opened this issue Jul 21, 2021 · 5 comments
Closed

Format values, tooltips and legends in API-based charts #782

garcia-marco opened this issue Jul 21, 2021 · 5 comments

Comments

@garcia-marco
Copy link

garcia-marco commented Jul 21, 2021

Hello everyone

Expected behavior

I would like to be able to format values in € in API-based single value charts.
Capture d’écran 2021-07-21 à 15 13 13

I would like to be able to format tooltips and legends in other API-based charts like in the screenshot bellow. (tooltips in € and numbers with spaces in legends) (If I'm not mistaken, legends numbers have spaces at the base in chart.js)
Capture d’écran 2021-07-21 à 15 30 49
I'm using chart.js on a project and I wanted to know if it's possible to use the options object to format tooltips :

new Chart(chart, {
 type,
 data,
 options: {
  plugins: {
   tooltip: {
    callbacks: {
     label: ({ raw: value }) => {
      return new Intl.NumberFormat('fr-FR', { style: 'currency', currency: 'EUR' }).format(value)
     }
    }
   }
  }
 }
}

Actual behavior single value charts

Capture d’écran 2021-07-21 à 14 39 22

Simple charts can format numbers under the hood if it's a price display like in the screenshot. But it seems that I can't do the same thing with API-based chart. (I need more options than simple charts gives me)

Actual behavior other charts

Capture d’écran 2021-07-21 à 14 45 53

It seems that other API-based charts, like time based charts in the screenshot, doesn't allow to change tooltips and legends on the left.

Context

  • Package Version: 7.0.0
  • Express Version: 4.17.1
  • Sequelize Version: 5.15.1

Thanks in advance

@garcia-marco
Copy link
Author

Also, the format of objective API-based chart isn't the same between the value and the objective
Capture d’écran 2021-07-22 à 17 45 34
Is this possible to change format for the value ?

@garcia-marco
Copy link
Author

Up

@ghusse
Copy link
Contributor

ghusse commented Aug 26, 2021

Hello @garcia-marco,

Could you please explain your issue in the community forum? It's the best place to receive help: https://community.forestadmin.com/

@garcia-marco
Copy link
Author

Hello, I've done a topic in the community forum now : https://community.forestadmin.com/t/format-values-tooltips-and-legends-in-api-based-charts/3168

@ghusse
Copy link
Contributor

ghusse commented Aug 27, 2021

Thanks

@ghusse ghusse closed this as completed Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants