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

387
Views
Chart.js v2 - Partial Y -grid lines with bar chart

ChartJSBarChart

I want tiny "ticks" on the x-axis as seen in the image in between the green bars, that go into the chart, but not all the way to the top of the chart. I have been able to turn them on or off, but have not been able to have them only going partially up the chart.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Was able to accomplish this in a bit of a "hacky" way, but ended up doing this:

 options= {
        scales: {
                // The following will affect the vertical lines (xAxe) of your dataset
                xAxes: {                 
                    grid: {
                        tickWidth:0, 
                        borderDashOffset:-210,
                        drawBorder:true,
                        borderDash: [20,230],    
                    },
                },
                
        }
    }

The tickWdith: 0 is to stop the ticks from going below the x-axis line. The borderDash was fine-tuned to what I needed, 230 was the sweetspot to get to the bottom of my chart since the dashes start at the top of the grid-lines. The borderDashOffset was -210, the length of the border dash + the negative of the spacing(230). Here is also a posted pic of my finished result:

enter image description here

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!