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

221
Views
How can I disable the Highstocks range selector buttons when loading data asynchronously?

I'm creating a chart similar to the Highcharts lazy loading example where I'm retrieving data from my backend service every time the user zooms in via mouse drag or interaction with the navigator. Clicking on the range selector buttons works correctly as well, but the issue I'm running into is that the buttons are not disabled while my chart is loading - since it takes awhile for the data to load due to the nature of my backend, this means that users can click on the other buttons as many times as they want.

This leads to multiple calls to the backend which ultimately messes up how the chart is displayed. For example, I can click on the "1y" option then "1d". Since the "1y" view takes much longer to load, the graph will first display the "1d" data and then switch to the "1y" one later. Even though it switches, the "1d" button will still appear as the one selected last.

In addition to the Highcharts/Highstocks API documentation, I've looked at plenty of posts on StackOverflow as well as GitHub but there doesn't seem to be any answer to this problem. I've tried changing the "chartOptions" variable like so:

rangeSelector.enabled = false;

but this causes the entire graph to re-render each time, which also resets my navigator view. I've also tried the useRef hook to see if a request has already been made, and to not create a new one if so, but clicking on the range selector buttons still changes the chart view even though it doesn't explicitly send a call to the backend. The last solution I can think of creating a div that I use to essentially "block out" the range selector buttons while loading, but that seems like a pretty hack-y fix. Is there anything else I should try? Thanks!

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

0

While fetching the data, set a loading variable as true and when the data is fetched, set loading to false. Then set a prop disabled={!loading}.

about 4 years ago · Juan Pablo Isaza Report

0

The simplest way will be to toggle by CSS only rangeSelector group:

  chart.rangeSelector.group.css({
    display: 'none'
  });

Live example: https://jsfiddle.net/BlackLabel/g906s4k2/

API Reference: https://api.highcharts.com/class-reference/Highcharts.SVGElement#css

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!