Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!