Chart Y axis currency format

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
SilentNight
User
Posts: 171

Chart Y axis currency format

Post by SilentNight »

Using currency symbol in SQL makes the chart not function properly, showing no data on the chart and putting the following code in Chart -> Configuration doesn't work either:

{
options:
	scales: {
		y: {
			ticks: {
				callback: (value, index, values) => {
				return new Intl.NumberFormat('en-US'. {
					style: 'currency',
					currency: 'USD'
				}).format(value);
				}
			}
		}
	}
}

Any ideas?


arbei
User
Posts: 9384

Post by arbei »

Not sure how you "use currency symbol in SQL", but note that the format of the Y axis is not from the field value, which should be numeric. In fact, you don't need to format it yourself, you should set the format of the Value field for the chart as "Currency" under View Tag panel.


Post Reply