Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
Chart JS remove x-axis and y a-xis visibility

I have a line chart in Chartjs. I want to be able to remove the x-axis and y-axis data from visibilty so it only shows the line.

Below is the codepen that I am working with.

codepen.io

The code I have is the below.

<html>
<style>
    body{
        background:none;
    }
    canvas {
        background-color: white;
        color:black;
    }
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
<body>
<canvas id="myChart" style="width:100%;max-width:600px"></canvas>

<script>
var xValues = [50,60,70,80,90,100,110,120,130,140,150];
var yValues = [7,8,8,9,9,9,10,11,14,14,15];

new Chart("myChart", {
  type: "line",
  data: {
    labels: xValues,
    datasets: [{
      fill: false,
      lineTension: 0,
      backgroundColor: "rgba(0,0,255,1.0)",
      borderColor: "rgba(0,0,255,0.1)",
      data: yValues
    }]
  },
  options: {
    legend: {display: false},
    scales: {
       xAxes: [{
      gridLines: {
         display: false
      },
      
   }],
   yAxes: [{
      gridLines: {
         display: false
      }
   }]
    }
  }
});
</script>

</body>
</html>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

ticks: { display: false } will take care of that.

    scales: {
       xAxes: [{
         ticks: {
           display: false
         },
        gridLines: {
          display: false
        },
      }],
      yAxes: [{
        ticks: {
          display: false
        },
        gridLines: {
         display: false
        }
      }],
    }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!