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

167
Visualizações
toDataUrl() gives a blank image

I saw this question answered multiple times but I haven't find a solution. I won't put everything inside the chart because Its a pretty long function and it works perfectly, so I don't think the problem is there, please help :´(

JS: I know some '}' are missing, i just copied the important part

    
              var ctx = document.getElementById("myChart").getContext("2d");
              ctx.fillStyle = "#FF0000";
            ctx.fillRect(20, 20, 150, 100);
              
              var myChart = new Chart(ctx, {
                type: 'scatter',
                data: {
                  datasets: [{
                    label: 'Tiempo-Hole',
                    borderColor: window.chartColors.red,
                    fill: false,
                    pointRadius: 0,
                    data: storage,
                    showLine: true,
                  },
                options: {
                    bezierCurve : false,
                    animation: {
                        onComplete: done
                    },
            
                    }
                }
              });  ```

            function done(){
                alert("haha");
                var chartR = document.getElementById("myChart");
                var img = chartR.toDataURL("image/png");
                document.getElementById('base64').value = img;
              }
PHP/HTML: This goes inside some divs, etc...

<img name="base64" id="base64" src="">
      <canvas id="myChart"></canvas>

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