Formatting tooltips and legend


#1

Hi guys, I’m looking in the forum and the documentation by “formatting” because I need change the format of a metric in the tooltips of a bar chart to money, but the only things that appears are related to format the Raw Data Table. Let me know how to do that or where I have to look. Thanks.


#2

hi @ryan the easy way to do this is change the metric type through Custom Metadata when you create your provider, for example if you want to change the pricepaid metric of the ticket_sales datasource in a elasticsearch data provider you can follow the next example:

var providers = [ {
        name:'Elasticsearch',
        provider:'elasticsearch',
        url:'https://chartfactor.com/elastic/',
        metadata: {
            'ticket_sales': {
                'fields': {
                    'pricepaid': { 'type': 'MONEY' }
                }
            }
        }
    }
]

After that in whatever chart that you use your metric you will see it is formatted correctly, let me know if this answer your question.


#3

Thanks @dario, it works as expected. Only one question, what happens if I want to change the money symbol to pounds £? Is there is a way to do that?


#4

hi @ryan that is a good question actually, right now there is no a easy way to do it in the current stable releases, but the development team is working alreay in a full internationalization support that will be available soon in the Community Edition. Please continue giving us that kind of feedback to help us improve the software. Thank you.


#5

Hi, I have the same problem. I’d like to customize the currency symbol of my money fields. Is there anything I can do at the moment?


#6

Hi @Joseph , yes, this feature is currently supported and very easy to accomplish. You just need to set the currency inside your metadata configuration. Example code:

fields: {
       ‘price’: { type: ‘MONEY’ },
       ‘price_yen’: {
         type: ‘MONEY’,
         currency: ‘¥’,
         displayFormat: ‘0,0.00 $’
       }
     }

You can read more here: https://chartfactor.com/doc/1.15/data_providers/custom_metadata/#currencies