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

117
Visualizações
How to update and shift my graph along the x-axis?

I am trying to update and shift my graph along its x-axis, so that it includes a maximum of 5 values on the x-axis. This is what I am trying to achieve essentially. This is what I currently have:

    <body>
        <div id="chart"></div>

        <script type="text/javascript">

            var options = {
                chart: {
                    id: 'realtime',
                    height: 350,
                    type: 'line',
                    animations: {
                        enabled: true,
                        easing: 'easeinout',
                        speed: 1000,
                        dynamicAnimation: {
                            enabled: true,
                            speed: 1000
                        }
                    }
                },
                dataLabels: {
                    enabled: false
                },
                stroke:{
                    curve: 'smooth'
                },
                series: [{
                    name: "Sales",
                    data: mData()
                }],
                title: {
                    text: 'Ajax Example',
                },
                noData: {
                    text: 'Loading...'
                }
            }

            var chart = new ApexCharts(
                document.querySelector("#chart"),
                options
            );

            chart.render();

            setInterval(function(){
                chart.appendData([{
                    name: "Sales",
                    data: mData()
                }]);
            }, 1000);
        </script>
    </body>

My code already updates my graph, but how can I shift my graph with the current code I have?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You can set max number of elements in xaxis like this

xaxis:{
  range: 5,
},

https://apexcharts.com/docs/options/xaxis/#range

about 4 years ago · Santiago Trujillo 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