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

203
Visualizações
How can I resolve not to render the loaded route again? - CHART.js

In my project, X and Y coordinates move like a go-kart race. For that, I drew a track to see what they were running around. However, the problem is that like the points, this loaded track / route will reload and so it will disappear, even though I want it to stay there all the way. Could someone help me?

var myChart;

let canvas = document.getElementById('myChart');

let ctx = canvas.getContext('2d');
    
    function init(){

        myChart = new Chart(ctx, {
    
            type: 'scatter',
    
            data: {
    
                datasets: [{
    
                    label:[datas.nameandgokart[0].username+" - "+datas.nameandgokart[0].gokart_name.substring(4,8)],
                    
                    backgroundColor:["red"],
    
                    data: [],
    
                },]
    
            },
    
            options: {
    
                responsive: false,
    
                aspectRatio: 1,
                
                maintainAspestRatio: true,
    
                scales: {
    
                    xAxes: [{
    
                        gridLines:{
                            color:"rgba(0,0,0,0)"
                        },
                    }]
    
        ,            yAxes: [{
    
                        gridLines:{
                            color:"rgba(0,0,0,0)"
                        },
                    }]
            }
    
        });
        const movements = JSON.parse(localStorage.getItem("Palya"));

    function drawLine(ctx, x1, y1, x2, y2) {
        ctx.beginPath();
        ctx.strokeStyle = 'black';
        ctx.lineWidth = 4;
        ctx.moveTo(x1, y1);
        ctx.lineTo(x2, y2);
        ctx.stroke();
        ctx.closePath();
    }
    for(const movement of movements){
        drawLine(ctx,...movement.from,...movement.to)
    }
    
    }
    init()
})

Here is the drawLine:
[1]: https://i.stack.imgur.com/RP80X.png


The problem is after starting the go-kart on the chart:
[2]: https://i.stack.imgur.com/7Wm4g.png
about 4 years ago · Juan Pablo Isaza
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