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

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

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 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