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

160
Vistas
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>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

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.

about 4 years ago · Juan Pablo Isaza 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