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

130
Views
echarts y axis not displaying values from array in sequence

What I am trying to do, display a timeline on y-axis, every 15 mins starting from 7 Am to 7 PM, i.e 7:00 AM , 7:15 AM .... 7:45 PM.

This is my create timeline function

const CreateTimeLine = starttime =>{
  
  var hours, minutes, ampm;
  var time = [];

  // 60 * 12 = 720
  for(var i = 0; i <= 720; i += 15){
  
      hours = Math.floor(i / 60);
      minutes = i % 60;
      if (minutes < 10){
          minutes = '0' + minutes; // adding leading zero
      }
      // ampm = hours % 24 < 12 ? 'AM' : 'PM';
      hours = hours % 12;
      
      if (hours === 0){
          // state what time to start
          hours = starttime;
      }
      // time.push(hours + ':' + minutes + ' ' + ampm);
      
      time.push(hours + ':' + minutes);
  }
  
  /* console.log("timeline ", time) */;

  return time;
}

Expected result: timeline show in sequence as what my function does.

Actual result: time line is not displaying as expected.

enter image description here Where am I doing it wrong??

this is my jsfiddle with the whole code

about 4 years ago · Juan Pablo Isaza
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!