Home Forums Chart Support Hide AxisY

Hide AxisY

Viewing 7 posts - 1 through 7 (of 7 total)
  • #20262

    I got a chart with 2 Y axis. It looks like the 2nd sample on this page: https://canvasjs.com/docs/charts/chart-options/axisy/ the one labeled Multiple Y axis.

    I would like to hide the second Y axis with title “Axis Y 2 Title”. I only want it to hide not remove it. I can set a blank title but the tick marks are still there. Is it possible?

    Edit: Looks like I ask to soon. I found the answer already

    I set it to something like this

            title: "",
            title: "",
            gridThickness: 0,
            tickLength: 0,
            lineThickness: 0,
            labelFormatter: function(){
              return " ";
            }   
    • This topic was modified 6 years ago by papito.
    #20266

    @papito,

    To hide the axis line and tick you can set the lineThickness and tickThickness to 0. Please check the below code snippet to hide the axis line and tick –

    {
      title: "",
      tickThickness: 0,
      lineThickness: 0,
      labelFormatter: function(){
         return " ";
      }  
    }

    Also, kindly take a look at this JSFiddle for a working sample.

    hiding axis elements

    ___________
    Indranil Deo
    Team CanvasJS

    #26629

    nsn

    Hi, this is not working correctly when having values < 0

    data: [
          {
            type: "column",
            dataPoints: [
            { x: 10, y: 71 },
            { x: 20, y: 55},
            { x: 30, y: 50 },
            { x: 40, y: 65 },
            { x: 50, y: -95 },
            { x: 60, y: -68 },
            { x: 70, y: -28 },
            { x: 80, y: -34 },
            { x: 90, y: 14}
            ]
          }
          ]

    It keeps show the ‘-‘ , How can we overcome this ?

    #26640

    @nsn,

    It seems to be working fine and not showing any ticks ‘-‘. Can you kindly create JSFiddle reproducing the issue and share it with us so that we can look into the code, understand the scenario and help you out?

    ___________
    Indranil Deo
    Team CanvasJS

    #26641

    nsn
    #26649

    @nsn,

    Setting valueFormatString defines the format for labels appearing on Axis Y, which doesn’t include the negative symbol (-) incase of negative number. Instead, using labelFormatter to return an empty string should work fine in this case. Please check the below code snippet –

    axisY:{
      title: "",
      tickLength: 0,
      lineThickness:0,
      margin:0,
      labelFormatter: function(e) {
         return "";
      }
    },

    Also, kindly take a look at this updated JSFiddle.

    hiding axis label

    ___________
    Indranil Deo
    Team CanvasJS

    #26650

    nsn

    Thanks

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.