Search code examples
javascriptamchartsamcharts4

How to disable Cursor values on value axis (Yaxis) on amCharts4


I have used am4charts.XYCursor(), which shows cursor values on Y & X axes. I wish to hide / disable values showing on Y axis.

chart.cursor.lineY.disabled = true;

CodePen: https://codepen.io/pthakkar/pen/rgLqYY

/* Create a cursor */
chart.cursor = new am4charts.XYCursor();

/* Configure cursor lines */
chart.cursor.lineX.stroke = am4core.color("#8F3985");
chart.cursor.lineX.strokeWidth = 4;
chart.cursor.lineX.strokeOpacity = 0.2;
chart.cursor.lineX.strokeDasharray = "";

chart.cursor.lineY.disabled = true;

I expect the cursor values appearing on the Y axis (in black background) to disappear.


Solution

  • The cursor values are controlled by another properties called Axis Tooltips and they are configured per axis, and not per cursor (as it would be assumed). Calling:

    axis.cursorTooltipEnabled = false;
    

    should disable the tooltip. See the modified codepen for a working solution.