Chartjs-Chart.js different y axis depending on graph from select options

0👍

The userCallback runs for each tick. In your code you return a value, when any value’s country_name in $scope.selects matches ‘Eire’ or ‘UK’.. Is that what you want?

I dont know enough about your data, but if the country_name is dependant on the dataset and not each data point, you could create a currency prefix variable outside of the userCallback and add it onto the tick values:

// Load dataset
// set currency prefix based on the data
...
userCallback: function (value, index, values) {
    if (KpiName === "sales_growth_ytd") 
    {
        return value + '%';
    }
    else {
        return currency_prefix + value;
    }
}

Leave a comment