Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

135
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda