amcharts4

Using axis ranges to place labels at arbitrary category


As you can see in the below image. I want to add custom label ranges for y axis.

enter image description here

I have followed this tutorial and tried below code but it was not working, Any idea how to use categoryAxis with custom labels?

let range0 = categoryAxis.axisRanges.create();
range0.value = "MCR.INV-1";
range0.text = "MCR.INV-1";

let range500 = categoryAxis.axisRanges.create();
range500.value = "MCR.INV-2";
range500.text = "MCR.INV-2";

let range1000 = categoryAxis.axisRanges.create();
range1000.value = "PEV1.INV-1";
range1000.text = "PEV1.INV-1";

Solution

  • CategoryAxis ranges use category/endCategory for placement. Replacing value with category in your ranges will fix the problem.