I am not entirely sure how to accomplish this with values that are being passed from the JS API to the view but there is a way to dynamically change the axis as desired. Tableau Tip: Dynamic axis selections with parameters in less than five minutes
Hope this helps!
I had gone through the above link, but it has limited kind of parameter values. In our case we have so many combinations to define(Around 500-600).
We found work around for this, we have created normal "TEXT" in dashboard for labels. We have hidden actual axis labels for the charts and then we are passing parameters for the "TEXT" in dashboard.