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

133
Views
Highcharts - Suppress points being dragged on drag event

I'm new to Highcharts - it seems you can only trigger drag events if the appropriate dragDrop events are defined and enabled on a series. E.g. https://api.highcharts.com/highcharts/plotOptions.series.dragDrop

How can I suppress the points actually being moved around in my chart? I have tried setting allowPointSelect: false and disabling both draggableX and draggableY but of course doing that don't fire any drag events. I have also tried event.preventDefault but no luck

What I'm basically looking for is to have a user drag over a range in a line/area chart from startX/Y to endX/Y and display the results to the user (which I can successfully get using mouseOver - a nice feature!)

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

0

For such a feature, you don't need to use draggable-points module. A simple custom solution with a crosshair and dynamically added/removed plot-lines will be enough. For example:

  chart: {
    animation: false,
    events: {
      load: function() {
        const chart = this;
        this.series[0].points.forEach(point => {

          point.graphic.on('mousedown', function() {
            chart.draggedPoint = point;
            chart.xAxis[0].update({
              plotLines: [{
                width: 2,
                color: 'grey',
                dashStyle: 'ShortDash',
                value: point.x
              }]
            });
          });
        });

        document.body.addEventListener('mouseup', function() {
          chart.draggedPoint = null;
          chart.xAxis[0].update({
            plotLines: []
          });
        });
      }
    }
  }

Live demo: https://jsfiddle.net/BlackLabel/rsuj93at/

API Reference: https://api.highcharts.com/highcharts/tooltip.formatter

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!