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

286
Visualizações
Why is Plotly displaying empty space when displaying a graph through django data?

I am trying to print a pie graph using from Django but it is showing an empty space instead of printing the pie chart. I used the instructions from https://plotly.com/javascript/pie-charts/ but I am getting an error. How do I fix it?

views.py

labels = list(account_graph.keys()) # ['Food', 'Gas', 'Friends'] 
data = list(account_graph.values()) # [-6.09, -20.0, -7.0]

return render(request, "finances/account.html", {'labels': labels, 'data': data})

account.html

<div id='expenses'></div>

<script>

      var data = [{
        values: {{data|safe}},
        labels: {{labels|safe}},
        type: 'pie'
      }];

      var layout = {
        height: 400, 
        width: 500
      }

      Plotly.newPlot('expenses', data, layout);
</script>
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The problem is that your values are all negative.

Non numeric or negative values are ignored in the pie chart sector calculations (source code), so no slices show up making the graph look empty.

over 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