Chart.js y axis Formatting with Metric prefix

Hii
I’m new here, I am using Chart.js to generate a bar chart that shows currency values. By default the y-axis labels use metric prefixes for abbreviation, e.g. 1k is displayed instead of 1000 and 1M instead of 1000000.

I have tried this code but it shows only the currency symbol but my number still like 1000000 formats!

this is the code what I have tried.

 yAxes: [{

              ticks: {
                 display: true,
                 beginAtZero: false,
                callback: function (value, index, values) {
                            if (parseInt(value) >= 1000) {
                           return '$' + value  ;
                           } else {
                        return value;
                         }
                         }
                       },
                          gridLines: {
                               show: true,

                             }
                       }],

thanks