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

84
Views
ChartJS stock price line chart config with autoscale

I'm trying to configure ChartJS to show a stock price line chart with months on an x-axis legend and a price on y.

But want to seed end of week stock closure price, so 4-5 data points per month, depending on the month.

Also is there a way to automatically calculate a current date and automatically build labels on a rolling basis.

So far got this:

const config = {
  type: 'line',
  data: data,
};

const labels = ['Aug', '', '', '',  'Sep', '', '', '',  'Oct', '', '', '',  'Nov', '', '', '',  'Dec', '', '', '',  'Jan', '', '', '',  'Feb', '', '', '',  'Mar', '', '', '',  'Apr', '', '', '',  'May', '', '', '',  'Jun', '', '', '',  'Jul']

const data = {
  labels: labels,
  datasets: [{
    label: 'Apple stock price',
    data: [141,139,128,133,136,130,136,125,126,128,129,127,122,125,122,122,131,133,131,126,130,131,128,131,131,128,128,126,128,127,133,130,137],
    fill: false,
    borderColor: 'rgb(75, 192, 192)',
    tension: 0.5
  }]
};

But looks like I need somehow to configure the logarithmic scale for the y-axis as well as better distribute/map weekly prices to months.

Found several examples/answers here but a lot of them are for the question 5-10 years old, so maybe in a newer version this task can be done easier.

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!