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

188
Views
¿Cómo puedo obtener mis datos con ajax de json y trazar un gráfico con ellos?

Quiero tomar datos de solicitudes JSON con ajax y trazar datos según campos específicos. Cuando solicito enlace:

 http://127.0.0.1:8000/sensor/print/

Recibo una respuesta como JSON:

 {"temp0": "10", "temp1": "30", "voltage": "10", "current": "100"}

Luego creo un js:

 $(document).ready(function(){ function secret(){ $.ajax({ type: "GET", url: 'http://127.0.0.1:8000/sensor/print/', data: {get_param: 'temp0'}, dataType: 'json', success: function (data) { return Number(data.temp0); } }); } Plotly.newPlot('simple',[{ y: [1,2,3].map(secret), mode: 'lines', line: {color: '#80CAF6'} }]); var interval = setInterval(function() { Plotly.extendTraces('simple', { y: [[secret()]] }, [0]) if(++cnt === 100) clearInterval(interval); }, 300); });

y como resultado, tengo una trama en movimiento sin ninguna impresión ni mis valores. ¿Cómo puedo obtener mis valores de la respuesta JSON y trazar un gráfico con ellos?

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!