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

93
Visualizações
Show Highcharts tooltip at the bottom of the chart in responsive mobile version

I have this line chart where I am showing a shared tooltip of all series on the right side of the chart. However, in the mobile view, it looks ugly because half the screen space is taken by the chart and half by the tooltip. In the mobile responsive layout, I want the chart to take the whole screen width and shared tooltip to go to the bottom of the chart. How can I achieve this?

I have written the code below and it works on jsfiddle.

responsive: {
    rules: [{
      chartOptions: {
        chart: {
          marginRight: 0
        },
        tooltip: {
        outside: true,
          positioner: function(boxWidth, boxHeight, point) {
            var chart = this.chart; // get plotTop;

            return {
              x: chart.plotLeft + chart.plotSizeX - 100,
              y: chart.chartHeight - chart.plotTop - chart.xAxis[0].bottom + boxHeight + 50
            };
          }
        }
      },
      condition: {
        maxWidth: 640
      }
    }]
  }

https://jsfiddle.net/userMB/k790c4rw/4/

But the problem is that my chart is enclosed inside a container div which is further enclosed inside a section. Like the code below: Hence, the tooltip doesn't show below the chart as I want. Any ideas how I can achieve this?

<section class="section section-lg ">
    <div class="container" style="max-width: 95vw; border: 1px solid grey; min-height: 65vh;">
        <"some form">
        <div id="chart" style="min-height: 50vh;"></div>
    </div>
<section>

And that same code behaves differently within enclosed section and div elements. see https://jsfiddle.net/userMB/k790c4rw/10

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use responsive rules and define different options for small screens. For example:

  responsive: {
    rules: [{
      chartOptions: {
        chart: {
          marginRight: 0
        },
        tooltip: {
          positioner: function(boxWidth, boxHeight, point) {
            var chart = this.chart; // get plotTop;

            return {
              x: chart.plotLeft + chart.plotSizeX - 100,
              y: chart.plotTop + chart.plotSizeY - 50
            };
          }
        }
      },
      condition: {
        maxWidth: 640
      }
    }]
  }

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

API Reference: https://api.highcharts.com/highcharts/responsive.rules

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