Hi Guys,I was wondering if it is possible to automatically convert the values in the data to display currency values. Let's say I have a data set
data = [{ 'Label':'Pen', 'Amount': 1000 },
{ 'Label':'Pencil', 'Amount': 2000},
{ 'Label':'Paper', 'Amount': 3000}];
I would like to Display a dollar $ symbol with the values or it would be better if values like 1000 are truncated as $1k and the same is reflected all over the graph while displaying final values and even while using the tooltip.
Hello Vicky,
Yes you can format the labels of the igCategoryChart. To do so you should provide a function to xAxisFormatLabel or yAxisFormatLabel options of the chart. You may check this online sample where is shown how to change the labels – “Category Chart - Axis Labels”.
Please let me know if any additional questions on this matter arise.
Thank you for the speedy reply.Is it possible to give me a small working example in angular 6?
Hi Vicky,
I did not realize you are using angular components. To format the labels in igxCategoryChart you should do almost the same. Set the yAxisFormatLabel property to a call back function. In the callback you will receive the axis labels. You should format them as you need and return the result from your callback like this:
<igx-category-chart … [yAxisFormatLabel]="formatLabel"> … </igx-category-chart>
export class YourChartComponent { formatLabel(value){ return `${value} and some custom text`; } }
Please check this StackBlitz where I have implemented this for you and let me know if this is what you are looking for.
Hi, Milko. I'm using igniteui-angular-charts version 9.1.2 and looking for a similar feature. I'm looking to display y values in the tool tip as a formatted currency. I tried using [yAxisFormatLabel] providing a callback function however this only seems to modify the labels on the x and y axis. Is there a way to format values in the tool tips?