Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

134
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda